-
Notifications
You must be signed in to change notification settings - Fork 40.4k
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
Efficient watch resumption #94364
Efficient watch resumption #94364
Conversation
5a1a277
to
24140dc
Compare
24140dc
to
0c97c57
Compare
0c97c57
to
e2d96bf
Compare
/cc @lavalamp |
I just sent #94711 to see if we can unblock this PR sooner. |
64f732e
to
af61e8f
Compare
/retest |
@@ -258,7 +258,7 @@ func (c *Config) createLeaseReconciler() reconcilers.EndpointReconciler { | |||
if err != nil { | |||
klog.Fatalf("Error determining service IP ranges: %v", err) | |||
} | |||
leaseStorage, _, err := storagefactory.Create(*config) | |||
leaseStorage, _, err := storagefactory.Create(*config, nil) |
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.
Instead of changing every call site, can the new parameter be a member of the config struct?
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.
This is a good point - will fix tomorrow.
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.
Actually - this is part of createLeaseResonciler()
method - this is basically callled once in the kube-apiserver lifetime.
So I don't think it makes sense to change anything.
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.
I meant to include all the "generic.NewRawStorage(config, nil)" calls, too. If you think it's not worth it, that's fine.
It still seems weird to me to have a config thingy, and an option that's not part of the config thingy. What is the rule for adding to the config thingy vs adding another parameter?
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.
Technically it may be possible to make it a part of config.
That said I looked deeper into the code (this time again), and piping the necessary information down to storageConfig (if we do that, we shouldn't pipe newFunc, but rather groupKind and use ObjectCreator from runtime.Scheme to create object) and that would be at least couple hundreds line of code (and e.g. path for CRDs is different than for built-in resources there).
I'm happy to look at this, but given this commit is actually fairly simple and relatively small (and almost all changes are in tests), I would prefer to not block this PR on it, so that we can get more soaking time of the feature itself.
If you're fine with this, I'm happy to open an issue and assign to myself to fix that once this one is merged.
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.
What you have sounds better than plumbing it everywhere. I guess I was expecting something like, this code makes a shallow copy of the config and sets the additional field, so it'd be about the same change as what you have here, just call sites that are happy with nil
wouldn't need to change at all.
But I wouldn't insist on this or anything, it might not be an improvement.
client: client, | ||
codec: codec, | ||
newFunc: newFunc, |
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.
I'm a little surprised you can't get this out of the codec or versioner already.
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.
Unfortunately you can't.
Codec only supports encoding and decoding:
https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/runtime/interfaces.go#L94
Versioner is only about conversions:
https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/runtime/interfaces.go#L220
There is ObjectCreater interface:
https://github.com/kubernetes/kubernetes/blob/master/staging/src/k8s.io/apimachinery/pkg/runtime/interfaces.go#L254
that our runtime.Scheme implements, but that doesn't really change much in terms of passing arguments.
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.
/lgtm
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: lavalamp, wojtek-t The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest Review the full test history for this PR. Silence the bot with an |
Ref kubernetes/enhancements#1904
/kind feature