Fix custom_cni manifest apply failure for multi-namespace resources#13091
Open
yankay wants to merge 1 commit intokubernetes-sigs:masterfrom
Open
Fix custom_cni manifest apply failure for multi-namespace resources#13091yankay wants to merge 1 commit intokubernetes-sigs:masterfrom
yankay wants to merge 1 commit intokubernetes-sigs:masterfrom
Conversation
Contributor
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: yankay The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Member
Author
|
/release-note-none |
Member
Author
|
/ok-to-test |
There was a problem hiding this comment.
Pull request overview
Removes the hardcoded kube-system namespace from the Custom CNI manifest application step so that user-supplied manifests are applied as-is (consistent with kubectl apply -f semantics and manifest-defined namespaces).
Changes:
- Drop
namespace: "kube-system"from thekubetask that appliescustom_cni_manifests.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
Author
|
/retest |
The `Custom CNI | Start Resources` task was passing `namespace: "kube-system"` to the kube module, which adds `--namespace=kube-system` to the kubectl apply command. This causes failures when the user-provided manifest contains resources targeting namespaces other than kube-system (e.g. cilium-secrets introduced in Cilium 1.18.6). Remove the hardcoded namespace parameter so kubectl respects the namespace declared in each resource's metadata. This is consistent with how kube-ovn's custom manifests are applied and aligns with the custom_cni design: users bring their own complete manifests. Signed-off-by: Xinyang Han <hxy0229@outlook.com>
eddc5ef to
38945f0
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What type of PR is this?
/kind bug
What this PR does / why we need it:
Remove the hardcoded
namespace: "kube-system"parameter from theCustom CNI | Start Resourcestask inroles/network_plugin/custom_cni/tasks/main.yml.After #13002 bumped the custom_cni test Cilium version to 1.18.6, the regenerated
cilium.yamlmanifest now includes resources in thecilium-secretsnamespace (Namespace object, Roles, and RoleBindings for TLS interception policy secrets). Thekubemodule'snamespace: "kube-system"parameter causeskubectl apply --namespace=kube-system, which conflicts with these resources:By removing the hardcoded namespace,
kubectl applywill respect the namespace declared in each resource's metadata. This is:kube-ovnapplies its manifests (no hardcoded namespace)custom_cni, where users bring their own complete manifests that may target multiple namespacesnamespacedeclarationsWhich issue(s) this PR fixes:
Fixes the
debian11-custom-cniCI failure introduced by #13002.Special notes for your reviewer:
The
kubemodule (inlibrary/kube.py) only adds--namespaceto thekubectlcommand when the parameter is provided. Without it,kubectluses whatever namespace is specified in each resource's metadata, which is the desired behavior for multi-namespace manifests.Other network plugins that apply whole YAML files (
kube-ovn) also omit the namespace parameter, while plugins that apply individual known resources (kube-router,multus) use it — this change alignscustom_cniwith the correct pattern.Does this PR introduce a user-facing change?: