-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
nat: Create SNAT maps only if BPF NodePort is enabled #15175
Conversation
1b91da6
to
09e72f9
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.
Thanks!
09e72f9
to
4915d75
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.
This seems fairly straightforward to me, just need to check & resolve the one outstanding thread
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. Since this PR moves around daemon initialization order, we'll need to be careful when backporting this.
Using the NatMap interface was causing issues when trying to check if the natMap attribute is nil. We don't need the NatMap interface and can simply use *nat.Map directly. Suggested-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Paul Chaignon <paul@cilium.io>
Initialize the kube-proxy replacement options earlier in the agent startup, to ensure all options have reach their final state (based on kernel probes and option conflict) when we initialize the BPF map information (e.g., create or not NAT maps based on whether BPF NodePort is enabled). Signed-off-by: Paul Chaignon <paul@cilium.io>
The IPv4 and IPv6 SNAT maps are only used if BPF NodePort is enabled. Commit cac5218 ("datapath: remove SNAT maps entries when kube-proxy is enabled") removed the maps on startup if BPF NodePort is disabled. We were however still creating them regardless of the BPF NodePort status. The creation started a controller which then fails once the actual map is removed. This commit fixes the issue by not creating the userspace object, including the controller, for the SNAT maps when BPF NodePort is disabled. Fixes: cac5218 ("datapath: remove SNAT maps entries when kube-proxy is enabled") Fixes: cilium#15141 Signed-off-by: Paul Chaignon <paul@cilium.io>
4915d75
to
d639905
Compare
test-me-please |
PR #14721 introduced changes that removed the cilium_snat_v{4,6}_external maps if NodePort is not enabled. Issue #15141 was attributed to the above PR, where controllers were failing with: > error=Unable to get object /sys/fs/bpf/tc/globals/cilium_snat_v4_external: no such file or directory name=bpf-map-sync-cilium_snat_v4_external In an attempt to fix #15141, #15175 added a nodeport argument to InitMapInfo() so that the cilium_snat_v{4,6}_external maps are not created if NodePort is not enabled. PR #15141 did not fix the issue: #15337 (comment) This PR takes another shot at fixing #15141 by removing a call of InitMapInfo from init(), where the (new) nodeport argument is always true. Not that in init(), option.Config.EnableNodePort is not properly set yet, so we cannot pass the config option because it would always be false. For this change to properly work, this patch also adds explicit InitMapInfo() calls since removing init() means that this function is called in contexts such as tests and the cli. Fixes: cac5218 Fixes: d639905 Fixes: #15141 Fixes: #15337 Signed-off-by: Kornilios Kourtis <kornilios@isovalent.com>
PR #14721 introduced changes that removed the cilium_snat_v{4,6}_external maps if NodePort is not enabled. Issue #15141 was attributed to the above PR, where controllers were failing with: > error=Unable to get object /sys/fs/bpf/tc/globals/cilium_snat_v4_external: no such file or directory name=bpf-map-sync-cilium_snat_v4_external In an attempt to fix #15141, #15175 added a nodeport argument to InitMapInfo() so that the cilium_snat_v{4,6}_external maps are not created if NodePort is not enabled. PR #15141 did not fix the issue: #15337 (comment) This PR takes another shot at fixing #15141 by removing a call of InitMapInfo from init(), where the (new) nodeport argument is always true. Not that in init(), option.Config.EnableNodePort is not properly set yet, so we cannot pass the config option because it would always be false. For this change to properly work, this patch also adds explicit InitMapInfo() calls since removing init() means that this function is called in contexts such as tests and the cli. Fixes: cac5218 Fixes: d639905 Fixes: #15141 Fixes: #15337 Signed-off-by: Kornilios Kourtis <kornilios@isovalent.com>
[ upstream commit e83dd53 ] PR #14721 introduced changes that removed the cilium_snat_v{4,6}_external maps if NodePort is not enabled. Issue #15141 was attributed to the above PR, where controllers were failing with: > error=Unable to get object /sys/fs/bpf/tc/globals/cilium_snat_v4_external: no such file or directory name=bpf-map-sync-cilium_snat_v4_external In an attempt to fix #15141, #15175 added a nodeport argument to InitMapInfo() so that the cilium_snat_v{4,6}_external maps are not created if NodePort is not enabled. PR #15141 did not fix the issue: #15337 (comment) This PR takes another shot at fixing #15141 by removing a call of InitMapInfo from init(), where the (new) nodeport argument is always true. Not that in init(), option.Config.EnableNodePort is not properly set yet, so we cannot pass the config option because it would always be false. For this change to properly work, this patch also adds explicit InitMapInfo() calls since removing init() means that this function is called in contexts such as tests and the cli. Fixes: cac5218 Fixes: d639905 Fixes: #15141 Fixes: #15337 Signed-off-by: Kornilios Kourtis <kornilios@isovalent.com> Signed-off-by: Gilberto Bertin <gilberto@isovalent.com>
[ upstream commit e83dd53 ] PR #14721 introduced changes that removed the cilium_snat_v{4,6}_external maps if NodePort is not enabled. Issue #15141 was attributed to the above PR, where controllers were failing with: > error=Unable to get object /sys/fs/bpf/tc/globals/cilium_snat_v4_external: no such file or directory name=bpf-map-sync-cilium_snat_v4_external In an attempt to fix #15141, #15175 added a nodeport argument to InitMapInfo() so that the cilium_snat_v{4,6}_external maps are not created if NodePort is not enabled. PR #15141 did not fix the issue: #15337 (comment) This PR takes another shot at fixing #15141 by removing a call of InitMapInfo from init(), where the (new) nodeport argument is always true. Not that in init(), option.Config.EnableNodePort is not properly set yet, so we cannot pass the config option because it would always be false. For this change to properly work, this patch also adds explicit InitMapInfo() calls since removing init() means that this function is called in contexts such as tests and the cli. Fixes: cac5218 Fixes: d639905 Fixes: #15141 Fixes: #15337 Signed-off-by: Kornilios Kourtis <kornilios@isovalent.com> Signed-off-by: Gilberto Bertin <gilberto@isovalent.com>
[ upstream commit e83dd53 ] PR cilium#14721 introduced changes that removed the cilium_snat_v{4,6}_external maps if NodePort is not enabled. Issue cilium#15141 was attributed to the above PR, where controllers were failing with: > error=Unable to get object /sys/fs/bpf/tc/globals/cilium_snat_v4_external: no such file or directory name=bpf-map-sync-cilium_snat_v4_external In an attempt to fix cilium#15141, cilium#15175 added a nodeport argument to InitMapInfo() so that the cilium_snat_v{4,6}_external maps are not created if NodePort is not enabled. PR cilium#15141 did not fix the issue: cilium#15337 (comment) This PR takes another shot at fixing cilium#15141 by removing a call of InitMapInfo from init(), where the (new) nodeport argument is always true. Not that in init(), option.Config.EnableNodePort is not properly set yet, so we cannot pass the config option because it would always be false. For this change to properly work, this patch also adds explicit InitMapInfo() calls since removing init() means that this function is called in contexts such as tests and the cli. Fixes: cac5218 Fixes: d639905 Fixes: cilium#15141 Fixes: cilium#15337 Signed-off-by: Kornilios Kourtis <kornilios@isovalent.com> Signed-off-by: Chris Tarazi <chris@isovalent.com>
[ upstream commit e83dd53 ] PR #14721 introduced changes that removed the cilium_snat_v{4,6}_external maps if NodePort is not enabled. Issue #15141 was attributed to the above PR, where controllers were failing with: > error=Unable to get object /sys/fs/bpf/tc/globals/cilium_snat_v4_external: no such file or directory name=bpf-map-sync-cilium_snat_v4_external In an attempt to fix #15141, #15175 added a nodeport argument to InitMapInfo() so that the cilium_snat_v{4,6}_external maps are not created if NodePort is not enabled. PR #15141 did not fix the issue: #15337 (comment) This PR takes another shot at fixing #15141 by removing a call of InitMapInfo from init(), where the (new) nodeport argument is always true. Not that in init(), option.Config.EnableNodePort is not properly set yet, so we cannot pass the config option because it would always be false. For this change to properly work, this patch also adds explicit InitMapInfo() calls since removing init() means that this function is called in contexts such as tests and the cli. Fixes: cac5218 Fixes: d639905 Fixes: #15141 Fixes: #15337 Signed-off-by: Kornilios Kourtis <kornilios@isovalent.com> Signed-off-by: Chris Tarazi <chris@isovalent.com>
The IPv4 and IPv6 SNAT maps are only used if BPF NodePort is enabled. #14721 removed the maps on startup if BPF NodePort is disabled.
We were however still creating them regardless of the BPF NodePort status. The creation started a controller which then fails once the actual map is removed. This commit fixes the issue by not creating the userspace object, including the controller, for the SNAT maps when BPF NodePort is disabled.
See commits for details.
Fixes: #14721
Fixes: #15141