-
Notifications
You must be signed in to change notification settings - Fork 301
OSASINFRA-4400: Add support for max_allowed_address_pairs OpenStack #3058
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,10 @@ package network | |
|
|
||
| import ( | ||
| "context" | ||
| "fmt" | ||
| "strconv" | ||
|
|
||
| configv1 "github.com/openshift/api/config/v1" | ||
| operv1 "github.com/openshift/api/operator/v1" | ||
| "github.com/openshift/cluster-network-operator/pkg/bootstrap" | ||
| cnoclient "github.com/openshift/cluster-network-operator/pkg/client" | ||
|
|
@@ -34,6 +37,14 @@ func Bootstrap(conf *operv1.Network, client cnoclient.Client) (*bootstrap.Bootst | |
|
|
||
| out.IPTablesAlerter = iptablesAlerterBootstrap(client.ClientFor("").CRClient()) | ||
|
|
||
| if infraStatus.PlatformType == configv1.OpenStackPlatformType { | ||
| cnc, err := cloudNetworkConfigBootstrap(client.ClientFor("").CRClient()) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
| out.CloudNetworkConfig = cnc | ||
| } | ||
|
|
||
| out.TLSProfile, err = GetTLSProfile(client, infraStatus.HostedControlPlane) | ||
| if err != nil { | ||
| return nil, err | ||
|
|
@@ -67,3 +78,31 @@ func iptablesAlerterBootstrap(cl crclient.Reader) bootstrap.IPTablesAlerterBoots | |
|
|
||
| return result | ||
| } | ||
|
|
||
| func cloudNetworkConfigBootstrap(cl crclient.Reader) (bootstrap.CloudNetworkConfigBootstrapResult, error) { | ||
| result := bootstrap.CloudNetworkConfigBootstrapResult{} | ||
|
|
||
| cm := &corev1.ConfigMap{} | ||
| if err := cl.Get(context.TODO(), types.NamespacedName{ | ||
| Namespace: "openshift-network-operator", | ||
| Name: "cloud-network-config", | ||
| }, cm); err != nil { | ||
| if !apierrors.IsNotFound(err) { | ||
| return result, fmt.Errorf("error fetching cloud-network-config configmap: %w", err) | ||
| } | ||
| return result, nil | ||
|
Comment on lines
+86
to
+93
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
# Locate and inspect the target file and related call sites without running repository code.
printf 'Target file lines:\n'
sed -n '1,150p' pkg/network/bootstrap.go
printf '\nCall sites for Bootstrap / cloudNetworkConfigBootstrap:\n'
rg -n "Bootstrap\\(|cloudNetworkConfigBootstrap\\(" pkg cmd test manifests 2>/dev/null || true
printf '\nFunction signatures and TODO context usages in bootstrap-related Go files:\n'
rg -n "context\\.TODO\\(|func .*Bootstrap|cloudNetworkConfigBootstrap" pkg/network/bootstrap.go pkg/network -g '*.go'Repository: openshift/cluster-network-operator Length of output: 13900 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf 'operconfig_controller relevant section:\n'
sed -n '290,350p' pkg/controller/operconfig/operconfig_controller.go
printf '\nReconcile-related imports and context handling in operconfig controller:\n'
sed -n '1,80p' pkg/controller/operconfig/operconfig_controller.go
printf '\nBootstrap tests around cloud network config:\n'
sed -n '210,250p' pkg/network/bootstrap_test.go
sed -n '420,485p' pkg/network/cloud_network_test.goRepository: openshift/cluster-network-operator Length of output: 9006 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf 'Reconciler signature and Reconcile method header:\n'
rg -n "type ReconcileOperConfig|func \\(r \\*ReconcileOperConfig\\) Reconcile|func \\(r \\*ReconcileOperConfig\\)" pkg/controller/operconfig/operconfig_controller.goRepository: openshift/cluster-network-operator Length of output: 380 Thread the reconciliation context into the ConfigMap reads. This OpenStack bootstrap path currently uses 🤖 Prompt for AI AgentsSource: Path instructions |
||
| } | ||
|
|
||
| raw, ok := cm.Data["platform-os-max-allowed-address-pairs"] | ||
| if !ok { | ||
| return result, nil | ||
| } | ||
|
|
||
| val, err := strconv.Atoi(raw) | ||
| if err != nil { | ||
| return result, fmt.Errorf("error parsing cloud-network-config platform-os-max-allowed-address-pairs=%q: %w", raw, err) | ||
| } | ||
|
|
||
| result.OSMaxAllowedAddressPairs = &val | ||
| return result, nil | ||
| } | ||
|
danchild marked this conversation as resolved.
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win
Fix the YAML template syntax before merge.
The conditional actions on Lines 54 and 56 are outside YAML comments or scalar values. YAMLlint reports Line 55 with
could not find expected ':'.Place the template control actions in YAML comments without trim markers, then validate both rendered branches.
Proposed fix
🧰 Tools
🪛 YAMLlint (1.37.1)
[error] 55-55: syntax error: could not find expected ':'
(syntax)
🤖 Prompt for AI Agents
Source: Linters/SAST tools