-
Notifications
You must be signed in to change notification settings - Fork 8k
kube: cleanup crdwatcher a bit #44145
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
kube: cleanup crdwatcher a bit #44145
Conversation
@hzxuzhonghu I put a hold sinec I am not 100% sure this is correct yet, going to self-review it a bit more tomorrow. But wanted to put it up for feedback |
Sorry for the delay i am a little busy with other work. Will take a look later |
if !cl.crdWatcher.Known(s.GroupVersionResource()) { | ||
cl.logger.Warnf("Skipping CRD %v as it is not present", s.GroupVersionKind()) |
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.
The log skipping is confusing, maybe CRD xx is not yet present, will be handled latter once it is created
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.
Generally it looks viable, previously we didnot check crdWatcher.hasSynced at all, which is not right.
cc7fe87
to
5718d64
Compare
/test all |
5718d64
to
340e844
Compare
/test all |
340e844
to
20f7745
Compare
/test all |
20f7745
to
a99f3fb
Compare
/test all |
a99f3fb
to
4feac7f
Compare
/test all |
4feac7f
to
6a45fa4
Compare
Pull fixes out of istio#44201 and istio#44145
87ed219
to
efb8bbe
Compare
23b9883
to
d924f75
Compare
// already started, ignore | ||
default: | ||
c.stop = stop | ||
close(c.running) |
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 not concurrent safe, will panic if called concurrently
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.
thanks, added a mutex
} | ||
inf.Start(stop) | ||
// Swap out the dummy client with the full one | ||
delayedClient.set(fc) |
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.
We need a log here
0317fdd
to
f07931a
Compare
* Remove syncronous List; it is duplicated with the informer * Refactoring ordering a bit * use kclient which ensures handler is called once we check HasSynced
f07931a
to
4793472
Compare
@howardjohn: The following test failed, say
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
4793472
to
e6ac82c
Compare
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
edit: lets do #44899 first, then I will rebase this.This reworks how we enable optional watchers, which will watch only if the CRD is present.
Today, we do this a few different ways for variuous usages. This standardizes on a single implementation in
kclient
.Clients can specify a "Delay" which will result in a client that may exist now or at some future point:
For example:
Aside from the filter during creation, usage for this is completely transparent. The kclient will ensure that we only return HasSynced=true once the CRD is ready and we start watching OR the CrdWatcher has finished syncing and the CRD did not exist.