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
pkg/k8s: fallback on retrieving CiliumNode from kube-apiserver #22298
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aanm
added
kind/bug
This is a bug in the Cilium logic.
release-note/bug
This PR fixes an issue in a previous release of Cilium.
kind/regression
This functionality worked fine before, but was broken in a newer release of Cilium.
needs-backport/1.12
labels
Nov 21, 2022
tommyp1ckles
approved these changes
Nov 21, 2022
christarazi
added
the
sig/k8s
Impacts the kubernetes API, or kubernetes -> cilium internals translation layers.
label
Nov 21, 2022
christarazi
approved these changes
Nov 21, 2022
Retrieving objects from caches can be useful to prevent doing useless requests to kube-apiserver. In the unlikely event that the object doesn't exist in the local cache Cilium can try to retrieve it from kube-apiserver directly. For this particular case, with CiliumNode, it is causing Cilium to fatal as it is unable to retrieve CiliumNode from the cache, due subsystem initialization issues, thus we will fallback on retrieving the object directly from kube-apiserver. In this case, the subsystem initialization issue happened due to the fact that CiliumNode watcher is blocked on its event handler by the egressGatewayManager [1] which is blocked by the initialization of the identity allocator [2]. Unfortunately, the identity allocator is only initialized at a later stage causing the CiliumNode cache from being populated with all of its nodes. [1] https://github.com/cilium/cilium/blob/933bdcbec9319b0148b12688f720fbaaf55e0dba/pkg/k8s/watchers/cilium_node.go#L56 [2] https://github.com/cilium/cilium/blob/933bdcbec9319b0148b12688f720fbaaf55e0dba/pkg/egressgateway/manager.go#L83 Fixes: 69e4c69 ("k8s: optimize API calls made to kube-apiserver") Signed-off-by: André Martins <andre@cilium.io>
aanm
force-pushed
the
pr/fix-cn-cache-retrieval
branch
from
November 21, 2022 23:45
d611c8a
to
9d0415f
Compare
/test |
michi-covalent
approved these changes
Nov 21, 2022
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.
a magical one-line fix
nathanjsweet
approved these changes
Nov 22, 2022
Travis hit #21730 |
maintainer-s-little-helper
bot
moved this from Needs backport from master
to Backport pending to v1.12
in 1.12.5
Nov 22, 2022
maintainer-s-little-helper
bot
moved this from Needs backport from master
to Backport pending to v1.12
in 1.12.5
Nov 22, 2022
jrajahalme
added
backport-done/1.12
The backport for Cilium 1.12.x for this PR is done.
and removed
backport-pending/1.12
labels
Nov 24, 2022
maintainer-s-little-helper
bot
moved this from Backport pending to v1.12
to Backport done to v1.12
in 1.12.5
Nov 24, 2022
maintainer-s-little-helper
bot
moved this from Backport pending to v1.12
to Backport done to v1.12
in 1.12.5
Nov 24, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
backport-done/1.12
The backport for Cilium 1.12.x for this PR is done.
feature/egress-gateway
Impacts the egress IP gateway feature.
kind/bug
This is a bug in the Cilium logic.
kind/regression
This functionality worked fine before, but was broken in a newer release of Cilium.
release-note/bug
This PR fixes an issue in a previous release of Cilium.
sig/k8s
Impacts the kubernetes API, or kubernetes -> cilium internals translation layers.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
pkg/k8s: fallback on retrieving CiliumNode from kube-apiserver
Retrieving objects from caches can be useful to prevent doing useless
requests to kube-apiserver. In the unlikely event that the object
doesn't exist in the local cache Cilium can try to retrieve it from
kube-apiserver directly. For this particular case, with CiliumNode, it
is causing Cilium to fatal as it is unable to retrieve CiliumNode from
the cache, due subsystem initialization issues, thus we will fallback on
retrieving the object directly from kube-apiserver.
In this case, the subsystem initialization issue happened due to the
fact that CiliumNode watcher is blocked on its event handler by the
egressGatewayManager [1] which is blocked by the initialization of the
identity allocator [2]. Unfortunately, the identity allocator is only
initialized at a later stage causing the CiliumNode cache from being
populated with all of its nodes.
[1]
cilium/pkg/k8s/watchers/cilium_node.go
Line 56 in 933bdcb
[2]
cilium/pkg/egressgateway/manager.go
Line 83 in 933bdcb
Fixes: 69e4c69 ("k8s: optimize API calls made to kube-apiserver")