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

apiserver: injectable default watch cache size #45403

Merged

Conversation

sttts
Copy link
Contributor

@sttts sttts commented May 5, 2017

This makes it possible to override the default watch capacity in the REST options getter. Before this PR the default is written into the storage struct explicitly, and if it is the default, the REST options getter didn't know. With this the PR the default is applied late and can be injected from the outside.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 5, 2017
@k8s-github-robot k8s-github-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label May 5, 2017
@k8s-reviewable
Copy link

This change is Reviewable

@sttts sttts force-pushed the sttts-tri-state-watch-capacity branch from 87ad473 to f78fdf9 Compare May 5, 2017 09:22
@sttts sttts changed the title master: override watch cache capacity with origin default apiserver: tri-state watch cache capacity: off, default, value May 5, 2017
@sttts sttts assigned ncdc and deads2k May 5, 2017
@sttts sttts added release-note-none Denotes a PR that doesn't merit a release note. and removed release-note-label-needed labels May 5, 2017
@sttts sttts force-pushed the sttts-tri-state-watch-capacity branch from f78fdf9 to d59b027 Compare May 5, 2017 09:25
// Storage is non-nil.
WatchCacheSize int
// This value is ignored if Storage is non-nil. Nil is replaced with a default value.
// A zero integer will disable caching.
Copy link
Contributor

Choose a reason for hiding this comment

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

above you're testing for > 0, not >= 0, so I think zero currently does defaultWatchCacheSize

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good spot. >=0 (= off) is correct.

@deads2k
Copy link
Contributor

deads2k commented May 5, 2017

one comment, then lgtm

@sttts sttts force-pushed the sttts-tri-state-watch-capacity branch from d59b027 to 4ebc578 Compare May 5, 2017 17:19
@k8s-github-robot k8s-github-robot added kind/old-docs size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels May 5, 2017
@sttts sttts force-pushed the sttts-tri-state-watch-capacity branch from 4ebc578 to 00f2690 Compare May 5, 2017 20:40
@sttts sttts changed the title apiserver: tri-state watch cache capacity: off, default, value apiserver: injectable default watch cache size May 5, 2017
@sttts
Copy link
Contributor Author

sttts commented May 5, 2017

@deads2k ptal. I added a possibility to inject the default value via EtcdOptions. IMO this is much cleaner than wrapping the default decorator.

@@ -40,7 +40,7 @@ func NewREST(optsGetter generic.RESTOptionsGetter) *REST {
}

// We explicitly do NOT do any decoration here yet. // TODO determine why we do not want to cache here
opts.Decorator = generic.UndecoratedStorage // TODO use watchCacheSize=-1 to signal UndecoratedStorage
opts.Decorator = generic.UndecoratedStorage
Copy link
Member

Choose a reason for hiding this comment

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

Don't we want a better way to use undecorated other than directly specifying it? @liggitt I forget exactly how we wanted to do it when I refactored this code originally.

@sttts sttts force-pushed the sttts-tri-state-watch-capacity branch from 00f2690 to 59833a8 Compare May 8, 2017 09:08
@sttts sttts force-pushed the sttts-tri-state-watch-capacity branch from 59833a8 to b799e62 Compare May 8, 2017 09:29
@deads2k
Copy link
Contributor

deads2k commented May 8, 2017

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 8, 2017
@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: deads2k, sttts
We suggest the following additional approver: smarterclayton

Assign the PR to them by writing /assign @smarterclayton in a comment when ready.

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@sttts
Copy link
Contributor Author

sttts commented May 9, 2017

@smarterclayton approved?

@deads2k deads2k added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 9, 2017
@deads2k
Copy link
Contributor

deads2k commented May 9, 2017

api extensions again. approved. Pull to add owners here: #45490

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit 49e5435 into kubernetes:master May 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. 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

9 participants