diff --git a/multicluster/controllers/multicluster/leader/resourceexport_controller.go b/multicluster/controllers/multicluster/leader/resourceexport_controller.go index 20434541612..c24590f8466 100644 --- a/multicluster/controllers/multicluster/leader/resourceexport_controller.go +++ b/multicluster/controllers/multicluster/leader/resourceexport_controller.go @@ -261,7 +261,7 @@ func (r *ResourceExportReconciler) updateEndpointResourceImport(ctx context.Cont func (r *ResourceExportReconciler) getExistingResImport(ctx context.Context, resExport mcsv1alpha1.ResourceExport) (bool, *mcsv1alpha1.ResourceImport, error) { - importedResNameSpace := resExport.Labels[constants.SourceNamespace] + importedResNamespace := resExport.Labels[constants.SourceNamespace] importedResName := resExport.Labels[constants.SourceName] var createResImport bool existResImport := &mcsv1alpha1.ResourceImport{} @@ -281,7 +281,7 @@ func (r *ResourceExportReconciler) getExistingResImport(ctx context.Context, Spec: mcsv1alpha1.ResourceImportSpec{ ClusterIDs: []string{}, Name: importedResName, - Namespace: importedResNameSpace, + Namespace: importedResNamespace, }, } createResImport = true diff --git a/pkg/agent/cniserver/interface_configuration_windows.go b/pkg/agent/cniserver/interface_configuration_windows.go index 2893da654cb..d33ac9f2363 100644 --- a/pkg/agent/cniserver/interface_configuration_windows.go +++ b/pkg/agent/cniserver/interface_configuration_windows.go @@ -115,7 +115,7 @@ func findContainerIPConfig(ips []*current.IPConfig) (*current.IPConfig, error) { // configureContainerLink creates a HNSEndpoint for the container using the IPAM result, and then attach it on the container interface. func (ic *ifConfigurator) configureContainerLink( podName string, - podNameSpace string, + podNamespace string, containerID string, containerNetNS string, containerIFDev string, @@ -134,7 +134,7 @@ func (ic *ifConfigurator) configureContainerLink( // We must use the infra container to generate the endpoint name to ensure infra and workload containers use the // same HNSEndpoint. infraContainerID := getInfraContainer(containerID, containerNetNS) - epName := util.GenerateContainerInterfaceName(podName, podNameSpace, infraContainerID) + epName := util.GenerateContainerInterfaceName(podName, podNamespace, infraContainerID) // Search endpoint from local cache. endpoint, found := ic.getEndpoint(epName) if !found { @@ -142,7 +142,7 @@ func (ic *ifConfigurator) configureContainerLink( return fmt.Errorf("failed to find HNSEndpoint: %s", epName) } // Only create HNS Endpoint for infra container. - ep, err := ic.createContainerLink(epName, result, containerID, podName, podNameSpace) + ep, err := ic.createContainerLink(epName, result, containerID, podName, podNamespace) if err != nil { return err } @@ -307,7 +307,7 @@ func (ic *ifConfigurator) removeHNSEndpoint(endpoint *hcsshim.HNSEndpoint, conta if hcnEndpoint != nil && isValidHostNamespace(hcnEndpoint.HostComputeNamespace) { err := removeEndpointFromNamespaceFunc(hcnEndpoint.HostComputeNamespace, hcnEndpoint.Id) if err != nil { - klog.Errorf("Failed to remove HostComputeEndpoint %s from HostComputeNameSpace %s: %v", hcnEndpoint.Name, hcnEndpoint.HostComputeNamespace, err) + klog.Errorf("Failed to remove HostComputeEndpoint %s from HostComputeNamespace %s: %v", hcnEndpoint.Name, hcnEndpoint.HostComputeNamespace, err) deleteCh <- err return } diff --git a/pkg/agent/cniserver/pod_configuration.go b/pkg/agent/cniserver/pod_configuration.go index d2634a803dd..1e0782dfe88 100644 --- a/pkg/agent/cniserver/pod_configuration.go +++ b/pkg/agent/cniserver/pod_configuration.go @@ -200,7 +200,7 @@ func ParseOVSPortInterfaceConfig(portData *ovsconfig.OVSPortData, portConfig *in func (pc *podConfigurator) configureInterfaces( podName string, - podNameSpace string, + podNamespace string, containerID string, containerNetNS string, containerIFDev string, @@ -210,7 +210,7 @@ func (pc *podConfigurator) configureInterfaces( createOVSPort bool, containerAccess *containerAccessArbitrator, ) error { - err := pc.ifConfigurator.configureContainerLink(podName, podNameSpace, containerID, containerNetNS, containerIFDev, mtu, sriovVFDeviceID, "", &result.Result, containerAccess) + err := pc.ifConfigurator.configureContainerLink(podName, podNamespace, containerID, containerNetNS, containerIFDev, mtu, sriovVFDeviceID, "", &result.Result, containerAccess) if err != nil { return err } @@ -243,7 +243,7 @@ func (pc *podConfigurator) configureInterfaces( } var containerConfig *interfacestore.InterfaceConfig - if containerConfig, err = pc.connectInterfaceToOVS(podName, podNameSpace, containerID, hostIface, containerIface, result.IPs, result.VLANID, containerAccess); err != nil { + if containerConfig, err = pc.connectInterfaceToOVS(podName, podNamespace, containerID, hostIface, containerIface, result.IPs, result.VLANID, containerAccess); err != nil { return fmt.Errorf("failed to connect to ovs for container %s: %v", containerID, err) } defer func() { @@ -544,7 +544,7 @@ func (pc *podConfigurator) disconnectInterfaceFromOVS(containerConfig *interface // connectInterceptedInterface connects intercepted interface to ovs br-int. func (pc *podConfigurator) connectInterceptedInterface( podName string, - podNameSpace string, + podNamespace string, containerID string, containerNetNS string, containerIFDev string, @@ -562,7 +562,7 @@ func (pc *podConfigurator) connectInterceptedInterface( if err = pc.routeClient.MigrateRoutesToGw(hostIface.Name); err != nil { return fmt.Errorf("connectInterceptedInterface failed to migrate: %w", err) } - _, err = pc.connectInterfaceToOVS(podName, podNameSpace, containerID, hostIface, + _, err = pc.connectInterfaceToOVS(podName, podNamespace, containerID, hostIface, containerIface, containerIPs, 0, containerAccess) return err } diff --git a/pkg/agent/cniserver/pod_configuration_linux.go b/pkg/agent/cniserver/pod_configuration_linux.go index 56a9b7ec13b..4376d32b1a6 100644 --- a/pkg/agent/cniserver/pod_configuration_linux.go +++ b/pkg/agent/cniserver/pod_configuration_linux.go @@ -27,7 +27,7 @@ import ( // connectInterfaceToOVS connects an existing interface to ovs br-int. func (pc *podConfigurator) connectInterfaceToOVS( podName string, - podNameSpace string, + podNamespace string, containerID string, hostIface *current.Interface, containerIface *current.Interface, @@ -37,7 +37,7 @@ func (pc *podConfigurator) connectInterfaceToOVS( ) (*interfacestore.InterfaceConfig, error) { // Use the outer veth interface name as the OVS port name. ovsPortName := hostIface.Name - containerConfig := buildContainerConfig(ovsPortName, containerID, podName, podNameSpace, containerIface, ips, vlanID) + containerConfig := buildContainerConfig(ovsPortName, containerID, podName, podNamespace, containerIface, ips, vlanID) return containerConfig, pc.connectInterfaceToOVSCommon(ovsPortName, containerConfig) } diff --git a/pkg/agent/cniserver/pod_configuration_linux_test.go b/pkg/agent/cniserver/pod_configuration_linux_test.go index d1b04db3efd..66b94f7f6e9 100644 --- a/pkg/agent/cniserver/pod_configuration_linux_test.go +++ b/pkg/agent/cniserver/pod_configuration_linux_test.go @@ -241,7 +241,7 @@ func TestCreateOVSPort(t *testing.T) { controller := gomock.NewController(t) containerID := generateUUID(t) podName := "p0" - podNameSpace := testPodNamespace + podNamespace := testPodNamespace for _, tc := range []struct { name string @@ -268,7 +268,7 @@ func TestCreateOVSPort(t *testing.T) { t.Run(tc.name, func(t *testing.T) { testIfaceConfigurator := &fakeInterfaceConfigurator{ovsInterfaceTypeMapping: map[string]int{tc.portName: tc.portType}} podConfigurator := createPodConfigurator(controller, testIfaceConfigurator) - containerConfig := buildContainerConfig(tc.portName, containerID, podName, podNameSpace, ¤t.Interface{Mac: "01:02:03:04:05:06"}, ipamResult.IPs, tc.vlanID) + containerConfig := buildContainerConfig(tc.portName, containerID, podName, podNamespace, ¤t.Interface{Mac: "01:02:03:04:05:06"}, ipamResult.IPs, tc.vlanID) attachInfo := BuildOVSPortExternalIDs(containerConfig) if tc.createOVSPort { mockOVSBridgeClient.EXPECT().CreatePort(tc.portName, tc.portName, attachInfo).Times(1).Return(generateUUID(t), nil) diff --git a/pkg/agent/cniserver/pod_configuration_windows.go b/pkg/agent/cniserver/pod_configuration_windows.go index ca90a2e9d39..1302e66bf58 100644 --- a/pkg/agent/cniserver/pod_configuration_windows.go +++ b/pkg/agent/cniserver/pod_configuration_windows.go @@ -64,7 +64,7 @@ func (pc *podConfigurator) connectInterfaceToOVSAsync(ifConfig *interfacestore.I // connectInterfaceToOVS connects an existing interface to OVS br-int. func (pc *podConfigurator) connectInterfaceToOVS( podName string, - podNameSpace string, + podNamespace string, containerID string, hostIface *current.Interface, containerIface *current.Interface, @@ -74,7 +74,7 @@ func (pc *podConfigurator) connectInterfaceToOVS( ) (*interfacestore.InterfaceConfig, error) { // Use the outer veth interface name as the OVS port name. ovsPortName := hostIface.Name - containerConfig := buildContainerConfig(ovsPortName, containerID, podName, podNameSpace, containerIface, ips, vlanID) + containerConfig := buildContainerConfig(ovsPortName, containerID, podName, podNamespace, containerIface, ips, vlanID) hostIfAlias := util.VirtualAdapterName(ovsPortName) // - For containerd runtime, the container interface is created after CNI replying the network setup result. // So for such case we need to use asynchronous way to wait for interface to be created: we create the OVS port diff --git a/pkg/agent/cniserver/server.go b/pkg/agent/cniserver/server.go index 72081b79e91..995cc915852 100644 --- a/pkg/agent/cniserver/server.go +++ b/pkg/agent/cniserver/server.go @@ -530,7 +530,7 @@ func (s *CNIServer) CmdAdd(ctx context.Context, request *cnipb.CniCmdRequest) (* if s.secondaryNetworkEnabled { // Go cache the CNI server info at CNIConfigInfo cache, for podWatch usage - cniInfo := &cnipodcache.CNIConfigInfo{CNIVersion: cniVersion, PodName: podName, PodNameSpace: podNamespace, + cniInfo := &cnipodcache.CNIConfigInfo{CNIVersion: cniVersion, PodName: podName, PodNamespace: podNamespace, ContainerID: cniConfig.ContainerId, ContainerNetNS: netNS, PodCNIDeleted: false, MTU: cniConfig.MTU} s.podConfigurator.podInfoStore.AddCNIConfigInfo(cniInfo) diff --git a/pkg/agent/cniserver/server_linux_test.go b/pkg/agent/cniserver/server_linux_test.go index 9329a5deb4e..9acabb19443 100644 --- a/pkg/agent/cniserver/server_linux_test.go +++ b/pkg/agent/cniserver/server_linux_test.go @@ -493,7 +493,7 @@ func TestCmdDel(t *testing.T) { testIfaceConfigurator.hostIfaceName = hostInterfaceName cniserver.podConfigurator.ifConfigurator = testIfaceConfigurator if tc.secondaryNetworkEnabled { - cniInfo := &cnipodcache.CNIConfigInfo{CNIVersion: supportedCNIVersion, PodName: tc.podName, PodNameSpace: testPodNamespace, + cniInfo := &cnipodcache.CNIConfigInfo{CNIVersion: supportedCNIVersion, PodName: tc.podName, PodNamespace: testPodNamespace, ContainerID: containerID, ContainerNetNS: netns, PodCNIDeleted: false, MTU: 1450} cniserver.podConfigurator.podInfoStore.AddCNIConfigInfo(cniInfo) diff --git a/pkg/agent/cniserver/sriov.go b/pkg/agent/cniserver/sriov.go index 601f74c2826..1a37dfc8b43 100644 --- a/pkg/agent/cniserver/sriov.go +++ b/pkg/agent/cniserver/sriov.go @@ -92,7 +92,7 @@ func GetPodContainerDeviceIDs(podName string, podNamespace string) ([]string, er // Limitation: only SR-IOV interface is supported as of now. func (pc *podConfigurator) ConfigureSriovSecondaryInterface( podName string, - podNameSpace string, + podNamespace string, containerID string, containerNetNS string, containerIFDev string, @@ -104,7 +104,7 @@ func (pc *podConfigurator) ConfigureSriovSecondaryInterface( return fmt.Errorf("error getting the Pod SR-IOV VF device ID") } - err := pc.ifConfigurator.configureContainerLink(podName, podNameSpace, containerID, containerNetNS, containerIFDev, mtu, "", podSriovVFDeviceID, result, nil) + err := pc.ifConfigurator.configureContainerLink(podName, podNamespace, containerID, containerNetNS, containerIFDev, mtu, "", podSriovVFDeviceID, result, nil) if err != nil { return err } diff --git a/pkg/agent/secondarynetwork/cnipodcache/cache.go b/pkg/agent/secondarynetwork/cnipodcache/cache.go index 11b8bc8b106..cc0ec7b6356 100644 --- a/pkg/agent/secondarynetwork/cnipodcache/cache.go +++ b/pkg/agent/secondarynetwork/cnipodcache/cache.go @@ -90,7 +90,7 @@ func (c *CNIPodInfoCache) GetCNIConfigInfoByContainerID(podName, podNamespace, c func podIndexFunc(obj interface{}) ([]string, error) { podConfig := obj.(*CNIConfigInfo) - return []string{k8s.NamespacedName(podConfig.PodNameSpace, podConfig.PodName)}, nil + return []string{k8s.NamespacedName(podConfig.PodNamespace, podConfig.PodName)}, nil } func getCNIPodInfoKey(obj interface{}) (string, error) { diff --git a/pkg/agent/secondarynetwork/cnipodcache/types.go b/pkg/agent/secondarynetwork/cnipodcache/types.go index 3d8cfd39f44..1231cf1ebc2 100644 --- a/pkg/agent/secondarynetwork/cnipodcache/types.go +++ b/pkg/agent/secondarynetwork/cnipodcache/types.go @@ -17,7 +17,7 @@ package cnipodcache type CNIConfigInfo struct { CNIVersion string PodName string - PodNameSpace string + PodNamespace string ContainerID string ContainerNetNS string MTU int diff --git a/pkg/agent/secondarynetwork/podwatch/controller.go b/pkg/agent/secondarynetwork/podwatch/controller.go index 84610c3bfe7..ff1f401e838 100644 --- a/pkg/agent/secondarynetwork/podwatch/controller.go +++ b/pkg/agent/secondarynetwork/podwatch/controller.go @@ -75,7 +75,7 @@ type podSriovVFDeviceIDInfo struct { } type InterfaceConfigurator interface { - ConfigureSriovSecondaryInterface(podName string, podNameSpace string, containerID string, containerNetNS string, containerIFDev string, mtu int, podSriovVFDeviceID string, result *current.Result) error + ConfigureSriovSecondaryInterface(podName string, podNamespace string, containerID string, containerNetNS string, containerIFDev string, mtu int, podSriovVFDeviceID string, result *current.Result) error } type PodController struct { @@ -197,7 +197,7 @@ func whereaboutsArgsBuilder(cmd string, interfaceName string, podCNIInfo *cnipod NetNS: podCNIInfo.ContainerNetNS, IfName: interfaceName, Path: cniPath, PluginArgs: [][2]string{ {"K8S_POD_NAME", podCNIInfo.PodName}, - {"K8S_POD_NAMESPACE", podCNIInfo.PodNameSpace}, + {"K8S_POD_NAMESPACE", podCNIInfo.PodNamespace}, {"K8S_POD_INFRA_CONTAINER_ID", podCNIInfo.ContainerID}, }} @@ -302,7 +302,7 @@ func (pc *PodController) handleRemovePod(key string) error { // Delete cache entry from podCNIInfo. pc.podCache.DeleteCNIConfigInfo(containerInfo) // Delete Pod specific VF cache (if one exists) - pc.deleteVFDeviceIDListPerPod(containerInfo.PodName, containerInfo.PodNameSpace) + pc.deleteVFDeviceIDListPerPod(containerInfo.PodName, containerInfo.PodNamespace) } } return nil @@ -349,7 +349,7 @@ func (pc *PodController) configureSriovAsSecondaryInterface(pod *corev1.Pod, net if err = pc.interfaceConfigurator.ConfigureSriovSecondaryInterface( containerInfo.PodName, - containerInfo.PodNameSpace, + containerInfo.PodNamespace, containerInfo.ContainerID, containerInfo.ContainerNetNS, network.InterfaceRequest, diff --git a/pkg/agent/secondarynetwork/podwatch/controller_test.go b/pkg/agent/secondarynetwork/podwatch/controller_test.go index ad0c88753c6..c265dc262e9 100644 --- a/pkg/agent/secondarynetwork/podwatch/controller_test.go +++ b/pkg/agent/secondarynetwork/podwatch/controller_test.go @@ -124,7 +124,7 @@ func testPod(name string, container string, podIP string, networks ...netdefv1.N } cniConfig := &cnipodcache.CNIConfigInfo{ PodName: name, - PodNameSpace: testNamespace, + PodNamespace: testNamespace, ContainerID: container, ContainerNetNS: containerNetNs(container), MTU: defaultMTU, diff --git a/pkg/controller/externalnode/controller.go b/pkg/controller/externalnode/controller.go index 8bba1d4c406..d1c7f277875 100644 --- a/pkg/controller/externalnode/controller.go +++ b/pkg/controller/externalnode/controller.go @@ -305,12 +305,12 @@ func (c *ExternalNodeController) updateExternalEntity(ee *v1alpha2.ExternalEntit if errors.IsNotFound(err) { _, err = c.crdClient.CrdV1alpha2().ExternalEntities(ee.Namespace).Create(context.TODO(), ee, metav1.CreateOptions{}) if err != nil { - klog.ErrorS(err, "Failed to create ExternalEntity", "entityName", ee.Name, "entityNameSpace", ee.Namespace) + klog.ErrorS(err, "Failed to create ExternalEntity", "entityName", ee.Name, "entityNamespace", ee.Namespace) return err } return nil } - klog.ErrorS(err, "Failed to get ExternalEntity", "entityName", ee.Name, "entityNameSpace", ee.Namespace) + klog.ErrorS(err, "Failed to get ExternalEntity", "entityName", ee.Name, "entityNamespace", ee.Namespace) return err } isChanged := false