[WIP] Restore ConfigMap enable-multi-networkpolicy setting for ovn-kubernetes - #3101
[WIP] Restore ConfigMap enable-multi-networkpolicy setting for ovn-kubernetes#3101weliang1 wants to merge 1 commit into
Conversation
PR openshift#3072 migrated the MultiNetworkPolicy enablement from ConfigMap to CLI flags, but this created a regression because ovn-kubernetes prioritizes ConfigMap settings over CLI flags during config loading. When useMultiNetworkPolicy is enabled, the CNO now passes both: - CLI flag: --enable-multi-networkpolicy (added by PR openshift#3072) - ConfigMap: enable-multi-networkpolicy=true (restored by this PR) This ensures ovn-kubernetes loads EnableMultiNetworkPolicy=true regardless of config loading order, allowing MultiNetworkPolicy enforcement on UDN (User Defined Network) Layer2 secondary interfaces. Fixes: Test 77656 - ipBlock ingress policy for UDN pod's secondary interface Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
|
Pipeline controller notification For optional jobs, comment This repository is configured in: LGTM mode |
Summary by CodeRabbit
WalkthroughThe OVN managed and self-hosted configuration templates now conditionally set ChangesOVN multi-network policy
Estimated code review effort: 1 (Trivial) | ~3 minutes Possibly related PRs
Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (4 errors)
✅ Passed checks (20 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Comment |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: weliang1 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@bindata/network/ovn-kubernetes/managed/004-config.yaml`:
- Around line 46-48: Add rendering tests for the OVN_MULTI_NETWORK_POLICY_ENABLE
conditional in bindata/network/ovn-kubernetes/managed/004-config.yaml lines
46-48 and 133-135, and
bindata/network/ovn-kubernetes/self-hosted/004-config.yaml lines 49-51. Cover
both enabled and disabled values, verifying that enable-multi-networkpolicy=true
appears only when enabled for the hostedcluster node, hostedcluster master, and
self-hosted configurations.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Enterprise
Run ID: 13c0ddd0-0108-40f9-acd5-7eeca4832feb
📒 Files selected for processing (2)
bindata/network/ovn-kubernetes/managed/004-config.yamlbindata/network/ovn-kubernetes/self-hosted/004-config.yaml
| {{- if .OVN_MULTI_NETWORK_POLICY_ENABLE }} | ||
| enable-multi-networkpolicy=true | ||
| {{- end }} |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
Add tests for all changed bindata templates.
The repository path instruction requires corresponding *_test.go changes for modified bindata/ YAML templates. Add rendering tests for enabled and disabled OVN_MULTI_NETWORK_POLICY_ENABLE values.
bindata/network/ovn-kubernetes/managed/004-config.yaml#L46-L48: test the hostedcluster node configuration.bindata/network/ovn-kubernetes/managed/004-config.yaml#L133-L135: test the hostedcluster master configuration.bindata/network/ovn-kubernetes/self-hosted/004-config.yaml#L49-L51: test the self-hosted configuration.
📍 Affects 2 files
bindata/network/ovn-kubernetes/managed/004-config.yaml#L46-L48(this comment)bindata/network/ovn-kubernetes/managed/004-config.yaml#L133-L135bindata/network/ovn-kubernetes/self-hosted/004-config.yaml#L49-L51
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@bindata/network/ovn-kubernetes/managed/004-config.yaml` around lines 46 - 48,
Add rendering tests for the OVN_MULTI_NETWORK_POLICY_ENABLE conditional in
bindata/network/ovn-kubernetes/managed/004-config.yaml lines 46-48 and 133-135,
and bindata/network/ovn-kubernetes/self-hosted/004-config.yaml lines 49-51.
Cover both enabled and disabled values, verifying that
enable-multi-networkpolicy=true appears only when enabled for the hostedcluster
node, hostedcluster master, and self-hosted configurations.
Source: Path instructions
|
@weliang1: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here. |
Summary
This PR restores the
enable-multi-networkpolicy=trueConfigMap setting that was removed by PR #3072, fixing a regression where MultiNetworkPolicy is not enforced on UDN (User Defined Network) Layer2 secondary interfaces.Problem
PR #3072 attempted to migrate MultiNetworkPolicy enablement from ConfigMap to CLI flags by:
--enable-multi-networkpolicyenable-multi-networkpolicy=trueHowever, this created a regression because ovn-kubernetes prioritizes ConfigMap settings over CLI flags during config loading. When the ConfigMap doesn't specify the setting, it defaults to
false, causing the CLI flag to be ignored.Evidence
After PR #3072 merged, when
useMultiNetworkPolicy: trueis enabled:Result: MultiNetworkPolicy created but not enforced → test 77656 fails (traffic not blocked).
Solution
Restore the ConfigMap setting alongside the CLI flag, ensuring dual coverage:
--enable-multi-networkpolicy(from PR OCPBUGS-88063: ovn-kubernetes: Move MNP from ConfigMap to CLI flags #3072)enable-multi-networkpolicy=true(restored by this PR)This ensures ovn-kubernetes loads
EnableMultiNetworkPolicy=trueregardless of config loading order.Test Plan
Before this fix:
# Test 77656: Verify ingress-ipblock policy for UDN pod's secondary interface (Layer2) FAIL: Expected curl to fail (blocked by policy), but connection succeededAfter this fix:
Files Changed
bindata/network/ovn-kubernetes/managed/004-config.yaml: Restore ConfigMap setting (2 occurrences)bindata/network/ovn-kubernetes/self-hosted/004-config.yaml: Restore ConfigMap setting (1 occurrence)Related
77656 - Verify ingress-ipblock policy for UDN pod's secondary interface (Layer2)🤖 Generated with Claude Code