@@ -26,7 +26,6 @@ import (
2626 "github.com/pkg/errors"
2727 appsv1 "k8s.io/api/apps/v1"
2828 corev1 "k8s.io/api/core/v1"
29- v1 "k8s.io/api/core/v1"
3029 apierrors "k8s.io/apimachinery/pkg/api/errors"
3130 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3231 uns "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
@@ -97,7 +96,7 @@ func renderOVNKubernetes(conf *operv1.NetworkSpec, bootstrapResult *bootstrap.Bo
9796 // For now, return an error since we don't have any master nodes to run the ovnkube-control-plane deployment.
9897 externalControlPlane := bootstrapResult .Infra .ControlPlaneTopology == configv1 .ExternalTopologyMode
9998 if externalControlPlane && ! bootstrapResult .OVN .OVNKubernetesConfig .HyperShiftConfig .Enabled {
100- return nil , progressing , fmt .Errorf ("Unable to render OVN in a cluster with an external control plane" )
99+ return nil , progressing , fmt .Errorf ("unable to render OVN in a cluster with an external control plane" )
101100 }
102101
103102 c := conf .DefaultNetwork .OVNKubernetesConfig
@@ -941,7 +940,7 @@ func bootstrapOVNConfig(conf *operv1.Network, kubeClient cnoclient.Client, hc *h
941940
942941 if err != nil {
943942 if ! apierrors .IsNotFound (err ) {
944- return nil , fmt .Errorf ("Could not determine Node Mode: %w" , err )
943+ return nil , fmt .Errorf ("could not determine Node Mode: %w" , err )
945944 }
946945 } else {
947946 dpuHostModeLabel , exists := cm .Data ["dpu-host-mode-label" ]
@@ -981,40 +980,40 @@ func bootstrapOVNConfig(conf *operv1.Network, kubeClient cnoclient.Client, hc *h
981980 // daemonset pods in DPU mode from running), it is done by an external operator.
982981 ovnConfigResult .DpuHostModeNodes , err = getNodeListByLabel (kubeClient , ovnConfigResult .DpuHostModeLabel )
983982 if err != nil {
984- return nil , fmt .Errorf ("Could not get node list with label %s : %w" , ovnConfigResult .DpuHostModeLabel , err )
983+ return nil , fmt .Errorf ("could not get node list with label %s : %w" , ovnConfigResult .DpuHostModeLabel , err )
985984 }
986985 ovnConfigResult .DpuHostModeLabel , ovnConfigResult .DpuHostModeValue , err = getKeyValueFromLabel (ovnConfigResult .DpuHostModeLabel )
987986 if err != nil {
988- return nil , fmt .Errorf ("Could not get key and value from label %s : %w" , ovnConfigResult .DpuHostModeLabel , err )
987+ return nil , fmt .Errorf ("could not get key and value from label %s : %w" , ovnConfigResult .DpuHostModeLabel , err )
989988 }
990989
991990 ovnConfigResult .DpuModeNodes , err = getNodeListByLabel (kubeClient , ovnConfigResult .DpuModeLabel )
992991 if err != nil {
993- return nil , fmt .Errorf ("Could not get node list with label %s : %w" , ovnConfigResult .DpuModeLabel , err )
992+ return nil , fmt .Errorf ("could not get node list with label %s : %w" , ovnConfigResult .DpuModeLabel , err )
994993 }
995994 ovnConfigResult .DpuModeLabel , _ , err = getKeyValueFromLabel (ovnConfigResult .DpuModeLabel )
996995 if err != nil {
997- return nil , fmt .Errorf ("Could not get key and value from label %s : %w" , ovnConfigResult .DpuModeLabel , err )
996+ return nil , fmt .Errorf ("could not get key and value from label %s : %w" , ovnConfigResult .DpuModeLabel , err )
998997 }
999998
1000999 ovnConfigResult .SmartNicModeNodes , err = getNodeListByLabel (kubeClient , ovnConfigResult .SmartNicModeLabel )
10011000 if err != nil {
1002- return nil , fmt .Errorf ("Could not get node list with label %s : %w" , ovnConfigResult .SmartNicModeLabel , err )
1001+ return nil , fmt .Errorf ("could not get node list with label %s : %w" , ovnConfigResult .SmartNicModeLabel , err )
10031002 }
10041003 ovnConfigResult .SmartNicModeLabel , ovnConfigResult .SmartNicModeValue , err = getKeyValueFromLabel (ovnConfigResult .SmartNicModeLabel )
10051004 if err != nil {
1006- return nil , fmt .Errorf ("Could not get key and value from label %s : %w" , ovnConfigResult .SmartNicModeLabel , err )
1005+ return nil , fmt .Errorf ("could not get key and value from label %s : %w" , ovnConfigResult .SmartNicModeLabel , err )
10071006 }
10081007
10091008 // No node shall have any other label set. Each node should be ONLY be DPU, DPU Host, or Smart NIC.
10101009 found , nodeName := findCommonNode (ovnConfigResult .DpuHostModeNodes , ovnConfigResult .DpuModeNodes , ovnConfigResult .SmartNicModeNodes )
10111010 if found {
1012- return nil , fmt .Errorf ("Node %s has multiple hardware offload labels. " , nodeName )
1011+ return nil , fmt .Errorf ("node %s has multiple hardware offload labels" , nodeName )
10131012 }
10141013
10151014 ovnConfigResult .ConfigOverrides , err = getOVNKubernetesConfigOverrides (kubeClient )
10161015 if err != nil {
1017- return nil , fmt .Errorf ("Could not get OVN Kubernetes config overrides: %w" , err )
1016+ return nil , fmt .Errorf ("could not get OVN Kubernetes config overrides: %w" , err )
10181017 }
10191018
10201019 klog .Infof ("OVN configuration is now %+v" , ovnConfigResult )
@@ -1249,18 +1248,18 @@ func bootstrapOVN(conf *operv1.Network, kubeClient cnoclient.Client, infraStatus
12491248 clusterConfigLookup := types.NamespacedName {Name : CLUSTER_CONFIG_NAME , Namespace : CLUSTER_CONFIG_NAMESPACE }
12501249
12511250 if err := kubeClient .ClientFor ("" ).CRClient ().Get (context .TODO (), clusterConfigLookup , clusterConfig ); err != nil {
1252- return nil , fmt .Errorf ("Unable to bootstrap OVN, unable to retrieve cluster config: %s" , err )
1251+ return nil , fmt .Errorf ("unable to bootstrap OVN, unable to retrieve cluster config: %s" , err )
12531252 }
12541253
12551254 rcD := replicaCountDecoder {}
12561255 if err := yaml .Unmarshal ([]byte (clusterConfig .Data ["install-config" ]), & rcD ); err != nil {
1257- return nil , fmt .Errorf ("Unable to bootstrap OVN, unable to unmarshal install-config: %s" , err )
1256+ return nil , fmt .Errorf ("unable to bootstrap OVN, unable to unmarshal install-config: %s" , err )
12581257 }
12591258
12601259 hc := hypershift .NewHyperShiftConfig ()
12611260 ovnConfigResult , err := bootstrapOVNConfig (conf , kubeClient , hc , infraStatus )
12621261 if err != nil {
1263- return nil , fmt .Errorf ("Unable to bootstrap OVN config, err: %v" , err )
1262+ return nil , fmt .Errorf ("unable to bootstrap OVN config, err: %v" , err )
12641263 }
12651264
12661265 var controlPlaneReplicaCount int
@@ -1295,7 +1294,7 @@ func bootstrapOVN(conf *operv1.Network, kubeClient cnoclient.Client, infraStatus
12951294 nsn = types.NamespacedName {Namespace : namespaceForControlPlane , Name : util .OVN_CONTROL_PLANE }
12961295 if err := clusterClientForControlPlane .CRClient ().Get (context .TODO (), nsn , controlPlaneDeployment ); err != nil {
12971296 if ! apierrors .IsNotFound (err ) {
1298- return nil , fmt .Errorf ("Failed to retrieve %s deployment: %w" , util .OVN_CONTROL_PLANE , err )
1297+ return nil , fmt .Errorf ("failed to retrieve %s deployment: %w" , util .OVN_CONTROL_PLANE , err )
12991298 } else {
13001299 klog .Infof ("%s deployment not running" , util .OVN_CONTROL_PLANE )
13011300 controlPlaneStatus = nil
@@ -1324,7 +1323,7 @@ func bootstrapOVN(conf *operv1.Network, kubeClient cnoclient.Client, infraStatus
13241323 nsn = types.NamespacedName {Namespace : util .OVN_NAMESPACE , Name : util .OVN_NODE }
13251324 if err := kubeClient .ClientFor ("" ).CRClient ().Get (context .TODO (), nsn , nodeDaemonSet ); err != nil {
13261325 if ! apierrors .IsNotFound (err ) {
1327- return nil , fmt .Errorf ("Failed to retrieve existing ovnkube-node DaemonSet: %w" , err )
1326+ return nil , fmt .Errorf ("failed to retrieve existing ovnkube-node DaemonSet: %w" , err )
13281327 } else {
13291328 nodeStatus = nil
13301329 klog .Infof ("ovnkube-node DaemonSet not running" )
@@ -1353,7 +1352,7 @@ func bootstrapOVN(conf *operv1.Network, kubeClient cnoclient.Client, infraStatus
13531352 nsn = types.NamespacedName {Namespace : util .OVN_NAMESPACE , Name : "ovnkube-upgrades-prepuller" }
13541353 if err := kubeClient .ClientFor ("" ).CRClient ().Get (context .TODO (), nsn , prePullerDaemonSet ); err != nil {
13551354 if ! apierrors .IsNotFound (err ) {
1356- return nil , fmt .Errorf ("Failed to retrieve existing prepuller DaemonSet: %w" , err )
1355+ return nil , fmt .Errorf ("failed to retrieve existing prepuller DaemonSet: %w" , err )
13571356 } else {
13581357 prepullerStatus = nil
13591358 }
@@ -1891,7 +1890,7 @@ func isOVNIPsecNotActiveInDaemonSet(ds *appsv1.DaemonSet) bool {
18911890 return true
18921891}
18931892
1894- func isIPSecEnabledInPod (pod v1 .PodTemplateSpec , containerName string ) bool {
1893+ func isIPSecEnabledInPod (pod corev1 .PodTemplateSpec , containerName string ) bool {
18951894 for _ , container := range pod .Spec .Containers {
18961895 if container .Name == containerName {
18971896 for _ , c := range container .Lifecycle .PostStart .Exec .Command {
@@ -2042,7 +2041,7 @@ func validateOVNKubernetesSubnet(name, subnet string, otherSubnets *iputil.IPPoo
20422041 }
20432042 }
20442043 if err := otherSubnets .Add (* cidr ); err != nil {
2045- return fmt .Errorf ("Whole or subset of %s CIDR %s is already in use: %s" , name , subnet , err )
2044+ return fmt .Errorf ("whole or subset of %s CIDR %s is already in use: %s" , name , subnet , err )
20462045 }
20472046 return nil
20482047}
0 commit comments