Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend resyncPeriods in controllers in production. #15153

Merged
merged 1 commit into from
Oct 8, 2015

Conversation

wojtek-t
Copy link
Member

@wojtek-t wojtek-t commented Oct 6, 2015

This should significantly reduce amount of LIST requests in production cluster (still leaving this branch tested in e2e tests).

cc @lavalamp @kubernetes/goog-csi

@k8s-github-robot k8s-github-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 6, 2015
@k8s-github-robot
Copy link

Labelling this PR as size/L

@k8s-bot
Copy link

k8s-bot commented Oct 6, 2015

GCE e2e test build/test passed for commit 79253030be1034e848bb7f733c67913945dbebe9.

@@ -54,6 +54,13 @@ var (
KeyFunc = framework.DeletionHandlingMetaNamespaceKeyFunc
)

type ResyncPeriodFunc func() time.Duration
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't understand why you're injecting a function, but all the functions you use just return a constant. If you're doing it for the type protection from the compiler, why not just type ResyncPeriod time.Duration?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No - it's not for type protection.
The reason I'm doing it is that in some controllers we need more than one resyncPeriod and I want to avoid situation of having many periods to be the same to spread the load over time. That' why I'm injecting the function that is generating random values in production code - the constant values are only in unit tests.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes sense that you want a different value for every controller, but since each controller only calls the function once (when it makes the informer) it still doesn't make sense to me that you need to inject a function.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can call the function more than once, because it can have more than one Informer (one informer per resource). I wanted those also to not collide (e.g. daemon controller is using this function for both pods and nodes).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, now it makes sense, thank you.

On Wed, Oct 7, 2015 at 1:08 PM, Wojciech Tyczynski <notifications@github.com

wrote:

In pkg/controller/controller_utils.go
#15153 (comment)
:

@@ -54,6 +54,13 @@ var (
KeyFunc = framework.DeletionHandlingMetaNamespaceKeyFunc
)

+type ResyncPeriodFunc func() time.Duration

It can call the function more than once, because it can have more than one
Informer (one informer per resource). I wanted those also to not collide
(e.g. daemon controller is using this function for both pods and nodes).


Reply to this email directly or view it on GitHub
https://github.com/kubernetes/kubernetes/pull/15153/files#r41439676.

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 6, 2015
@wojtek-t wojtek-t assigned lavalamp and unassigned ixdy Oct 7, 2015
@k8s-bot
Copy link

k8s-bot commented Oct 7, 2015

GCE e2e test build/test passed for commit 7123c201342f5f62ed0c44478a7ecf13e1a5cacd.

@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Oct 7, 2015
@lavalamp
Copy link
Member

lavalamp commented Oct 7, 2015

LGTM once tests pass.

@k8s-bot
Copy link

k8s-bot commented Oct 8, 2015

GCE e2e test build/test passed for commit df79026.

@wojtek-t
Copy link
Member Author

wojtek-t commented Oct 8, 2015

@lavalamp - test didn't pass due to missing flag in "known-flags.txt". I've added it and now tests are passing. Since this was the only change, I'm adding lgtm labale myself.

@wojtek-t wojtek-t added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 8, 2015
piosz added a commit that referenced this pull request Oct 8, 2015
Extend resyncPeriods in controllers in production.
@piosz piosz merged commit 952a058 into kubernetes:master Oct 8, 2015
@wojtek-t wojtek-t deleted the common_resync_period branch October 14, 2015 14:31
k8s-github-robot referenced this pull request Oct 24, 2015
…5153-#15900-#15930-upstream-release-1.1

Auto commit by PR queue bot
shyamjvs referenced this pull request in shyamjvs/kubernetes Dec 1, 2016
…pick-of-#15153-kubernetes#15900-kubernetes#15930-upstream-release-1.1

Auto commit by PR queue bot
shouhong referenced this pull request in shouhong/kubernetes Feb 14, 2017
…pick-of-#15153-kubernetes#15900-kubernetes#15930-upstream-release-1.1

Auto commit by PR queue bot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants