Skip to content

OSASINFRA-4400: make openstack allowed address pairs configurable - #230

Open
danchild wants to merge 2 commits into
openshift:mainfrom
shiftstack:openstack-allowed-address-pairs
Open

OSASINFRA-4400: make openstack allowed address pairs configurable#230
danchild wants to merge 2 commits into
openshift:mainfrom
shiftstack:openstack-allowed-address-pairs

Conversation

@danchild

@danchild danchild commented Jul 15, 2026

Copy link
Copy Markdown
Member

Currently, the maxmium allowed address pairs per port configuration
is hardcoded to OpenStack's default of 10. The new
platform-os-max-allowed-address-pairs flag allows
users to customize the configuration, mirroring the
setting in their installation's neutron.conf.

The patch allows any custom configuration greater than
zero and disallows anything less than or equal to zero.
Finally, the default of 10 is still used as a fallback
if the user doesn't configure platform-os-max-allowed-address-pairs

@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jul 15, 2026
@openshift-ci-robot

openshift-ci-robot commented Jul 15, 2026

Copy link
Copy Markdown

@danchild: This pull request references OSASINFRA-4400 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the story to target the "5.0.0" version, but no target version was set.

Details

In response to this:

TODO

Instructions 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 openshift-eng/jira-lifecycle-plugin repository.

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@danchild, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 56 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 67ed1972-3a71-4671-a339-297c45921d3f

📥 Commits

Reviewing files that changed from the base of the PR and between 62be2d7 and d68adfb.

📒 Files selected for processing (1)
  • pkg/cloudprovider/openstack_test.go

Walkthrough

Adds an OpenStack-specific max allowed address-pairs flag, stores the value in cloud provider configuration, applies positive overrides to egress capacity calculations, and expands related test coverage.

Changes

OpenStack capacity override

Layer / File(s) Summary
Capacity configuration and flag wiring
pkg/cloudprovider/cloudprovider.go, cmd/cloud-network-config-controller/main.go
Adds OSMaxAllowedAddressPairs to CloudProviderConfig and registers the platform-os-max-allowed-address-pairs flag with a default of 0.
Capacity calculation and validation coverage
pkg/cloudprovider/openstack.go, pkg/cloudprovider/openstack_test.go
Uses a positive configured value or the default capacity for egress calculations, preserves the negative-capacity error, and tests overrides, fallback behavior, and updated expectations.

Estimated code review effort: 2 (Simple) | ~15 minutes

Possibly related PRs

Suggested reviewers: arkadeepsen, jcaamano

Sequence Diagram(s)

sequenceDiagram
  participant CLI
  participant CloudProviderConfig
  participant OpenStack
  CLI->>CloudProviderConfig: Set OSMaxAllowedAddressPairs
  OpenStack->>CloudProviderConfig: Read configured capacity
  OpenStack->>OpenStack: Select configured or default capacity
  OpenStack->>OpenStack: Compute egress IP capacity
Loading
🚥 Pre-merge checks | ✅ 14 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (14 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: making OpenStack allowed address pairs configurable.
Description check ✅ Passed The description matches the patch and explains the new flag, validation, and default behavior.
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 added/updated test names are static strings; no Ginkgo titles or dynamic values were introduced.
Test Structure And Quality ✅ Passed The new table-driven tests are isolated, use mock HTTP setup/teardown, add no cluster waits, and include clear failure messages.
Microshift Test Compatibility ✅ Passed PASS: The PR only adds/updates plain Go unit tests in pkg/cloudprovider/openstack_test.go; no Ginkgo e2e tests, no MicroShift-unsupported OpenShift APIs, and no missing skip tags.
Single Node Openshift (Sno) Test Compatibility ✅ Passed PR only adds/updates testing.T unit tests in pkg/cloudprovider/openstack_test.go; no Ginkgo e2e tests or multi-node/SNO assumptions were introduced.
Topology-Aware Scheduling Compatibility ✅ Passed The diff only adds an OpenStack config flag/field and capacity logic; no replicas, affinities, nodeSelectors, spread constraints, or topology checks were introduced.
Ote Binary Stdout Contract ✅ Passed The PR only adds a flag/config path and OpenStack capacity logic; no new process-level stdout writes or stdout-bound logging calls were introduced.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed No new Ginkgo e2e tests were added; the changes are standard unit tests in pkg/cloudprovider/openstack_test.go with mocked HTTP data, not external connectivity.
No-Weak-Crypto ✅ Passed No MD5/SHA1/DES/RC4/3DES/Blowfish/ECB, custom crypto, or secret comparisons were added; changes only add an OpenStack config flag and capacity logic.
Container-Privileges ✅ Passed Diff only adds OpenStack config logic in Go files; no manifests or privilege flags (privileged, hostPID/Network/IPC, allowPrivilegeEscalation, SYS_ADMIN, root) were introduced.
No-Sensitive-Data-In-Logs ✅ Passed The PR only adds a numeric OpenStack flag and capacity logic; no new logs or log data paths expose secrets, PII, hostnames, or customer data.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@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 Jul 15, 2026
@openshift-ci

openshift-ci Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

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

@openshift-ci

openshift-ci Bot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: danchild
Once this PR has been reviewed and has the lgtm label, please assign abhat for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@danchild
danchild marked this pull request as ready for review July 15, 2026 17:18
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 15, 2026
@openshift-ci
openshift-ci Bot requested review from arkadeepsen and jcaamano July 15, 2026 17:19

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
cmd/cloud-network-config-controller/main.go (1)

282-291: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Use constant for platform type comparison.

Consider replacing the hardcoded "OpenStack" string with the cloudprovider.PlatformTypeOpenStack constant that is already used on line 205 of this file. This helps avoid magic strings and aligns with existing code patterns.

♻️ Proposed refactor
 	// determine if platform-os-max-allowed-address-pairs was set explicitly with a
 	// command line flag
-	if platformCfg.PlatformType == "OpenStack" {
+	if platformCfg.PlatformType == cloudprovider.PlatformTypeOpenStack {
 		flag.Visit(func(f *flag.Flag) {
 			if f.Name == "platform-os-max-allowed-address-pairs" {
 				platformCfg.OSMaxAllowedAddressPairs.SetByFlag = true
 			}
 		})
 	}
🤖 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 `@cmd/cloud-network-config-controller/main.go` around lines 282 - 291, In the
platform type check surrounding flag.Visit, replace the hardcoded "OpenStack"
comparison with the existing cloudprovider.PlatformTypeOpenStack constant. Keep
the explicit flag detection and SetByFlag assignment unchanged.
🤖 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.

Nitpick comments:
In `@cmd/cloud-network-config-controller/main.go`:
- Around line 282-291: In the platform type check surrounding flag.Visit,
replace the hardcoded "OpenStack" comparison with the existing
cloudprovider.PlatformTypeOpenStack constant. Keep the explicit flag detection
and SetByFlag assignment unchanged.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: 725d7b3c-7cab-4f58-84c3-6aafb21435c6

📥 Commits

Reviewing files that changed from the base of the PR and between 0b49df2 and 9aa6812.

📒 Files selected for processing (4)
  • cmd/cloud-network-config-controller/main.go
  • pkg/cloudprovider/cloudprovider.go
  • pkg/cloudprovider/openstack.go
  • pkg/cloudprovider/openstack_test.go

@danchild

Copy link
Copy Markdown
Member Author

/assign @arghosh93

@danchild
danchild force-pushed the openstack-allowed-address-pairs branch from 9aa6812 to d0174f3 Compare July 15, 2026 19:51

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
cmd/cloud-network-config-controller/main.go (1)

267-267: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Explicitly reject negative values for the flag.

While negative values are gracefully ignored during the capacity calculation (falling back to the default of 10), explicitly rejecting them during initialization prevents silent misconfigurations and strictly aligns with the PR objective ("zero or negative values are rejected"). As per path instructions, bounds-check user-supplied sizes.

Consider adding validation after flag.Parse():

	// Verify required arguments
	if secretName == "" || platformCfg.PlatformType == "" {
		klog.Exit("-secret-name or -platform-type is empty, cannot initialize controller")
	}
	if platformCfg.OSMaxAllowedAddressPairs < 0 {
		klog.Exit("-platform-os-max-allowed-address-pairs cannot be negative")
	}
🤖 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 `@cmd/cloud-network-config-controller/main.go` at line 267, Add initialization
validation after flag.Parse and the existing required-argument checks to reject
negative platformCfg.OSMaxAllowedAddressPairs via klog.Exit with a clear
flag-specific message. Preserve zero handling and the existing validation flow.

Source: Path instructions

🤖 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 `@pkg/cloudprovider/openstack.go`:
- Around line 611-613: Update the error message format string in the
address-pair capacity check to remove parentheses around all integer format
specifiers, while preserving the existing values, wording, and argument order.

---

Nitpick comments:
In `@cmd/cloud-network-config-controller/main.go`:
- Line 267: Add initialization validation after flag.Parse and the existing
required-argument checks to reject negative platformCfg.OSMaxAllowedAddressPairs
via klog.Exit with a clear flag-specific message. Preserve zero handling and the
existing validation flow.
🪄 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: 31799181-b9e8-493f-a5b4-8e0c8b2db34f

📥 Commits

Reviewing files that changed from the base of the PR and between 9aa6812 and d0174f3.

📒 Files selected for processing (4)
  • cmd/cloud-network-config-controller/main.go
  • pkg/cloudprovider/cloudprovider.go
  • pkg/cloudprovider/openstack.go
  • pkg/cloudprovider/openstack_test.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • pkg/cloudprovider/openstack_test.go

Comment thread pkg/cloudprovider/openstack.go Outdated
@danchild

Copy link
Copy Markdown
Member Author

/test e2e-azure-serial-2of2

@danchild

Copy link
Copy Markdown
Member Author

/test e2e-gcp-ovn

@danchild

Copy link
Copy Markdown
Member Author

/verified by @danchild

@openshift-ci-robot openshift-ci-robot added the verified Signifies that the PR passed pre-merge verification criteria label Jul 17, 2026
@openshift-ci-robot

Copy link
Copy Markdown

@danchild: This PR has been marked as verified by @danchild.

Details

In response to this:

/verified by @danchild

Instructions 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 openshift-eng/jira-lifecycle-plugin repository.

Currently, the maxmium allowed address pairs per port
is hardcoded to OpenStack's default of 10. The
`platform-os-max-allowed-address-pairs` flag allows
users to customize the configuration, mirroring the
setting in their installation's neutron.conf.

The patch allows any custom configuration greater than zero.
Finally, the default of 10 is still used as a fallback
if the user doesn't configure `platform-os-max-allowed-address-pairs`

Signed-off-by: Dan Childers <dchilder@redhat.com>
@danchild
danchild force-pushed the openstack-allowed-address-pairs branch from d1a1b28 to 62be2d7 Compare July 20, 2026 13:26
@openshift-ci-robot openshift-ci-robot removed the verified Signifies that the PR passed pre-merge verification criteria label Jul 20, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
pkg/cloudprovider/openstack_test.go (1)

1084-1164: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Add a test case to verify negative value fallback behavior.

The PR summary states that negative values are rejected, which the implementation handles by falling back to the default capacity (since the condition OSMaxAllowedAddressPairs > 0 evaluates to false). Consider explicitly adding a test case for a negative value to ensure this fallback behavior remains validated and prevents future regressions.

💡 Proposed addition to the test cases

You can append this case to the tcs slice:

		{
			name:                "negative flag uses default capacity",
			maxAllowedAddrPairs: -5,
			port:                portMap["9ab428d4-58f8-42d7-9672-90c3f5641f83"],
			nodeEgressIPConfig: NodeEgressIPConfiguration{
				Interface: "9ab428d4-58f8-42d7-9672-90c3f5641f83",
				IFAddr: ifAddr{
					IPv4: "192.0.2.0/24",
					IPv6: "2000::/64",
				},
				Capacity: capacity{
					IP: ptr.To(defaultOpenstackMaxCapacity - 5),
				},
			},
		},
🤖 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 `@pkg/cloudprovider/openstack_test.go` around lines 1084 - 1164, Add a
table-driven case to
TestGetNeutronPortNodeEgressIPConfigurationMaxAllowedAddressPairs with a
negative OSMaxAllowedAddressPairs value, such as -5, and expect the same default
capacity configuration as the existing “unset flag uses default capacity” case.
🤖 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.

Nitpick comments:
In `@pkg/cloudprovider/openstack_test.go`:
- Around line 1084-1164: Add a table-driven case to
TestGetNeutronPortNodeEgressIPConfigurationMaxAllowedAddressPairs with a
negative OSMaxAllowedAddressPairs value, such as -5, and expect the same default
capacity configuration as the existing “unset flag uses default capacity” case.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited)

Review profile: CHILL

Plan: Enterprise

Run ID: f9a0247c-1a73-4da0-b3d3-16fbca255aaa

📥 Commits

Reviewing files that changed from the base of the PR and between d0174f3 and 62be2d7.

📒 Files selected for processing (4)
  • cmd/cloud-network-config-controller/main.go
  • pkg/cloudprovider/cloudprovider.go
  • pkg/cloudprovider/openstack.go
  • pkg/cloudprovider/openstack_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • cmd/cloud-network-config-controller/main.go
  • pkg/cloudprovider/openstack.go

…irs arg

Coverage includes testing the following combinations of conditions:

- custom positive value overrides default
- unset flag uses default capacity
- custom value is too small

Signed-off-by: Dan Childers <dchilder@redhat.com>
@danchild
danchild force-pushed the openstack-allowed-address-pairs branch from 62be2d7 to d68adfb Compare July 20, 2026 13:51
@openshift-ci

openshift-ci Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

@danchild: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-gcp-ovn d68adfb link true /test e2e-gcp-ovn
ci/prow/hypershift-e2e-aks d68adfb link true /test hypershift-e2e-aks
ci/prow/security d68adfb link false /test security

Full PR test history. Your PR dashboard.

Details

Instructions 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.

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

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants