Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions bindata/network/ovn-kubernetes/managed/ovnkube-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,10 @@ spec:
- name: "NO_PROXY"
value: "{{ .NO_PROXY}}"
{{ end }}
{{ if .IsLooseUDNIsolationEnabled }}
- name: UDN_ISOLATION_MODE
value: "loose"
{{ end }}
Comment on lines +433 to +436
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think this matches what ovn-kubernetes/ovn-kubernetes@3dd6149 expects. The setting there is called
ROUTED_UDN_ISOLATION instead of UDN_ISOLATION_MODE. Also the values it takes are Disabled or Enabled not loose.

This should preferably be passed as a command line argument in script-lib rather than an environment variable for consistency.

I think UDN_ISOLATION_MODE is fine, I would probably use Strict and Loose for values rather than DisabledorEnabled`.

- name: K8S_NODE
valueFrom:
fieldRef:
Expand Down
4 changes: 4 additions & 0 deletions bindata/network/ovn-kubernetes/self-hosted/ovnkube-node.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,10 @@ spec:
- name: OVNKUBE_NODE_MGMT_PORT_DP_RESOURCE_NAME
value: {{ .MgmtPortResourceName }}
{{ end }}
{{ if .IsLooseUDNIsolationEnabled }}
- name: UDN_ISOLATION_MODE
value: "loose"
{{ end }}
- name: K8S_NODE
valueFrom:
fieldRef:
Expand Down
5 changes: 5 additions & 0 deletions pkg/bootstrap/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,11 @@ type InfraStatus struct {

// ConsolePluginCRDExists set to true when the consoleplugins.console.openshift.io has been deployed.
ConsolePluginCRDExists bool

// LooseUDNIsolationModeEnabled set to true when loose isolation mode is enabled between two BGP advertised
// UDN networks. In loose isolation mode, those network pods can communicate with each other accoding to
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
// UDN networks. In loose isolation mode, those network pods can communicate with each other accoding to
// UDN networks. In loose isolation mode, those network pods can communicate with each other according to

nit

// provider network configuration.
LooseUDNIsolationModeEnabled bool
}

// APIServer is the hostname & port of a given APIServer. (This is the
Expand Down
1 change: 1 addition & 0 deletions pkg/network/ovn_kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ func renderOVNKubernetes(conf *operv1.NetworkSpec, bootstrapResult *bootstrap.Bo
data.Data["NETWORK_NODE_IDENTITY_ENABLE"] = bootstrapResult.Infra.NetworkNodeIdentityEnabled
data.Data["NodeIdentityCertDuration"] = OVN_NODE_IDENTITY_CERT_DURATION
data.Data["IsNetworkTypeLiveMigration"] = false
data.Data["IsLooseUDNIsolationEnabled"] = bootstrapResult.Infra.LooseUDNIsolationModeEnabled

if conf.Migration != nil {
if conf.Migration.MTU != nil && conf.Migration.Mode != operv1.LiveNetworkMigrationMode {
Expand Down
22 changes: 22 additions & 0 deletions pkg/platform/platform.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,22 @@ func isNetworkNodeIdentityEnabled(client cnoclient.Client, infra *bootstrap.Infr
return true, nil
}

// isLooseUDNIsolationEnabled determines if loose udn isolation mode should be enabled.
// It checks the `force-loose-isolation` key in the openshift-network-operator/udn-config-overrides configmap.
// If the configmap doesn't exist, it returns false (the UDN isolation is protected by default).
func isLooseUDNIsolationEnabled(client cnoclient.Client) (bool, error) {
configMap := &corev1.ConfigMap{}
if err := client.ClientFor("").CRClient().Get(context.TODO(),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
if err := client.ClientFor("").CRClient().Get(context.TODO(),
if err := client.Default().CRClient().Get(context.TODO(),

types.NamespacedName{Name: "udn-config-overrides", Namespace: names.APPLIED_NAMESPACE}, configMap); err != nil {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should udn-config-overrides be added as a constant? Then the constant can be used here.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I was thinking if we should go more generic with the name and use ovn-kubernetes-config-overrides and this be a more generic getOVNKConfigOverrides returning a map. Just to prevent us from spreading on config map names.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we just use the existing env-overrides configmap instead of creating a new configmap?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I created a new PR #2752 according to @jcaamano 's comments. PTAL.

if apierrors.IsNotFound(err) {
return false, nil
}
return false, fmt.Errorf("unable to bootstrap OVN, unable to retrieve udn-config-overrides config: %s", err)
}
isLooseIsolationEnabled := configMap.Data["force-loose-isolation"]
return isLooseIsolationEnabled == "true", nil
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe just use the same key/value that we pass to ovnk for consistency? So UDNRoutedIsolationMode and Strict,Loose values? Any non expected value should return error.

}

func InfraStatus(client cnoclient.Client) (*bootstrap.InfraStatus, error) {
infraConfig := &configv1.Infrastructure{}
if err := client.Default().CRClient().Get(context.TODO(), types.NamespacedName{Name: "cluster"}, infraConfig); err != nil {
Expand Down Expand Up @@ -148,6 +164,12 @@ func InfraStatus(client cnoclient.Client) (*bootstrap.InfraStatus, error) {
}
res.NetworkNodeIdentityEnabled = netIDEnabled

isLooseUDNIsolationEnabled, err := isLooseUDNIsolationEnabled(client)
if err != nil {
return nil, fmt.Errorf("failed to determine if loose udn isolation should be enabled: %w", err)
}
res.LooseUDNIsolationModeEnabled = isLooseUDNIsolationEnabled

res.ConsolePluginCRDExists, err = consolePluginCRDExists(client)
if err != nil {
return nil, err
Expand Down