Fix nodeSelector validation in CiliumNetworkPolicy Specs array#40702
Merged
joestringer merged 1 commit intocilium:mainfrom Aug 21, 2025
Merged
Fix nodeSelector validation in CiliumNetworkPolicy Specs array#40702joestringer merged 1 commit intocilium:mainfrom
joestringer merged 1 commit intocilium:mainfrom
Conversation
|
Commit 2974519 does not match "(?m)^Signed-off-by:". Please follow instructions provided in https://docs.cilium.io/en/stable/contributing/development/contributing_guide/#developer-s-certificate-of-origin |
2974519 to
da4d09f
Compare
Contributor
|
/test |
da4d09f to
f019bcc
Compare
|
Commit 81831c5 does not match "(?m)^Signed-off-by:". Please follow instructions provided in https://docs.cilium.io/en/stable/contributing/development/contributing_guide/#developer-s-certificate-of-origin |
81831c5 to
a951dd6
Compare
vipul-21
reviewed
Jul 31, 2025
a951dd6 to
3bfdf1d
Compare
vipul-21
approved these changes
Aug 1, 2025
Signed-off-by: Ashwin Pillai <pillaiashwin96@gmail.com>
3bfdf1d to
fedbd6b
Compare
Member
|
/test |
Contributor
|
/test |
Contributor
|
@pillai-ashwin Can you rebase the cr ? This may help to pass the failed test. |
17 tasks
5 tasks
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.
Please ensure your pull request adheres to the following guidelines:
description and a
Fixes: #XXXline if the commit addresses a particularGitHub issue.
Fixes: <commit-id>tag, thenplease add the commit author[s] as reviewer[s] to this issue.
Fix nodeSelector validation in CiliumNetworkPolicy Specs array
This PR fixes a bug where namespaced
CiliumNetworkPolicyobjects withnodeSelectorspecified in thespecsarray were being silently accepted but ignored, instead of being properly rejected with a validation error.Problem
The issue was that nodeSelector validation was only applied to the singular
specfield but not to individual rules within thespecsarray. This led to inconsistent behavior:spec: { nodeSelector: {} }→ Correctly rejectedspecs: [{ nodeSelector: {} }]→ Silently accepted but ignoredSolution
Added the missing nodeSelector validation check inside the
r.Specsloop in theParsemethod ofCiliumNetworkPolicy. Now both cases consistently reject the policy with the error message:"Invalid CiliumNetworkPolicy spec: rule cannot have NodeSelector"Testing
TestParseWithNodeSelectorto cover thespecsarray scenarioFixes: #40268