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
Remove duplicate CiliumNode watcher #17873
Conversation
/test |
2368af8
to
c3eaf9d
Compare
/test Job 'Cilium-PR-K8s-1.22-kernel-4.9' failed and has not been observed before, so may be related to your PR: Click to show.Test Name
Failure Output
If it is a flake, comment |
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.
Looks OK on the top level, but I was not happy with 3 sets of handler funcs which all repeat the same conversion and error handling.
operator/cilium_node.go
Outdated
} | ||
} else { | ||
// nodeManager not nil thus the events will be processed by | ||
// ciliumNodeKVStore and the nodeManager |
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.
There is a lot of code duplication here, would it be better to only have one set of resource event handler funcs that would work both with nil and non-nil nodeManager?
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.
There is, I was worried on optimizing the code over readbility. Please see the commit operator: simplify duplicated code in the event handling after this one where I've simplified the code a little bit.
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 from docs perspective. Looks like Jarno already reviewed the core functionality here, so I skipped that for now. Let me know if you would like additional review.
c3eaf9d
to
0001118
Compare
@joestringer @ldelossa since this code changed so much in this PR I decided to go ahead and added in the last commit to have the workqueue pattern that we have discussed a couple weeks ago. Let me know what you think. /cc @christarazi FYI |
/test |
/test Job 'Cilium-PR-K8s-GKE' failed and has not been observed before, so may be related to your PR: Click to show.Test Name
Failure Output
If it is a flake, comment Job 'Cilium-PR-K8s-1.21-kernel-4.19' failed and has not been observed before, so may be related to your PR: Click to show.Test Name
Failure Output
If it is a flake, comment |
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.
My feedback was handled. Approving contingent on other's reviews.
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. I'm sure the more I look, the more I could find ways we can incrementally tidy up the code but I think it'll just become bikeshedding at that point. 🚢
fee2750
to
25377ca
Compare
/test Job 'Cilium-PR-K8s-1.22-kernel-4.9' failed and has not been observed before, so may be related to your PR: Click to show.Test Name
Failure Output
If it is a flake, comment |
/mlh new-flake Cilium-PR-K8s-1.22-kernel-4.9 👍 created #17942 |
/test-1.22-4.9 |
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
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.
Changes LGTM, one question below regarding workqueue handling.
In certain cases the Cilium Operator could end up with two CiliumNode k8s watchers. This commit re-writes the code in a way that a single watcher will be used for all cases. Signed-off-by: André Martins <andre@cilium.io>
The code present in k8s_node was not specific to a k8s node. Thus, this commit moved the code into a better appropriate file, cilium_node.go Signed-off-by: André Martins <andre@cilium.io>
This flag is no longer used in the code so we can safely remove it. Fixes: 3aacf41 ("add capability to disable CNP NodeStatus updates") Signed-off-by: André Martins <andre@cilium.io>
Signed-off-by: André Martins <andre@cilium.io>
As this code suffers a major rewrite, this commit introduces the right way of handling Kubernetes events, with a workqueue. Signed-off-by: André Martins <andre@cilium.io>
Signed-off-by: André Martins <andre@cilium.io>
25377ca
to
ab6ec99
Compare
/test |
I'll merge this PR since there was only one line added and the previous CI run was green IIRC.:
This line will only be executed on error cases which is unlikely to be caught by our CI. |
This flag is deprecated in 1.11, so remove it for 1.12 now. Relates to cilium#17873 Signed-off-by: Tam Mach <tam.mach@isovalent.com>
In certain cases the Cilium Operator could end up with two CiliumNode
k8s watchers. This PR re-writes the code in a way that a single
watcher will be used for all cases.