-
Notifications
You must be signed in to change notification settings - Fork 40.6k
apiserver: injectable default watch cache size #45403
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
Conversation
87ad473
to
f78fdf9
Compare
f78fdf9
to
d59b027
Compare
// 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. |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
one comment, then lgtm |
d59b027
to
4ebc578
Compare
4ebc578
to
00f2690
Compare
@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 |
There was a problem hiding this comment.
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.
00f2690
to
59833a8
Compare
59833a8
to
b799e62
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: deads2k, sttts Assign the PR to them by writing
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
@smarterclayton approved? |
api extensions again. approved. Pull to add owners here: #45490 |
Automatic merge from submit-queue |
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.