From f98b5b16fff7894dcc26ae537012652288740262 Mon Sep 17 00:00:00 2001 From: AzureAhai Date: Thu, 18 Jan 2024 17:01:17 -0800 Subject: [PATCH] remove cni changes --- Makefile | 2 +- cni/api/api.go | 6 +++--- cni/client/client.go | 4 +++- cni/network/network.go | 6 +++--- cns/cnireconciler/podinfoprovider.go | 7 ++++--- 5 files changed, 14 insertions(+), 11 deletions(-) diff --git a/Makefile b/Makefile index 4c2b39c371f..6b30e3fce2f 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,7 @@ ACN_VERSION ?= $(shell git describe --exclude "azure-ipam*" --exclude "dropgz AZURE_IPAM_VERSION ?= $(notdir $(shell git describe --match "azure-ipam*" --tags --always)) CNI_VERSION ?= $(ACN_VERSION) CNI_DROPGZ_VERSION ?= $(notdir $(shell git describe --match "dropgz*" --tags --always)) -CNS_VERSION ?= $(ACN_VERSION)-k +CNS_VERSION ?= $(ACN_VERSION)-m NPM_VERSION ?= $(ACN_VERSION) ZAPAI_VERSION ?= $(notdir $(shell git describe --match "zapai*" --tags --always)) diff --git a/cni/api/api.go b/cni/api/api.go index 0b2c4f9a4f6..a4750e3ec5e 100644 --- a/cni/api/api.go +++ b/cni/api/api.go @@ -17,9 +17,9 @@ type PodNetworkInterfaceInfo struct { PodEndpointId string ContainerID string IPAddresses []net.IPNet - HostIfName string - HNSEndpointID string - IfName string + //HostIfName string + //HNSEndpointID string + //IfName string } type AzureCNIState struct { diff --git a/cni/client/client.go b/cni/client/client.go index 27ba4b744bc..53b420438d0 100644 --- a/cni/client/client.go +++ b/cni/client/client.go @@ -46,7 +46,9 @@ func (c *client) GetEndpointState() (*api.AzureCNIState, error) { if err := json.Unmarshal(output, state); err != nil { return nil, fmt.Errorf("failed to decode response from Azure CNI when retrieving state: [%w], response from CNI: [%s]", err, string(output)) } - + for containerID, endpointInfo := range state.ContainerInterfaces { + logger.Info("writing endpoint state from stateful CNI ", zap.String("podname:", containerID), zap.String("podname:", endpointInfo.PodName), zap.Any("endpoint:", endpointInfo)) + } return state, nil } diff --git a/cni/network/network.go b/cni/network/network.go index 728bc9a485c..29e971dd92f 100644 --- a/cni/network/network.go +++ b/cni/network/network.go @@ -190,9 +190,9 @@ func (plugin *NetPlugin) GetAllEndpointState(networkid string) (*api.AzureCNISta PodEndpointId: ep.Id, ContainerID: ep.ContainerID, IPAddresses: ep.IPAddresses, - HostIfName: ep.HostIfName, - HNSEndpointID: ep.HNSEndpointID, - IfName: ep.IfName, + //HostIfName: ep.HostIfName, + //HNSEndpointID: ep.HNSEndpointID, + //IfName: ep.IfName, } st.ContainerInterfaces[id] = info diff --git a/cns/cnireconciler/podinfoprovider.go b/cns/cnireconciler/podinfoprovider.go index 3c0e518e275..4f45bfc940c 100644 --- a/cns/cnireconciler/podinfoprovider.go +++ b/cns/cnireconciler/podinfoprovider.go @@ -62,7 +62,7 @@ func cniStateToPodInfoByIP(state *api.AzureCNIState) (map[string]cns.PodInfo, er for _, endpoint := range state.ContainerInterfaces { for _, epIP := range endpoint.IPAddresses { podInfo := cns.NewPodInfo(endpoint.ContainerID, endpoint.PodEndpointId, endpoint.PodName, endpoint.PodNamespace) - + logger.Printf("podInfoByIp [%+v]", podInfoByIP) ipKey := epIP.IP.String() if prevPodInfo, ok := podInfoByIP[ipKey]; ok { return nil, errors.Wrapf(cns.ErrDuplicateIP, "duplicate ip %s found for different pods: pod: %+v, pod: %+v", ipKey, podInfo, prevPodInfo) @@ -71,6 +71,7 @@ func cniStateToPodInfoByIP(state *api.AzureCNIState) (map[string]cns.PodInfo, er podInfoByIP[ipKey] = podInfo } } + logger.Printf("podInfoByIP [%+v]", podInfoByIP) return podInfoByIP, nil } @@ -112,7 +113,7 @@ func cniStateToCnsEndpointState(state *api.AzureCNIState) (map[string]*restserve logger.Printf("Generating CNS ENdpoint State") endpointState := map[string]*restserver.EndpointInfo{} for _, endpoint := range state.ContainerInterfaces { - endpointInfo := &restserver.EndpointInfo{PodName: endpoint.PodName, PodNamespace: endpoint.PodNamespace, HnsEndpointID: endpoint.HNSEndpointID, HostVethName: endpoint.HostIfName, IfnameToIPMap: make(map[string]*restserver.IPInfo)} + endpointInfo := &restserver.EndpointInfo{PodName: endpoint.PodName, PodNamespace: endpoint.PodNamespace, IfnameToIPMap: make(map[string]*restserver.IPInfo)} ipInfo := &restserver.IPInfo{} for _, epIP := range endpoint.IPAddresses { if epIP.IP.To4() == nil { // is an ipv6 address @@ -136,7 +137,7 @@ func cniStateToCnsEndpointState(state *api.AzureCNIState) (map[string]*restserve ipInfo.IPv4 = append(ipInfo.IPv4, ipconfig) } } - endpointInfo.IfnameToIPMap[endpoint.IfName] = ipInfo + endpointInfo.IfnameToIPMap["eth0"] = ipInfo logger.Printf("writing endpoint podName from stateful CNI %v", endpoint.PodName) logger.Printf("writing endpoint info from stateful CNI [%+v]", *endpointInfo) endpointState[endpoint.ContainerID] = endpointInfo