-
Notifications
You must be signed in to change notification settings - Fork 284
OCPBUGS-55962: Provide config map to force loose isolation for UDN networks #2714
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
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -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 | ||||||
|
Member
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.
Suggested change
nit |
||||||
| // provider network configuration. | ||||||
| LooseUDNIsolationModeEnabled bool | ||||||
| } | ||||||
|
|
||||||
| // APIServer is the hostname & port of a given APIServer. (This is the | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -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(), | ||||||
|
Member
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.
Suggested change
|
||||||
| types.NamespacedName{Name: "udn-config-overrides", Namespace: names.APPLIED_NAMESPACE}, configMap); err != nil { | ||||||
|
Member
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. Should
Contributor
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. I was thinking if we should go more generic with the name and use
Contributor
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. Can we just use the existing
Contributor
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. |
||||||
| 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 | ||||||
|
Contributor
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. Maybe just use the same key/value that we pass to ovnk for consistency? So |
||||||
| } | ||||||
|
|
||||||
| 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 { | ||||||
|
|
@@ -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 | ||||||
|
|
||||||
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.
I don't think this matches what ovn-kubernetes/ovn-kubernetes@3dd6149 expects. The setting there is called
ROUTED_UDN_ISOLATIONinstead ofUDN_ISOLATION_MODE. Also the values it takes areDisabledorEnablednotloose.This should preferably be passed as a command line argument in
script-librather than an environment variable for consistency.I think
UDN_ISOLATION_MODEis fine, I would probably useStrictandLoosefor values rather than DisabledorEnabled`.