Skip to content

Add enable-dynamic-udn-allocation config override#2986

Draft
kyrtapz wants to merge 1 commit intoopenshift:masterfrom
kyrtapz:dynamic_udn_opt
Draft

Add enable-dynamic-udn-allocation config override#2986
kyrtapz wants to merge 1 commit intoopenshift:masterfrom
kyrtapz:dynamic_udn_opt

Conversation

@kyrtapz
Copy link
Copy Markdown
Contributor

@kyrtapz kyrtapz commented Apr 30, 2026

Support --enable-dynamic-udn-allocation flag for both ovnkube-cluster-manager and ovnkube-controller via the ovn-kubernetes-config-overrides configmap.

Example:

oc create configmap ovn-kubernetes-config-overrides -n openshift-network-operator --from-literal=enable-dynamic-udn-allocation=true 

should automatically re-deploy ovn-k.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added support for configurable dynamic User-Defined Network (UDN) allocation in OVN-Kubernetes deployments, allowing users to enable or disable the feature via configuration.
  • Tests

    • Added test coverage for dynamic UDN allocation configuration scenarios.

Support --enable-dynamic-udn-allocation flag for both ovnkube-cluster-manager
and ovnkube-controller via the ovn-kubernetes-config-overrides configmap.

Signed-off-by: Patryk Diak <pdiak@redhat.com>
@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 30, 2026
@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Apr 30, 2026

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 30, 2026

Walkthrough

This change introduces support for dynamic UDN allocation across OVN-Kubernetes configurations. It adds conditional flag construction in YAML manifests, reads the configuration override from OVN-Kubernetes config with validation, and includes a test to verify the feature's behavior.

Changes

Cohort / File(s) Summary
OVN-Kubernetes YAML Templates
bindata/network/ovn-kubernetes/common/008-script-lib.yaml, bindata/network/ovn-kubernetes/managed/ovnkube-control-plane.yaml, bindata/network/ovn-kubernetes/self-hosted/ovnkube-control-plane.yaml
Adds conditional CLI flag construction for dynamic UDN allocation. When EnableDynamicUDNAllocation is set, the flag --enable-dynamic-udn-allocation=... is included in the ovnkube invocation; otherwise the flag remains unset.
Configuration Override Handling
pkg/network/ovn_kubernetes.go
Reads enable-dynamic-udn-allocation from OVN-Kubernetes config overrides, trims whitespace, validates it as a boolean, logs warnings on parse failure, and forwards the value to template rendering data.
Feature Testing
pkg/network/ovn_kubernetes_test.go
Introduces comprehensive unit test for the dynamic UDN allocation override, verifying flag behavior when enabled, disabled, or absent from configuration.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 10 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Test Structure And Quality ❓ Inconclusive The test file uses standard Go testing patterns (func Test* with testing.T) rather than Ginkgo BDD-style tests, making the Ginkgo-specific quality check not applicable. Clarify whether this check applies to standard Go tests or only Ginkgo tests, as the repository uses standard Go testing patterns.
✅ Passed checks (10 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add enable-dynamic-udn-allocation config override' accurately describes the main change: adding a config override for the enable-dynamic-udn-allocation flag across multiple files and tests.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed The test uses standard Go testing framework with static subtest names, not Ginkgo BDD framework, so the Ginkgo-specific check is not applicable.
Microshift Test Compatibility ✅ Passed The new test is a standard Go unit test using testing.T and Gomega, not a Ginkgo e2e test, so the check does not apply.
Single Node Openshift (Sno) Test Compatibility ✅ Passed The pull request does not add any Ginkgo e2e tests, only a standard Go unit test using the testing package and Gomega assertions.
Topology-Aware Scheduling Compatibility ✅ Passed PR introduces no new topology-incompatible scheduling constraints; changes are purely additive, adding conditional CLI flag with no impact on pod scheduling behavior.
Ote Binary Stdout Contract ✅ Passed PR changes only modify YAML templates and test code without introducing any stdout writes in process-level code that would violate the OTE Binary Stdout Contract.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed The custom check targets Ginkgo e2e tests using It(), Describe(), Context(), When() constructs. The PR adds a standard Go unit test (TestRenderOVNKubernetes_EnableDynamicUDNAllocationOverride) in pkg/network/, not an e2e test.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@openshift-ci
Copy link
Copy Markdown
Contributor

openshift-ci Bot commented Apr 30, 2026

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: kyrtapz

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 30, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
pkg/network/ovn_kubernetes_test.go (1)

4453-4514: ⚡ Quick win

Cover the control-plane flag path in this new override test.

Lines 4453-4514 only validate the script-lib rendering path. Since this PR targets both ovnkube-controller and ovnkube-cluster-manager, add control-plane assertions too so both render paths are protected from regressions.

Proposed test addition
 func TestRenderOVNKubernetes_EnableDynamicUDNAllocationOverride(t *testing.T) {
@@
 	t.Run("with invalid enable-dynamic-udn-allocation override", func(t *testing.T) {
 		ovnkubeScriptLib := renderWithOverrides(map[string]string{"enable-dynamic-udn-allocation": "notabool"})
 		g.Expect(ovnkubeScriptLib).To(ContainSubstring(`
   if [[ "" != "" ]]; then
     enable_dynamic_udn_allocation_flag="--enable-dynamic-udn-allocation="
   fi`))
 	})
+
+	t.Run("control-plane includes enable-dynamic-udn-allocation=true", func(t *testing.T) {
+		script := renderControlPlaneWithOverrides(t, "self-hosted", map[string]interface{}{
+			"enable-dynamic-udn-allocation": "true",
+		})
+		g.Expect(script).To(ContainSubstring(`--enable-dynamic-udn-allocation=true`))
+	})
+
+	t.Run("control-plane renders empty value for invalid enable-dynamic-udn-allocation", func(t *testing.T) {
+		script := renderControlPlaneWithOverrides(t, "self-hosted", map[string]interface{}{
+			"enable-dynamic-udn-allocation": "notabool",
+		})
+		g.Expect(script).To(ContainSubstring(`--enable-dynamic-udn-allocation=`))
+	})
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/network/ovn_kubernetes_test.go` around lines 4453 - 4514, The test only
asserts the node-agent/script-lib path (using extractOVNScriptLib) but doesn't
cover the control-plane rendering path; update
TestRenderOVNKubernetes_EnableDynamicUDNAllocationOverride by changing
renderWithOverrides to also extract the control-plane script (use the existing
renderOVNKubernetes call and call the control-plane extractor, e.g.
extractOVNControlPlaneScriptLib or the appropriate helper used elsewhere in
tests) and return both libs (or return objs so callers can extract both); then
for each subtest duplicate the same ContainSubstring assertions against the
control-plane script variable (ovnkube-controller / ovnkube-cluster-manager
path) so the enable-dynamic-udn-allocation flag is validated for both
extractOVNScriptLib and the control-plane extractor.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@pkg/network/ovn_kubernetes_test.go`:
- Around line 4453-4514: The test only asserts the node-agent/script-lib path
(using extractOVNScriptLib) but doesn't cover the control-plane rendering path;
update TestRenderOVNKubernetes_EnableDynamicUDNAllocationOverride by changing
renderWithOverrides to also extract the control-plane script (use the existing
renderOVNKubernetes call and call the control-plane extractor, e.g.
extractOVNControlPlaneScriptLib or the appropriate helper used elsewhere in
tests) and return both libs (or return objs so callers can extract both); then
for each subtest duplicate the same ContainSubstring assertions against the
control-plane script variable (ovnkube-controller / ovnkube-cluster-manager
path) so the enable-dynamic-udn-allocation flag is validated for both
extractOVNScriptLib and the control-plane extractor.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 0643f30f-f75b-471a-b289-09b33480162f

📥 Commits

Reviewing files that changed from the base of the PR and between 8dcd0a2 and 2ea0c03.

📒 Files selected for processing (5)
  • bindata/network/ovn-kubernetes/common/008-script-lib.yaml
  • bindata/network/ovn-kubernetes/managed/ovnkube-control-plane.yaml
  • bindata/network/ovn-kubernetes/self-hosted/ovnkube-control-plane.yaml
  • pkg/network/ovn_kubernetes.go
  • pkg/network/ovn_kubernetes_test.go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant