Skip to content

Commit 79c2f28

Browse files
tsoryacursoragent
andcommitted
MGMT-21314: Revert DPU-host per-node feature gating
This reverts commit c17dba5 (MGMT-21485) which moved feature enablement from the ConfigMap into per-node script logic gated by OVN_NODE_MODE. Feature flags (egress IP, multicast, multi-network, network segmentation, admin network policy, multi-external-gateway, etc.) are managed via the cluster-wide ConfigMap (004-config.yaml) passed to ovnkube through --config-file. They do not need per-node gating in the startup script. OVN_NODE_MODE remains used only for DPU-host structural differences: gateway interface, ovnkube-node-mode flag, and init-controller. Also re-applies the feature gate cleanup from f5b8490 (removal of OVN_ADMIN_NETWORK_POLICY_ENABLE template references) and removes redundant CLI flags from 008-script-lib.yaml that duplicate what the ConfigMap already provides. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 9d540eb commit 79c2f28

10 files changed

Lines changed: 134 additions & 416 deletions

File tree

README.md

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -157,18 +157,6 @@ OVNKubernetes supports the following configuration options, all of which are opt
157157
* `egressIPConfig`: holds the configuration for EgressIP options.
158158
* `reachabilityTotalTimeoutSeconds`: Set EgressIP node reachability total timeout in seconds, 0 means disable reachability check and the default is 1 second.
159159

160-
#### DPU Host Mode Support
161-
162-
OVN-Kubernetes supports specialized hardware deployments such as DPU (Data Processing Unit) hosts through the `OVN_NODE_MODE` environment variable. In `dpu-host` mode, certain features are automatically disabled on those nodes regardless of cluster-wide configuration:
163-
164-
- Egress IP and related features (egress firewall, egress QoS, egress service)
165-
- Multicast support
166-
- Multi-external gateway support
167-
- Multi-network policies and admin network policies
168-
- Network segmentation features
169-
170-
This per-node feature enforcement is implemented through conditional logic in the startup scripts, allowing the same cluster configuration to work across heterogeneous node types. For detailed information about node modes and the technical implementation, see `docs/ovn_node_mode.md`.
171-
172160
These configuration flags are only in the Operator configuration object.
173161

174162
Example from the `manifests/cluster-network-03-config.yml` file:

bindata/network/ovn-kubernetes/common/008-script-lib.yaml

Lines changed: 3 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -533,16 +533,8 @@ data:
533533

534534
echo "I$(date "+%m%d %H:%M:%S.%N") - starting ovnkube-node"
535535

536-
# enable egress ip, egress firewall, egress qos, egress service
537-
egress_features_enable_flag="--enable-egress-ip=true --enable-egress-firewall=true --enable-egress-qos=true --enable-egress-service=true"
538536
init_ovnkube_controller="--init-ovnkube-controller ${K8S_NODE}"
539-
multi_external_gateway_enable_flag="--enable-multi-external-gateway=true"
540-
gateway_interface=br-ex
541-
542-
# enable multicast
543-
enable_multicast_flag="--enable-multicast"
544-
545-
# Use OVN_NODE_MODE environment variable, default to "full" if not set
537+
gateway_interface="br-ex"
546538
OVN_NODE_MODE=${OVN_NODE_MODE:-full}
547539
# We check only dpu-host mode and not smart-nic mode here as currently we do not support it yet
548540
# Once we support it, we will need to check for it here and add relevant code.
@@ -551,17 +543,10 @@ data:
551543
# https://github.com/ovn-kubernetes/ovn-kubernetes/pull/5327/files
552544
gateway_interface="derive-from-mgmt-port"
553545
ovnkube_node_mode="--ovnkube-node-mode dpu-host"
554-
# disable egress ip for dpu-host mode as it is not supported
555-
egress_features_enable_flag=""
556-
557-
# disable multicast for dpu-host mode as it is not supported
558-
enable_multicast_flag=""
559546

560547
# disable init-ovnkube-controller for dpu-host mode as it is not supported
561548
init_ovnkube_controller=""
562549

563-
# disable multi-external-gateway for dpu-host mode as it is not supported
564-
multi_external_gateway_enable_flag=""
565550
fi
566551

567552
if [ "{{.OVN_GATEWAY_MODE}}" == "shared" ]; then
@@ -606,44 +591,16 @@ data:
606591
node_mgmt_port_netdev_flags="$node_mgmt_port_netdev_flags --ovnkube-node-mgmt-port-dp-resource-name ${OVNKUBE_NODE_MGMT_PORT_DP_RESOURCE_NAME}"
607592
fi
608593

609-
multi_network_enabled_flag=
610-
if [[ "{{.OVN_MULTI_NETWORK_ENABLE}}" == "true" && "${OVN_NODE_MODE}" != "dpu-host" ]]; then
611-
multi_network_enabled_flag="--enable-multi-network"
612-
fi
613-
614-
network_segmentation_enabled_flag=
615-
if [[ "${OVN_NODE_MODE}" != "dpu-host" ]]; then
616-
multi_network_enabled_flag="--enable-multi-network"
617-
network_segmentation_enabled_flag="--enable-network-segmentation"
618-
fi
619-
620594
route_advertisements_enable_flag=
621595
if [[ "{{.OVN_ROUTE_ADVERTISEMENTS_ENABLE}}" == "true" ]]; then
622596
route_advertisements_enable_flag="--enable-route-advertisements"
623597
fi
624-
625-
preconfigured_udn_addresses_enable_flag="--enable-preconfigured-udn-addresses"
626598

627599
network_observability_enabled_flag=
628600
if [[ "{{.OVN_OBSERVABILITY_ENABLE}}" == "true" ]]; then
629601
network_observability_enabled_flag="--enable-observability"
630602
fi
631603

632-
multi_network_policy_enabled_flag=
633-
if [[ "{{.OVN_MULTI_NETWORK_POLICY_ENABLE}}" == "true"&& "${OVN_NODE_MODE}" != "dpu-host" ]]; then
634-
multi_network_policy_enabled_flag="--enable-multi-networkpolicy"
635-
fi
636-
637-
admin_network_policy_enabled_flag=
638-
if [[ "${OVN_NODE_MODE}" != "dpu-host" ]]; then
639-
admin_network_policy_enabled_flag="--enable-admin-network-policy"
640-
fi
641-
642-
dns_name_resolver_enabled_flag=
643-
if [[ "{{.DNS_NAME_RESOLVER_ENABLE}}" == "true" ]]; then
644-
dns_name_resolver_enabled_flag="--enable-dns-name-resolver"
645-
fi
646-
647604
# If IP Forwarding mode is global set it in the host here. IPv6 IP Forwarding shuld be
648605
# enabled for all interfaces at all times if cluster is configured as single stack IPv6
649606
# or dual stack. This will be taken care by ovn-kubernetes(ovn-org/ovn-kubernetes#4376).
@@ -716,15 +673,9 @@ data:
716673
--export-ovs-metrics \
717674
--disable-snat-multiple-gws \
718675
${export_network_flows_flags} \
719-
${multi_network_enabled_flag} \
720-
${network_segmentation_enabled_flag} \
721676
${route_advertisements_enable_flag} \
722-
${preconfigured_udn_addresses_enable_flag} \
723-
${multi_network_policy_enabled_flag} \
724-
${admin_network_policy_enabled_flag} \
725-
${dns_name_resolver_enabled_flag} \
726677
${network_observability_enabled_flag} \
727-
${enable_multicast_flag} \
678+
--enable-multicast \
728679
--zone ${K8S_NODE} \
729680
--enable-interconnect \
730681
--acl-logging-rate-limit "{{.OVNPolicyAuditRateLimit}}" \
@@ -737,7 +688,5 @@ data:
737688
${ovn_v4_masquerade_subnet_opt} \
738689
${ovn_v6_masquerade_subnet_opt} \
739690
${ovn_v4_transit_switch_subnet_opt} \
740-
${ovn_v6_transit_switch_subnet_opt} \
741-
${egress_features_enable_flag} \
742-
${multi_external_gateway_enable_flag}
691+
${ovn_v6_transit_switch_subnet_opt}
743692
}

bindata/network/ovn-kubernetes/managed/004-config.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ data:
3333
dns-service-name="dns-default"
3434

3535
[ovnkubernetesfeature]
36+
enable-egress-ip=true
37+
enable-egress-firewall=true
38+
enable-egress-qos=true
39+
enable-egress-service=true
3640
{{- if .ReachabilityNodePort }}
3741
egressip-node-healthcheck-port={{.ReachabilityNodePort}}
3842
{{- end }}
@@ -41,6 +45,13 @@ data:
4145
{{- end }}
4246
enable-network-segmentation=true
4347
enable-preconfigured-udn-addresses=true
48+
49+
{{- end }}
50+
{{- if .OVN_MULTI_NETWORK_POLICY_ENABLE }}
51+
enable-multi-networkpolicy=true
52+
{{- end }}
53+
enable-admin-network-policy=true
54+
enable-multi-external-gateway=true
4455
{{- if .DNS_NAME_RESOLVER_ENABLE }}
4556
enable-dns-name-resolver=true
4657
{{- end }}
@@ -125,6 +136,13 @@ data:
125136
{{- end }}
126137
enable-network-segmentation=true
127138
enable-preconfigured-udn-addresses=true
139+
{{- end }}
140+
{{- end }}
141+
{{- if .OVN_MULTI_NETWORK_POLICY_ENABLE }}
142+
enable-multi-networkpolicy=true
143+
{{- end }}
144+
enable-admin-network-policy=true
145+
enable-multi-external-gateway=true
128146
{{- if .DNS_NAME_RESOLVER_ENABLE }}
129147
enable-dns-name-resolver=true
130148
{{- end }}

bindata/network/ovn-kubernetes/managed/ovnkube-control-plane.yaml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ spec:
193193
# This is needed so that converting clusters from GA to TP
194194
# will rollout control plane pods as well
195195
network_segmentation_enabled_flag=
196+
multi_network_enabled_flag=
196197
multi_network_enabled_flag="--enable-multi-network"
197198
network_segmentation_enabled_flag="--enable-network-segmentation"
198199
@@ -235,15 +236,7 @@ spec:
235236
${multi_network_enabled_flag} \
236237
${network_segmentation_enabled_flag} \
237238
${route_advertisements_enable_flag} \
238-
${preconfigured_udn_addresses_enable_flag} \
239-
--enable-egress-ip=true \
240-
--enable-egress-firewall=true \
241-
--enable-egress-qos=true \
242-
--enable-egress-service=true \
243-
--enable-multicast \
244-
--enable-multi-external-gateway=true \
245-
${multi_network_policy_enabled_flag} \
246-
${admin_network_policy_enabled_flag}
239+
${preconfigured_udn_addresses_enable_flag}
247240
volumeMounts:
248241
- mountPath: /run/ovnkube-config/
249242
name: ovnkube-config

bindata/network/ovn-kubernetes/self-hosted/004-config.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,26 @@ data:
3333
dns-service-name="dns-default"
3434

3535
[ovnkubernetesfeature]
36-
36+
enable-egress-ip=true
37+
enable-egress-firewall=true
38+
enable-egress-qos=true
39+
enable-egress-service=true
3740
{{- if .ReachabilityTotalTimeoutSeconds }}
3841
egressip-reachability-total-timeout={{.ReachabilityTotalTimeoutSeconds}}
3942
{{- end }}
4043
{{- if .ReachabilityNodePort }}
4144
egressip-node-healthcheck-port={{.ReachabilityNodePort}}
4245
{{- end }}
43-
{{- if not .OVN_MULTI_NETWORK_ENABLE }}
46+
{{- if .OVN_MULTI_NETWORK_ENABLE }}
4447
enable-multi-network=true
45-
{{- end }}
48+
{{- end }}
4649
enable-network-segmentation=true
4750
enable-preconfigured-udn-addresses=true
4851
{{- if .OVN_MULTI_NETWORK_POLICY_ENABLE }}
4952
enable-multi-networkpolicy=true
5053
{{- end }}
54+
enable-admin-network-policy=true
55+
enable-multi-external-gateway=true
5156
{{- if .DNS_NAME_RESOLVER_ENABLE }}
5257
enable-dns-name-resolver=true
5358
{{- end }}

bindata/network/ovn-kubernetes/self-hosted/ovnkube-control-plane.yaml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -188,15 +188,7 @@ spec:
188188
${network_segmentation_enabled_flag} \
189189
${gateway_mode_flags} \
190190
${route_advertisements_enable_flag} \
191-
${preconfigured_udn_addresses_enable_flag} \
192-
--enable-egress-ip=true \
193-
--enable-egress-firewall=true \
194-
--enable-egress-qos=true \
195-
--enable-egress-service=true \
196-
--enable-multicast \
197-
--enable-multi-external-gateway=true \
198-
${multi_network_policy_enabled_flag} \
199-
${admin_network_policy_enabled_flag}
191+
${preconfigured_udn_addresses_enable_flag}
200192
volumeMounts:
201193
- mountPath: /run/ovnkube-config/
202194
name: ovnkube-config

docs/architecture.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,6 @@ The Network operator needs to make sure that the input configuration doesn't cha
141141

142142
The persisted configuration must **make all defaults explicit**. This protects against inadvertent code changes that could destabilize an existing cluster.
143143

144-
### Per-Node Configuration
145-
146-
For certain specialized deployments (e.g., DPU host nodes), some features need to be disabled on a per-node basis even when enabled cluster-wide. Since ConfigMap values cannot be reliably overridden per-node, the CNO implements per-node feature enforcement through conditional logic in the startup scripts.
147-
148-
The `OVN_NODE_MODE` environment variable is injected into `ovnkube-node` pods and consumed by the startup script (`008-script-lib.yaml`) to conditionally enable or disable features based on the node's operational mode. This ensures that unsupported features are deterministically disabled on specialized hardware regardless of cluster-wide configuration.
149-
150144
## Egress Router
151145

152146
**Input:** `EgressRouter.network.operator.openshift.io`

docs/operands.md

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -93,26 +93,6 @@ configuration object (which in turn is copied there from the
9393
configuration) is "`OVNKubernetes`". If the specified network type is
9494
not "`OVNKubernetes`", the CNO will not render any network plugin.
9595

96-
### OVN-Kubernetes Node Modes
97-
98-
OVN-Kubernetes supports different node operational modes through the `OVN_NODE_MODE`
99-
environment variable. This allows per-node feature enforcement, particularly for
100-
specialized hardware like DPU (Data Processing Unit) hosts where certain features
101-
must be disabled.
102-
103-
The startup script (`008-script-lib.yaml`) contains conditional logic that adjusts
104-
feature enablement based on the node mode:
105-
106-
- **`full` mode (default)**: All features enabled as configured
107-
- **`dpu-host` mode**: Certain features like egress IP, multicast, multi-network
108-
policies, and admin network policies are automatically disabled regardless of
109-
cluster-wide configuration
110-
111-
This approach was necessary because ConfigMap values (`004-config.yaml`) cannot be
112-
reliably overridden on a per-node basis, but startup script logic can be conditional.
113-
114-
For detailed information, see `docs/ovn_node_mode.md`.
115-
11696
## Multus
11797

11898
Multus is deployed as long as `.spec.disableMultiNetwork` is not set.

docs/ovn_node_mode.md

Lines changed: 6 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,100 +1,18 @@
1-
## OVN node modes and per-node feature enforcement
1+
## OVN node modes
22

3-
This change introduces `OVN_NODE_MODE` as an environment variable injected into the `ovnkube-node` Pod. The value is consumed by the startup script rendered from `bindata/network/ovn-kubernetes/common/008-script-lib.yaml` to tailor behavior per node mode at runtime.
4-
5-
### Why move flags from the config map into the script?
6-
7-
- The INI-based config (`004-config.yaml`) is rendered cluster-wide. Those values are not reliably overridable on a per-node or per-mode basis.
8-
- In DPU host mode, some features are not supported and must be deterministically disabled on those nodes even if the cluster-wide config enables them.
9-
- Moving the enablement logic to the entrypoint script allows per-node enforcement using `OVN_NODE_MODE`, preventing unsupported features from being turned on by cluster defaults.
3+
The `OVN_NODE_MODE` environment variable is injected into the `ovnkube-node` Pod to identify the node's operational mode. It is consumed by the startup script rendered from `bindata/network/ovn-kubernetes/common/008-script-lib.yaml`.
104

115
### Behavior by mode
126

137
- `full` (default):
14-
- `gateway_interface=br-ex`
8+
- `gateway_interface="br-ex"`
159
- `init_ovnkube_controller="--init-ovnkube-controller ${K8S_NODE}"`
16-
- `enable_multicast_flag="--enable-multicast"`
17-
- `egress_features_enable_flag="--enable-egress-ip=true --enable-egress-firewall=true --enable-egress-qos=true --enable-egress-service=true"`
18-
- `multi_external_gateway_enable_flag="--enable-multi-external-gateway=true"`
1910

2011
- `dpu-host`:
21-
- `gateway_interface="derive-from-mgmt-port"`
12+
- `gateway_interface="derive-from-mgmt-port"` ([ovn-kubernetes#5327](https://github.com/ovn-kubernetes/ovn-kubernetes/pull/5327))
2213
- `ovnkube_node_mode="--ovnkube-node-mode dpu-host"`
2314
- `init_ovnkube_controller=""` (disabled)
24-
- `enable_multicast_flag=""` (disabled)
25-
- `egress_features_enable_flag=""` (egress IP and related features disabled)
26-
- `multi_external_gateway_enable_flag=""` (multi-external gateway disabled)
27-
- Multi-network, network segmentation, and multi-network policy/admin network policy are gated and not enabled in this mode.
28-
29-
### Manifests
30-
31-
- `ovnkube-node.yaml` (managed and self-hosted) now inject `OVN_NODE_MODE` into the Pod env so the script can apply mode-aware logic.
32-
- `ovnkube-control-plane.yaml` (managed and self-hosted) have feature flags moved from ConfigMap to inline script logic.
33-
- `004-config.yaml` drops hard-coded feature enables that conflict with per-node enforcement.
34-
35-
**Note**: Control-plane components always run in "full" mode since they don't run on DPU hosts and need all features enabled for cluster coordination. Always-enabled features (egress, multicast, multi-external-gateway) are added directly to the command line, while conditional features use script variables.
36-
37-
### Implementation Details
38-
39-
#### Environment Variable Injection
40-
41-
The `OVN_NODE_MODE` environment variable is injected into `ovnkube-node` pods through the DaemonSet specification in both managed and self-hosted variants:
42-
43-
- `bindata/network/ovn-kubernetes/managed/ovnkube-node.yaml`
44-
- `bindata/network/ovn-kubernetes/self-hosted/ovnkube-node.yaml`
45-
46-
The value is typically derived from node labels or annotations that identify the node's hardware type.
47-
48-
#### Script Logic Flow
49-
50-
The startup script (`008-script-lib.yaml`) implements the following conditional logic:
51-
52-
```bash
53-
if [[ "${OVN_NODE_MODE}" != "dpu-host" ]]; then
54-
# Enable features for full mode
55-
egress_ip_enable_flag="--enable-egress-ip=true --enable-egress-firewall=true --enable-egress-qos=true --enable-egress-service=true"
56-
enable_multicast_flag="--enable-multicast"
57-
# ... other feature flags
58-
else
59-
# DPU host mode - disable features
60-
egress_ip_enable_flag=""
61-
enable_multicast_flag=""
62-
gateway_interface="derive-from-mgmt-port"
63-
ovnkube_node_mode="--ovnkube-node-mode dpu-host"
64-
fi
65-
```
66-
67-
#### Feature Flag Mapping
68-
69-
The following table shows how cluster-wide configuration translates to per-node enforcement:
70-
71-
| Feature | ConfigMap (004-config.yaml) | Script Variable | DPU Host Behavior |
72-
|---------|----------------------------|-----------------|-------------------|
73-
| Egress IP | `enable-egress-ip=true` | `egress_features_enable_flag` | Force disabled |
74-
| Multicast | `enable-multicast=true` | `enable_multicast_flag` | Force disabled |
75-
| Multi External Gateway | `enable-multi-external-gateway=true` | `multi_external_gateway_enable_flag` | Force disabled |
76-
| Multi-network | `enable-multi-network=true` | `multi_network_enabled_flag` | Conditionally disabled |
77-
| Admin Network Policy | `enable-admin-network-policy=true` | `admin_network_policy_enabled_flag` | Conditionally disabled |
78-
| Network Segmentation | `enable-network-segmentation=true` | `network_segmentation_enabled_flag` | Conditionally disabled |
79-
80-
### Testing
81-
82-
- Unit tests assert that the rendered script contains the correct assignments for `gateway_interface`, `init_ovnkube_controller`, `enable_multicast_flag`, `egress_features_enable_flag`, and `ovnkube_node_mode` across modes.
83-
- The comprehensive test `TestOVNKubernetesScriptLibCombined` validates all conditional logic paths and feature flag assignments for node scripts.
84-
- The test `TestOVNKubernetesControlPlaneFlags` validates that control-plane scripts have:
85-
- Always-enabled features added directly to the command line (egress, multicast, multi-external-gateway)
86-
- Conditional features handled via script variables (multi-network, network policies, etc.)
87-
- Correct multi-network enablement logic (OVN_MULTI_NETWORK_ENABLE)
88-
- Tests verify both positive cases (features enabled in full mode) and negative cases (features disabled in DPU host mode).
89-
90-
### Migration Notes
91-
92-
When upgrading clusters that previously relied on ConfigMap-based feature control:
93-
94-
1. Existing ConfigMap values in `004-config.yaml` have been removed for features that require per-node control
95-
2. The startup scripts (both node and control-plane) now contain the authoritative feature enablement logic
96-
3. Control-plane components automatically enable all features (always run in "full" mode)
97-
4. DPU host nodes will automatically have incompatible features disabled regardless of previous ConfigMap settings
98-
5. No manual intervention is required - the migration is handled automatically during the upgrade process
9915

16+
### Feature configuration
10017

18+
Feature enablement (egress IP, multicast, multi-network, network segmentation, admin network policy, etc.) is managed through the cluster-wide ConfigMap (`004-config.yaml`) which is passed to ovnkube via `--config-file`. These features are not gated per node mode.

0 commit comments

Comments
 (0)