From 1fc1b752af685097dc8e829191780dd01c584e4b Mon Sep 17 00:00:00 2001 From: Surya Seetharaman Date: Fri, 3 Jul 2026 14:51:02 +0200 Subject: [PATCH] Revert "[release-4.22] OCPBUGS-90721: NVIDIA-596: Enable dpu healthcheck" --- bindata/network/multus/multus.yaml | 2 +- .../ovn-kubernetes/common/008-script-lib.yaml | 13 +- .../ovn-kubernetes/managed/ovnkube-node.yaml | 6 - .../self-hosted/ovnkube-node.yaml | 6 - hack/hardware-offload-config.yaml | 2 - pkg/bootstrap/types.go | 26 +- pkg/network/kube_proxy_test.go | 10 +- pkg/network/ovn_kubernetes.go | 45 +-- pkg/network/ovn_kubernetes_dpu_host_test.go | 91 ------ pkg/network/ovn_kubernetes_test.go | 294 +++++------------- 10 files changed, 94 insertions(+), 401 deletions(-) diff --git a/bindata/network/multus/multus.yaml b/bindata/network/multus/multus.yaml index bf83306222..e5a54c2657 100644 --- a/bindata/network/multus/multus.yaml +++ b/bindata/network/multus/multus.yaml @@ -134,7 +134,7 @@ metadata: data: daemon-config.json: | { - "cniVersion": "1.1.0", + "cniVersion": "0.3.1", "chrootDir": "/hostroot", "logToStderr": true, "logLevel": "verbose", diff --git a/bindata/network/ovn-kubernetes/common/008-script-lib.yaml b/bindata/network/ovn-kubernetes/common/008-script-lib.yaml index a839111c05..8276c773d5 100644 --- a/bindata/network/ovn-kubernetes/common/008-script-lib.yaml +++ b/bindata/network/ovn-kubernetes/common/008-script-lib.yaml @@ -540,9 +540,6 @@ data: # Ensure allow_icmp_network_policy_flag is always defined allow_icmp_network_policy_flag= - # Ensure dpu_lease_flags is always defined - dpu_lease_flags= - if [[ $# -ne 3 ]]; then echo "Expected three arguments but got $#" exit 1 @@ -588,13 +585,6 @@ data: fi - if [[ -n "${OVNKUBE_NODE_LEASE_RENEW_INTERVAL}" ]]; then - dpu_lease_flags="--dpu-node-lease-renew-interval ${OVNKUBE_NODE_LEASE_RENEW_INTERVAL}" - fi - if [[ -n "${OVNKUBE_NODE_LEASE_DURATION}" ]]; then - dpu_lease_flags="${dpu_lease_flags} --dpu-node-lease-duration ${OVNKUBE_NODE_LEASE_DURATION}" - fi - if [ "{{.OVN_GATEWAY_MODE}}" == "shared" ]; then gateway_mode_flags="--gateway-mode shared --gateway-interface ${gateway_interface}" elif [ "{{.OVN_GATEWAY_MODE}}" == "local" ]; then @@ -756,6 +746,5 @@ data: ${ovn_v4_masquerade_subnet_opt} \ ${ovn_v6_masquerade_subnet_opt} \ ${ovn_v4_transit_switch_subnet_opt} \ - ${ovn_v6_transit_switch_subnet_opt} \ - ${dpu_lease_flags} + ${ovn_v6_transit_switch_subnet_opt} } diff --git a/bindata/network/ovn-kubernetes/managed/ovnkube-node.yaml b/bindata/network/ovn-kubernetes/managed/ovnkube-node.yaml index f26e34709e..741cf76122 100644 --- a/bindata/network/ovn-kubernetes/managed/ovnkube-node.yaml +++ b/bindata/network/ovn-kubernetes/managed/ovnkube-node.yaml @@ -437,12 +437,6 @@ spec: - name: OVNKUBE_NODE_MGMT_PORT_DP_RESOURCE_NAME value: {{ .MgmtPortResourceName }} {{ end }} - {{ if or (eq .OVN_NODE_MODE "dpu-host") (eq .OVN_NODE_MODE "dpu") }} - - name: OVNKUBE_NODE_LEASE_RENEW_INTERVAL - value: "{{.DpuNodeLeaseRenewInterval}}" - - name: OVNKUBE_NODE_LEASE_DURATION - value: "{{.DpuNodeLeaseDuration}}" - {{ end }} {{ if .HTTP_PROXY }} - name: "HTTP_PROXY" value: "{{ .HTTP_PROXY}}" diff --git a/bindata/network/ovn-kubernetes/self-hosted/ovnkube-node.yaml b/bindata/network/ovn-kubernetes/self-hosted/ovnkube-node.yaml index 18f52c983c..2dc8148f42 100644 --- a/bindata/network/ovn-kubernetes/self-hosted/ovnkube-node.yaml +++ b/bindata/network/ovn-kubernetes/self-hosted/ovnkube-node.yaml @@ -473,12 +473,6 @@ spec: - name: OVNKUBE_NODE_MGMT_PORT_DP_RESOURCE_NAME value: {{ .MgmtPortResourceName }} {{ end }} - {{ if or (eq .OVN_NODE_MODE "dpu-host") (eq .OVN_NODE_MODE "dpu") }} - - name: OVNKUBE_NODE_LEASE_RENEW_INTERVAL - value: "{{.DpuNodeLeaseRenewInterval}}" - - name: OVNKUBE_NODE_LEASE_DURATION - value: "{{.DpuNodeLeaseDuration}}" - {{ end }} - name: K8S_NODE valueFrom: fieldRef: diff --git a/hack/hardware-offload-config.yaml b/hack/hardware-offload-config.yaml index 1c8f2645fe..0805bcad89 100644 --- a/hack/hardware-offload-config.yaml +++ b/hack/hardware-offload-config.yaml @@ -12,5 +12,3 @@ data: dpu-mode-label: "network.operator.openshift.io/dpu=" smart-nic-mode-label: "network.operator.openshift.io/smart-nic=" mgmt-port-resource-name: "openshift.io/mgmtvf" - dpu-node-lease-renew-interval: "10" - dpu-node-lease-duration: "40" diff --git a/pkg/bootstrap/types.go b/pkg/bootstrap/types.go index 2df2153acc..1eec6429fe 100644 --- a/pkg/bootstrap/types.go +++ b/pkg/bootstrap/types.go @@ -30,20 +30,18 @@ type OVNHyperShiftBootstrapResult struct { } type OVNConfigBoostrapResult struct { - GatewayMode string - HyperShiftConfig *OVNHyperShiftBootstrapResult - DisableUDPAggregation bool - DpuHostModeLabel string - DpuHostModeNodes []string - DpuHostModeValue string - DpuModeLabel string - DpuModeNodes []string - SmartNicModeLabel string - SmartNicModeNodes []string - SmartNicModeValue string - MgmtPortResourceName string - DpuNodeLeaseRenewInterval int - DpuNodeLeaseDuration int + GatewayMode string + HyperShiftConfig *OVNHyperShiftBootstrapResult + DisableUDPAggregation bool + DpuHostModeLabel string + DpuHostModeNodes []string + DpuHostModeValue string + DpuModeLabel string + DpuModeNodes []string + SmartNicModeLabel string + SmartNicModeNodes []string + SmartNicModeValue string + MgmtPortResourceName string // ConfigOverrides contains the overrides for the OVN Kubernetes configuration // This is used to set the hidden OVN Kubernetes configuration in the cluster // It is a map of key-value pairs where the key is the configuration option and the diff --git a/pkg/network/kube_proxy_test.go b/pkg/network/kube_proxy_test.go index 2b078f06dd..544f67f7a2 100644 --- a/pkg/network/kube_proxy_test.go +++ b/pkg/network/kube_proxy_test.go @@ -374,12 +374,10 @@ func TestFillKubeProxyDefaults(t *testing.T) { var FakeKubeProxyBootstrapResult = bootstrap.BootstrapResult{ OVN: bootstrap.OVNBootstrapResult{ OVNKubernetesConfig: &bootstrap.OVNConfigBoostrapResult{ - DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, - DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, - SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, - MgmtPortResourceName: "", - DpuNodeLeaseRenewInterval: DPU_NODE_LEASE_RENEW_INTERVAL_DEFAULT, - DpuNodeLeaseDuration: DPU_NODE_LEASE_DURATION_DEFAULT, + DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, + DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, + SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, + MgmtPortResourceName: "", }, }, } diff --git a/pkg/network/ovn_kubernetes.go b/pkg/network/ovn_kubernetes.go index c8cbc8df46..ba84300005 100644 --- a/pkg/network/ovn_kubernetes.go +++ b/pkg/network/ovn_kubernetes.go @@ -65,11 +65,6 @@ const OVN_NODE_SELECTOR_DEFAULT_DPU = "network.operator.openshift.io/dpu=" const OVN_NODE_SELECTOR_DEFAULT_SMART_NIC = "network.operator.openshift.io/smart-nic=" const OVN_NODE_IDENTITY_CERT_DURATION = "24h" -// Default DPU health check lease configuration. -// Setting renew-interval to 0 disables the health check. -const DPU_NODE_LEASE_RENEW_INTERVAL_DEFAULT = 10 -const DPU_NODE_LEASE_DURATION_DEFAULT = 40 - // gRPC healthcheck port. See: https://github.com/openshift/enhancements/pull/1209 const OVN_EGRESSIP_HEALTHCHECK_PORT = "9107" @@ -237,8 +232,6 @@ func renderOVNKubernetes(conf *operv1.NetworkSpec, bootstrapResult *bootstrap.Bo data.Data["SmartNicModeLabel"] = bootstrapResult.OVN.OVNKubernetesConfig.SmartNicModeLabel data.Data["SmartNicModeValue"] = bootstrapResult.OVN.OVNKubernetesConfig.SmartNicModeValue data.Data["MgmtPortResourceName"] = bootstrapResult.OVN.OVNKubernetesConfig.MgmtPortResourceName - data.Data["DpuNodeLeaseRenewInterval"] = strconv.Itoa(bootstrapResult.OVN.OVNKubernetesConfig.DpuNodeLeaseRenewInterval) - data.Data["DpuNodeLeaseDuration"] = strconv.Itoa(bootstrapResult.OVN.OVNKubernetesConfig.DpuNodeLeaseDuration) data.Data["OVN_CONTROLLER_INACTIVITY_PROBE"] = os.Getenv("OVN_CONTROLLER_INACTIVITY_PROBE") controller_inactivity_probe := os.Getenv("OVN_CONTROLLER_INACTIVITY_PROBE") if len(controller_inactivity_probe) == 0 { @@ -1017,12 +1010,10 @@ func findCommonNode(nodeLists ...[]string) (bool, string) { // if it exists, otherwise returns default configuration for OCP clusters using OVN-Kubernetes func bootstrapOVNConfig(conf *operv1.Network, kubeClient cnoclient.Client, hc *hypershift.HyperShiftConfig, infraStatus *bootstrap.InfraStatus) (*bootstrap.OVNConfigBoostrapResult, error) { ovnConfigResult := &bootstrap.OVNConfigBoostrapResult{ - DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, - DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, - SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, - MgmtPortResourceName: "", - DpuNodeLeaseRenewInterval: DPU_NODE_LEASE_RENEW_INTERVAL_DEFAULT, - DpuNodeLeaseDuration: DPU_NODE_LEASE_DURATION_DEFAULT, + DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, + DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, + SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, + MgmtPortResourceName: "", } if conf.Spec.DefaultNetwork.OVNKubernetesConfig.GatewayConfig == nil { bootstrapOVNGatewayConfig(conf, kubeClient.ClientFor("").CRClient()) @@ -1068,34 +1059,6 @@ func bootstrapOVNConfig(conf *operv1.Network, kubeClient cnoclient.Client, hc *h if exists { ovnConfigResult.MgmtPortResourceName = mgmtPortresourceName } - - if val, exists := cm.Data["dpu-node-lease-renew-interval"]; exists { - parsed, err := strconv.Atoi(val) - if err == nil && parsed >= 0 { - ovnConfigResult.DpuNodeLeaseRenewInterval = parsed - } else { - klog.Warningf("Invalid dpu-node-lease-renew-interval %q, using default %d", val, DPU_NODE_LEASE_RENEW_INTERVAL_DEFAULT) - } - } - if val, exists := cm.Data["dpu-node-lease-duration"]; exists { - parsed, err := strconv.Atoi(val) - if err == nil && parsed > 0 { - ovnConfigResult.DpuNodeLeaseDuration = parsed - } else { - klog.Warningf("Invalid dpu-node-lease-duration %q (must be > 0), using default %d", val, DPU_NODE_LEASE_DURATION_DEFAULT) - } - } - - // Setting renew-interval to 0 disables the DPU health check. - // Duration must always be > 0 (required by ovn-kubernetes). - if ovnConfigResult.DpuNodeLeaseRenewInterval == 0 { - ovnConfigResult.DpuNodeLeaseDuration = DPU_NODE_LEASE_DURATION_DEFAULT - } else if ovnConfigResult.DpuNodeLeaseDuration <= ovnConfigResult.DpuNodeLeaseRenewInterval { - klog.Warningf("dpu-node-lease-duration (%d) must be greater than dpu-node-lease-renew-interval (%d), using defaults", - ovnConfigResult.DpuNodeLeaseDuration, ovnConfigResult.DpuNodeLeaseRenewInterval) - ovnConfigResult.DpuNodeLeaseRenewInterval = DPU_NODE_LEASE_RENEW_INTERVAL_DEFAULT - ovnConfigResult.DpuNodeLeaseDuration = DPU_NODE_LEASE_DURATION_DEFAULT - } } // We want to see if there are any nodes that are labeled for specific modes such as Full/SmartNIC/DPU Host/DPU diff --git a/pkg/network/ovn_kubernetes_dpu_host_test.go b/pkg/network/ovn_kubernetes_dpu_host_test.go index dc2fac195c..4efc33fb17 100644 --- a/pkg/network/ovn_kubernetes_dpu_host_test.go +++ b/pkg/network/ovn_kubernetes_dpu_host_test.go @@ -1,7 +1,6 @@ package network import ( - "strconv" "testing" "github.com/ghodss/yaml" @@ -161,8 +160,6 @@ func createTestRenderData(ovnNodeMode string) render.RenderData { data.Data["SmartNicModeValue"] = "" data.Data["DpuModeLabel"] = "" data.Data["MgmtPortResourceName"] = "" - data.Data["DpuNodeLeaseRenewInterval"] = strconv.Itoa(DPU_NODE_LEASE_RENEW_INTERVAL_DEFAULT) - data.Data["DpuNodeLeaseDuration"] = strconv.Itoa(DPU_NODE_LEASE_DURATION_DEFAULT) data.Data["HTTP_PROXY"] = "" data.Data["HTTPS_PROXY"] = "" data.Data["NO_PROXY"] = "" @@ -214,94 +211,6 @@ func getMatchExpression(g *WithT, ds *appsv1.DaemonSet, label string) (corev1.No return corev1.NodeSelectorOpDoesNotExist, "" } -// TestOVNKubernetesLeaseEnvVars tests that DPU lease env vars are set -// for DPU and DPU-host modes but not for full mode -func TestOVNKubernetesLeaseEnvVars(t *testing.T) { - templates := []struct { - name string - templatePath string - }{ - { - name: "managed", - templatePath: "../../bindata/network/ovn-kubernetes/managed/ovnkube-node.yaml", - }, - { - name: "self-hosted", - templatePath: "../../bindata/network/ovn-kubernetes/self-hosted/ovnkube-node.yaml", - }, - } - - testCases := []struct { - name string - ovnNodeMode string - expectSet bool - }{ - { - name: "full mode should not have lease env vars", - ovnNodeMode: "full", - expectSet: false, - }, - { - name: "dpu-host mode should have lease env vars", - ovnNodeMode: "dpu-host", - expectSet: true, - }, - { - name: "dpu mode should have lease env vars", - ovnNodeMode: "dpu", - expectSet: true, - }, - } - - // Env vars with literal values - leaseEnvVars := map[string]string{ - "OVNKUBE_NODE_LEASE_RENEW_INTERVAL": strconv.Itoa(DPU_NODE_LEASE_RENEW_INTERVAL_DEFAULT), - "OVNKUBE_NODE_LEASE_DURATION": strconv.Itoa(DPU_NODE_LEASE_DURATION_DEFAULT), - } - for _, template := range templates { - for _, tc := range testCases { - testName := template.name + "_" + tc.name - t.Run(testName, func(t *testing.T) { - g := NewGomegaWithT(t) - - data := createTestRenderData(tc.ovnNodeMode) - - objs, err := render.RenderTemplate(template.templatePath, &data) - g.Expect(err).NotTo(HaveOccurred()) - g.Expect(objs).To(HaveLen(1)) - - yamlBytes, err := yaml.Marshal(objs[0]) - g.Expect(err).NotTo(HaveOccurred()) - - ds := &appsv1.DaemonSet{} - err = yaml.Unmarshal(yamlBytes, ds) - g.Expect(err).NotTo(HaveOccurred()) - - for envName, expectedValue := range leaseEnvVars { - found := false - for _, container := range ds.Spec.Template.Spec.Containers { - for _, env := range container.Env { - if env.Name == envName { - found = true - g.Expect(env.Value).To(Equal(expectedValue), - "%s should be set to %s", envName, expectedValue) - } - } - } - - if tc.expectSet { - g.Expect(found).To(BeTrue(), - "%s should be set for %s mode", envName, tc.ovnNodeMode) - } else { - g.Expect(found).To(BeFalse(), - "%s should not be set for %s mode", envName, tc.ovnNodeMode) - } - } - }) - } - } -} - // TestOVNKubernetesNodeSelectorOperator tests that the node selector operator works correctly with label values of different Full/SmartNIC/DPU modes func TestOVNKubernetesNodeSelectorOperator(t *testing.T) { templates := []struct { diff --git a/pkg/network/ovn_kubernetes_test.go b/pkg/network/ovn_kubernetes_test.go index 6c06d16f16..e091eff928 100644 --- a/pkg/network/ovn_kubernetes_test.go +++ b/pkg/network/ovn_kubernetes_test.go @@ -97,12 +97,10 @@ func TestRenderOVNKubernetes(t *testing.T) { bootstrapResult.OVN = bootstrap.OVNBootstrapResult{ ControlPlaneReplicaCount: 3, OVNKubernetesConfig: &bootstrap.OVNConfigBoostrapResult{ - DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, - DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, - SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, - MgmtPortResourceName: "", - DpuNodeLeaseRenewInterval: DPU_NODE_LEASE_RENEW_INTERVAL_DEFAULT, - DpuNodeLeaseDuration: DPU_NODE_LEASE_DURATION_DEFAULT, + DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, + DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, + SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, + MgmtPortResourceName: "", HyperShiftConfig: &bootstrap.OVNHyperShiftBootstrapResult{ Enabled: false, }, @@ -223,12 +221,10 @@ func TestRenderOVNKubernetesIPv6(t *testing.T) { bootstrapResult.OVN = bootstrap.OVNBootstrapResult{ ControlPlaneReplicaCount: 3, OVNKubernetesConfig: &bootstrap.OVNConfigBoostrapResult{ - DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, - DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, - SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, - MgmtPortResourceName: "", - DpuNodeLeaseRenewInterval: DPU_NODE_LEASE_RENEW_INTERVAL_DEFAULT, - DpuNodeLeaseDuration: DPU_NODE_LEASE_DURATION_DEFAULT, + DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, + DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, + SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, + MgmtPortResourceName: "", HyperShiftConfig: &bootstrap.OVNHyperShiftBootstrapResult{ Enabled: false, }, @@ -246,12 +242,10 @@ func TestRenderOVNKubernetesIPv6(t *testing.T) { bootstrapResult.OVN = bootstrap.OVNBootstrapResult{ ControlPlaneReplicaCount: 3, OVNKubernetesConfig: &bootstrap.OVNConfigBoostrapResult{ - DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, - DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, - SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, - MgmtPortResourceName: "", - DpuNodeLeaseRenewInterval: DPU_NODE_LEASE_RENEW_INTERVAL_DEFAULT, - DpuNodeLeaseDuration: DPU_NODE_LEASE_DURATION_DEFAULT, + DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, + DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, + SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, + MgmtPortResourceName: "", HyperShiftConfig: &bootstrap.OVNHyperShiftBootstrapResult{ Enabled: false, }, @@ -1042,12 +1036,10 @@ logfile-maxage=0`, bootstrapResult.OVN = bootstrap.OVNBootstrapResult{ ControlPlaneReplicaCount: tc.controlPlaneReplicaCount, OVNKubernetesConfig: &bootstrap.OVNConfigBoostrapResult{ - DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, - DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, - SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, - MgmtPortResourceName: "", - DpuNodeLeaseRenewInterval: DPU_NODE_LEASE_RENEW_INTERVAL_DEFAULT, - DpuNodeLeaseDuration: DPU_NODE_LEASE_DURATION_DEFAULT, + DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, + DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, + SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, + MgmtPortResourceName: "", HyperShiftConfig: &bootstrap.OVNHyperShiftBootstrapResult{ Enabled: false, }, @@ -2246,12 +2238,10 @@ status: ControlPlaneUpdateStatus: controlPlaneStatus, NodeUpdateStatus: nodeStatus, OVNKubernetesConfig: &bootstrap.OVNConfigBoostrapResult{ - DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, - DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, - SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, - MgmtPortResourceName: "", - DpuNodeLeaseRenewInterval: DPU_NODE_LEASE_RENEW_INTERVAL_DEFAULT, - DpuNodeLeaseDuration: DPU_NODE_LEASE_DURATION_DEFAULT, + DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, + DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, + SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, + MgmtPortResourceName: "", HyperShiftConfig: &bootstrap.OVNHyperShiftBootstrapResult{ Enabled: false, }, @@ -2553,12 +2543,10 @@ func TestRenderOVNKubernetesEnableIPsec(t *testing.T) { IPFamilyMode: names.IPFamilySingleStack, }, OVNKubernetesConfig: &bootstrap.OVNConfigBoostrapResult{ - DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, - DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, - SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, - MgmtPortResourceName: "", - DpuNodeLeaseRenewInterval: DPU_NODE_LEASE_RENEW_INTERVAL_DEFAULT, - DpuNodeLeaseDuration: DPU_NODE_LEASE_DURATION_DEFAULT, + DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, + DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, + SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, + MgmtPortResourceName: "", HyperShiftConfig: &bootstrap.OVNHyperShiftBootstrapResult{ Enabled: false, }, @@ -2782,12 +2770,10 @@ func TestRenderOVNKubernetesEnableIPsecForHostedControlPlane(t *testing.T) { IPFamilyMode: names.IPFamilySingleStack, }, OVNKubernetesConfig: &bootstrap.OVNConfigBoostrapResult{ - DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, - DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, - SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, - MgmtPortResourceName: "", - DpuNodeLeaseRenewInterval: DPU_NODE_LEASE_RENEW_INTERVAL_DEFAULT, - DpuNodeLeaseDuration: DPU_NODE_LEASE_DURATION_DEFAULT, + DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, + DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, + SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, + MgmtPortResourceName: "", HyperShiftConfig: &bootstrap.OVNHyperShiftBootstrapResult{ Enabled: false, }, @@ -2885,12 +2871,10 @@ func TestRenderOVNKubernetesIPsecUpgradeWithMachineConfig(t *testing.T) { IsOVNIPsecActiveOrRollingOut: true, }, OVNKubernetesConfig: &bootstrap.OVNConfigBoostrapResult{ - DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, - DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, - SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, - MgmtPortResourceName: "", - DpuNodeLeaseRenewInterval: DPU_NODE_LEASE_RENEW_INTERVAL_DEFAULT, - DpuNodeLeaseDuration: DPU_NODE_LEASE_DURATION_DEFAULT, + DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, + DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, + SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, + MgmtPortResourceName: "", HyperShiftConfig: &bootstrap.OVNHyperShiftBootstrapResult{ Enabled: false, }, @@ -2999,12 +2983,10 @@ func TestRenderOVNKubernetesIPsecUpgradeWithNoMachineConfig(t *testing.T) { IsOVNIPsecActiveOrRollingOut: true, }, OVNKubernetesConfig: &bootstrap.OVNConfigBoostrapResult{ - DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, - DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, - SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, - MgmtPortResourceName: "", - DpuNodeLeaseRenewInterval: DPU_NODE_LEASE_RENEW_INTERVAL_DEFAULT, - DpuNodeLeaseDuration: DPU_NODE_LEASE_DURATION_DEFAULT, + DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, + DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, + SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, + MgmtPortResourceName: "", HyperShiftConfig: &bootstrap.OVNHyperShiftBootstrapResult{ Enabled: false, }, @@ -3149,12 +3131,10 @@ func TestRenderOVNKubernetesIPsecUpgradeWithHypershiftHostedCluster(t *testing.T IsOVNIPsecActiveOrRollingOut: true, }, OVNKubernetesConfig: &bootstrap.OVNConfigBoostrapResult{ - DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, - DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, - SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, - MgmtPortResourceName: "", - DpuNodeLeaseRenewInterval: DPU_NODE_LEASE_RENEW_INTERVAL_DEFAULT, - DpuNodeLeaseDuration: DPU_NODE_LEASE_DURATION_DEFAULT, + DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, + DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, + SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, + MgmtPortResourceName: "", HyperShiftConfig: &bootstrap.OVNHyperShiftBootstrapResult{ Enabled: false, }, @@ -3254,12 +3234,10 @@ func TestRenderOVNKubernetesDisableIPsec(t *testing.T) { IsOVNIPsecActiveOrRollingOut: true, }, OVNKubernetesConfig: &bootstrap.OVNConfigBoostrapResult{ - DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, - DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, - SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, - MgmtPortResourceName: "", - DpuNodeLeaseRenewInterval: DPU_NODE_LEASE_RENEW_INTERVAL_DEFAULT, - DpuNodeLeaseDuration: DPU_NODE_LEASE_DURATION_DEFAULT, + DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, + DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, + SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, + MgmtPortResourceName: "", HyperShiftConfig: &bootstrap.OVNHyperShiftBootstrapResult{ Enabled: false, }, @@ -3466,12 +3444,10 @@ func TestRenderOVNKubernetesEnableIPsecWithUserInstalledIPsecMachineConfigs(t *t IPFamilyMode: names.IPFamilySingleStack, }, OVNKubernetesConfig: &bootstrap.OVNConfigBoostrapResult{ - DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, - DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, - SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, - MgmtPortResourceName: "", - DpuNodeLeaseRenewInterval: DPU_NODE_LEASE_RENEW_INTERVAL_DEFAULT, - DpuNodeLeaseDuration: DPU_NODE_LEASE_DURATION_DEFAULT, + DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, + DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, + SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, + MgmtPortResourceName: "", HyperShiftConfig: &bootstrap.OVNHyperShiftBootstrapResult{ Enabled: false, }, @@ -3614,12 +3590,10 @@ func TestRenderOVNKubernetesDisableIPsecWithUserInstalledIPsecMachineConfigs(t * IsOVNIPsecActiveOrRollingOut: true, }, OVNKubernetesConfig: &bootstrap.OVNConfigBoostrapResult{ - DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, - DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, - SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, - MgmtPortResourceName: "", - DpuNodeLeaseRenewInterval: DPU_NODE_LEASE_RENEW_INTERVAL_DEFAULT, - DpuNodeLeaseDuration: DPU_NODE_LEASE_DURATION_DEFAULT, + DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, + DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, + SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, + MgmtPortResourceName: "", HyperShiftConfig: &bootstrap.OVNHyperShiftBootstrapResult{ Enabled: false, }, @@ -3755,12 +3729,10 @@ func TestRenderOVNKubernetesDualStackPrecedenceOverUpgrade(t *testing.T) { IPFamilyMode: names.IPFamilySingleStack, }, OVNKubernetesConfig: &bootstrap.OVNConfigBoostrapResult{ - DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, - DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, - SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, - MgmtPortResourceName: "", - DpuNodeLeaseRenewInterval: DPU_NODE_LEASE_RENEW_INTERVAL_DEFAULT, - DpuNodeLeaseDuration: DPU_NODE_LEASE_DURATION_DEFAULT, + DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, + DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, + SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, + MgmtPortResourceName: "", HyperShiftConfig: &bootstrap.OVNHyperShiftBootstrapResult{ Enabled: false, }, @@ -4000,12 +3972,10 @@ func TestRenderOVNKubernetesEnablePersistentIPs(t *testing.T) { bootstrapResult.OVN = bootstrap.OVNBootstrapResult{ ControlPlaneReplicaCount: 3, OVNKubernetesConfig: &bootstrap.OVNConfigBoostrapResult{ - DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, - DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, - SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, - MgmtPortResourceName: "", - DpuNodeLeaseRenewInterval: DPU_NODE_LEASE_RENEW_INTERVAL_DEFAULT, - DpuNodeLeaseDuration: DPU_NODE_LEASE_DURATION_DEFAULT, + DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, + DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, + SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, + MgmtPortResourceName: "", HyperShiftConfig: &bootstrap.OVNHyperShiftBootstrapResult{ Enabled: false, }, @@ -4180,12 +4150,10 @@ func Test_renderOVNKubernetes(t *testing.T) { bootstrapResult.OVN = bootstrap.OVNBootstrapResult{ ControlPlaneReplicaCount: 3, OVNKubernetesConfig: &bootstrap.OVNConfigBoostrapResult{ - DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, - DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, - SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, - MgmtPortResourceName: "", - DpuNodeLeaseRenewInterval: DPU_NODE_LEASE_RENEW_INTERVAL_DEFAULT, - DpuNodeLeaseDuration: DPU_NODE_LEASE_DURATION_DEFAULT, + DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, + DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, + SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, + MgmtPortResourceName: "", HyperShiftConfig: &bootstrap.OVNHyperShiftBootstrapResult{ Enabled: false, }, @@ -4323,12 +4291,10 @@ func TestRenderOVNKubernetes_AdvertisedUDNIsolationModeOverride(t *testing.T) { bootstrapResult.OVN = bootstrap.OVNBootstrapResult{ ControlPlaneReplicaCount: 3, OVNKubernetesConfig: &bootstrap.OVNConfigBoostrapResult{ - DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, - DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, - SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, - MgmtPortResourceName: "", - DpuNodeLeaseRenewInterval: DPU_NODE_LEASE_RENEW_INTERVAL_DEFAULT, - DpuNodeLeaseDuration: DPU_NODE_LEASE_DURATION_DEFAULT, + DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, + DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, + SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, + MgmtPortResourceName: "", HyperShiftConfig: &bootstrap.OVNHyperShiftBootstrapResult{ Enabled: false, }, @@ -4366,12 +4332,10 @@ func TestRenderOVNKubernetes_OpenFlowProbeOverride(t *testing.T) { bootstrapResult.OVN = bootstrap.OVNBootstrapResult{ ControlPlaneReplicaCount: 3, OVNKubernetesConfig: &bootstrap.OVNConfigBoostrapResult{ - DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, - DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, - SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, - MgmtPortResourceName: "", - DpuNodeLeaseRenewInterval: DPU_NODE_LEASE_RENEW_INTERVAL_DEFAULT, - DpuNodeLeaseDuration: DPU_NODE_LEASE_DURATION_DEFAULT, + DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, + DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, + SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, + MgmtPortResourceName: "", HyperShiftConfig: &bootstrap.OVNHyperShiftBootstrapResult{ Enabled: false, }, @@ -4780,85 +4744,6 @@ func TestRenderOVNKubernetesNoOverlay(t *testing.T) { } } -func TestDpuLeaseConfig(t *testing.T) { - for _, tc := range []struct { - name string - leaseRenewInterval int - leaseDuration int - expectedRenewInterval string - expectedDuration string - expectPresent bool - }{ - { - name: "custom values are rendered", - leaseRenewInterval: 15, - leaseDuration: 60, - expectedRenewInterval: "15", - expectedDuration: "60", - expectPresent: true, - }, - { - name: "defaults are rendered", - leaseRenewInterval: DPU_NODE_LEASE_RENEW_INTERVAL_DEFAULT, - leaseDuration: DPU_NODE_LEASE_DURATION_DEFAULT, - expectedRenewInterval: "10", - expectedDuration: "40", - expectPresent: true, - }, - { - name: "zero renew interval disables health check", - leaseRenewInterval: 0, - leaseDuration: DPU_NODE_LEASE_DURATION_DEFAULT, - expectedRenewInterval: "0", - expectedDuration: strconv.Itoa(DPU_NODE_LEASE_DURATION_DEFAULT), - expectPresent: true, - }, - } { - t.Run(tc.name, func(t *testing.T) { - g := NewGomegaWithT(t) - - crd := OVNKubernetesConfig.DeepCopy() - config := &crd.Spec - errs := validateOVNKubernetes(config) - g.Expect(errs).To(HaveLen(0)) - fillDefaults(config, nil) - - bootstrapResult := fakeBootstrapResult() - bootstrapResult.OVN = bootstrap.OVNBootstrapResult{ - ControlPlaneReplicaCount: 3, - OVNKubernetesConfig: &bootstrap.OVNConfigBoostrapResult{ - DpuHostModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU_HOST, - DpuModeLabel: OVN_NODE_SELECTOR_DEFAULT_DPU, - SmartNicModeLabel: OVN_NODE_SELECTOR_DEFAULT_SMART_NIC, - MgmtPortResourceName: "", - DpuNodeLeaseRenewInterval: tc.leaseRenewInterval, - DpuNodeLeaseDuration: tc.leaseDuration, - DpuHostModeNodes: []string{"dpu-host-node-1"}, - HyperShiftConfig: &bootstrap.OVNHyperShiftBootstrapResult{ - Enabled: false, - }, - }, - } - - featureGatesCNO := getDefaultFeatureGates() - fakeClient := cnofake.NewFakeClient() - objs, _, err := renderOVNKubernetes(config, bootstrapResult, manifestDirOvn, fakeClient, featureGatesCNO) - g.Expect(err).NotTo(HaveOccurred()) - - envVars := extractDaemonSetEnvVars(g, objs, "ovnkube-node-dpu-host", "ovnkube-controller") - if tc.expectPresent { - g.Expect(envVars["OVNKUBE_NODE_LEASE_RENEW_INTERVAL"]).To(Equal(tc.expectedRenewInterval)) - g.Expect(envVars["OVNKUBE_NODE_LEASE_DURATION"]).To(Equal(tc.expectedDuration)) - } else { - _, hasInterval := envVars["OVNKUBE_NODE_LEASE_RENEW_INTERVAL"] - _, hasDuration := envVars["OVNKUBE_NODE_LEASE_DURATION"] - g.Expect(hasInterval).To(BeFalse(), "OVNKUBE_NODE_LEASE_RENEW_INTERVAL should not be set when disabled") - g.Expect(hasDuration).To(BeFalse(), "OVNKUBE_NODE_LEASE_DURATION should not be set when disabled") - } - }) - } -} - // TestFillOVNKubernetesDefaultsMTUNoOverlay tests that MTU is set correctly for no-overlay mode func TestFillOVNKubernetesDefaultsMTUNoOverlay(t *testing.T) { g := NewGomegaWithT(t) @@ -4971,38 +4856,3 @@ func TestValidateMTUForNoOverlay(t *testing.T) { g.Expect(err).To(BeNil()) }) } - -// extractDaemonSetEnvVars finds a DaemonSet by name in the rendered objects and returns -// env vars for the specified container as a map. -func extractDaemonSetEnvVars(g *WithT, objs []*uns.Unstructured, dsName, containerName string) map[string]string { - envVars := map[string]string{} - for _, obj := range objs { - if obj.GetKind() != "DaemonSet" || obj.GetName() != dsName { - continue - } - containers, found, err := uns.NestedSlice(obj.Object, "spec", "template", "spec", "containers") - g.Expect(err).NotTo(HaveOccurred()) - g.Expect(found).To(BeTrue()) - for _, c := range containers { - cmap := c.(map[string]interface{}) - name, _, _ := uns.NestedString(cmap, "name") - if name != containerName { - continue - } - envList, found, err := uns.NestedSlice(cmap, "env") - g.Expect(err).NotTo(HaveOccurred()) - if !found { - return envVars - } - for _, e := range envList { - emap := e.(map[string]interface{}) - eName, _, _ := uns.NestedString(emap, "name") - eVal, _, _ := uns.NestedString(emap, "value") - envVars[eName] = eVal - } - return envVars - } - } - g.Expect(true).To(BeFalse(), "could not find DaemonSet %s with container %s", dsName, containerName) - return envVars -}