From 934450043fa7485fb12d7b8ed095e74528ab5e19 Mon Sep 17 00:00:00 2001 From: AzureAhai Date: Fri, 8 Dec 2023 10:19:32 -0800 Subject: [PATCH] Updating makefile to avoid creating statless CNI release. --- Makefile | 14 +------------- cni/linux.Dockerfile | 1 + cni/windows.Dockerfile | 1 + cns/restserver/ipam.go | 4 ++-- 4 files changed, 5 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index b5e1cfa023..2fe3a52465 100644 --- a/Makefile +++ b/Makefile @@ -46,7 +46,6 @@ ZAPAI_VERSION ?= $(notdir $(shell git describe --match "zapai*" --tags --alway AZURE_IPAM_DIR = $(REPO_ROOT)/azure-ipam CNM_DIR = $(REPO_ROOT)/cnm/plugin CNI_NET_DIR = $(REPO_ROOT)/cni/network/plugin -STATELESS_CNI_NET_DIR = $(REPO_ROOT)/cni/network/stateless CNI_IPAM_DIR = $(REPO_ROOT)/cni/ipam/plugin CNI_IPAMV6_DIR = $(REPO_ROOT)/cni/ipam/pluginv6 CNI_TELEMETRY_DIR = $(REPO_ROOT)/cni/telemetry/service @@ -59,14 +58,11 @@ AZURE_IPAM_BUILD_DIR = $(BUILD_DIR)/azure-ipam IMAGE_DIR = $(OUTPUT_DIR)/images CNM_BUILD_DIR = $(BUILD_DIR)/cnm CNI_BUILD_DIR = $(BUILD_DIR)/cni -STATELESS_CNI_BUILD_DIR = $(CNI_BUILD_DIR)/stateless ACNCLI_BUILD_DIR = $(BUILD_DIR)/acncli CNI_MULTITENANCY_BUILD_DIR = $(BUILD_DIR)/cni-multitenancy CNI_MULTITENANCY_TRANSPARENT_VLAN_BUILD_DIR = $(BUILD_DIR)/cni-multitenancy-transparent-vlan CNI_SWIFT_BUILD_DIR = $(BUILD_DIR)/cni-swift -STATELESS_CNI_SWIFT_BUILD_DIR = $(CNI_SWIFT_BUILD_DIR)/stateless CNI_OVERLAY_BUILD_DIR = $(BUILD_DIR)/cni-overlay -STATELESS_CNI_OVERLAY_BUILD_DIR = $(CNI_OVERLAY_BUILD_DIR)/stateless CNI_BAREMETAL_BUILD_DIR = $(BUILD_DIR)/cni-baremetal CNI_DUALSTACK_BUILD_DIR = $(BUILD_DIR)/cni-dualstack CNS_BUILD_DIR = $(BUILD_DIR)/cns @@ -134,7 +130,7 @@ endif # Shorthand target names for convenience. azure-cnm-plugin: cnm-binary cnm-archive -azure-cni-plugin: azure-vnet-binary azure-vnet-stateless-binary azure-vnet-ipam-binary azure-vnet-ipamv6-binary azure-vnet-telemetry-binary cni-archive +azure-cni-plugin: azure-vnet-binary azure-vnet-ipam-binary azure-vnet-ipamv6-binary azure-vnet-telemetry-binary cni-archive azure-cns: azure-cns-binary cns-archive acncli: acncli-binary acncli-archive azure-cnms: azure-cnms-binary cnms-archive @@ -184,10 +180,6 @@ cnm-binary: azure-vnet-binary: cd $(CNI_NET_DIR) && CGO_ENABLED=0 go build -v -o $(CNI_BUILD_DIR)/azure-vnet$(EXE_EXT) -ldflags "-X main.version=$(CNI_VERSION)" -gcflags="-dwarflocationlists=true" -# Build the Azure CNI stateless network binary -azure-vnet-stateless-binary: - cd $(STATELESS_CNI_NET_DIR) && CGO_ENABLED=0 go build -v -o $(STATELESS_CNI_BUILD_DIR)/azure-vnet$(EXE_EXT) -ldflags "-X main.version=$(CNI_VERSION)" -gcflags="-dwarflocationlists=true" - # Build the Azure CNI IPAM binary. azure-vnet-ipam-binary: cd $(CNI_IPAM_DIR) && CGO_ENABLED=0 go build -v -o $(CNI_BUILD_DIR)/azure-vnet-ipam$(EXE_EXT) -ldflags "-X main.version=$(CNI_VERSION)" -gcflags="-dwarflocationlists=true" @@ -683,16 +675,12 @@ endif cp cni/azure-$(GOOS)-swift.conflist $(CNI_SWIFT_BUILD_DIR)/10-azure.conflist cp telemetry/azure-vnet-telemetry.config $(CNI_SWIFT_BUILD_DIR)/azure-vnet-telemetry.config cp $(CNI_BUILD_DIR)/azure-vnet$(EXE_EXT) $(CNI_BUILD_DIR)/azure-vnet-ipam$(EXE_EXT) $(CNI_BUILD_DIR)/azure-vnet-telemetry$(EXE_EXT) $(CNI_SWIFT_BUILD_DIR) - $(MKDIR) $(STATELESS_CNI_SWIFT_BUILD_DIR) - cp $(STATELESS_CNI_BUILD_DIR)/azure-vnet$(EXE_EXT) $(STATELESS_CNI_SWIFT_BUILD_DIR) cd $(CNI_SWIFT_BUILD_DIR) && $(ARCHIVE_CMD) $(CNI_SWIFT_ARCHIVE_NAME) azure-vnet$(EXE_EXT) azure-vnet-ipam$(EXE_EXT) azure-vnet-telemetry$(EXE_EXT) 10-azure.conflist azure-vnet-telemetry.config $(MKDIR) $(CNI_OVERLAY_BUILD_DIR) cp cni/azure-$(GOOS)-swift-overlay.conflist $(CNI_OVERLAY_BUILD_DIR)/10-azure.conflist cp telemetry/azure-vnet-telemetry.config $(CNI_OVERLAY_BUILD_DIR)/azure-vnet-telemetry.config cp $(CNI_BUILD_DIR)/azure-vnet$(EXE_EXT) $(CNI_BUILD_DIR)/azure-vnet-ipam$(EXE_EXT) $(CNI_BUILD_DIR)/azure-vnet-telemetry$(EXE_EXT) $(CNI_OVERLAY_BUILD_DIR) - $(MKDIR) $(STATELESS_CNI_OVERLAY_BUILD_DIR) - cp $(STATELESS_CNI_BUILD_DIR)/azure-vnet$(EXE_EXT) $(STATELESS_CNI_OVERLAY_BUILD_DIR) cd $(CNI_OVERLAY_BUILD_DIR) && $(ARCHIVE_CMD) $(CNI_OVERLAY_ARCHIVE_NAME) azure-vnet$(EXE_EXT) azure-vnet-ipam$(EXE_EXT) azure-vnet-telemetry$(EXE_EXT) 10-azure.conflist azure-vnet-telemetry.config $(MKDIR) $(CNI_DUALSTACK_BUILD_DIR) diff --git a/cni/linux.Dockerfile b/cni/linux.Dockerfile index 7f960ad9fc..1a83b3a895 100644 --- a/cni/linux.Dockerfile +++ b/cni/linux.Dockerfile @@ -11,6 +11,7 @@ COPY . . RUN GOOS=$OS CGO_ENABLED=0 go build -a -o /go/bin/azure-vnet -trimpath -ldflags "-X main.version="$VERSION"" -gcflags="-dwarflocationlists=true" cni/network/plugin/main.go RUN GOOS=$OS CGO_ENABLED=0 go build -a -o /go/bin/azure-vnet-telemetry -trimpath -ldflags "-X main.version="$VERSION"" -gcflags="-dwarflocationlists=true" cni/telemetry/service/telemetrymain.go RUN GOOS=$OS CGO_ENABLED=0 go build -a -o /go/bin/azure-vnet-ipam -trimpath -ldflags "-X main.version="$VERSION"" -gcflags="-dwarflocationlists=true" cni/ipam/plugin/main.go +RUN GOOS=$OS CGO_ENABLED=0 go build -a -o /go/bin/azurecni-stateless -trimpath -ldflags "-X main.version="$VERSION"" -gcflags="-dwarflocationlists=true" cni/network/stateless/main.go FROM mcr.microsoft.com/cbl-mariner/base/core:2.0 AS compressor ARG OS diff --git a/cni/windows.Dockerfile b/cni/windows.Dockerfile index 482fb76e01..4b0db46f42 100644 --- a/cni/windows.Dockerfile +++ b/cni/windows.Dockerfile @@ -11,6 +11,7 @@ COPY . . RUN GOOS=$OS CGO_ENABLED=0 go build -a -o /go/bin/azure-vnet -trimpath -ldflags "-X main.version="$VERSION"" -gcflags="-dwarflocationlists=true" cni/network/plugin/main.go RUN GOOS=$OS CGO_ENABLED=0 go build -a -o /go/bin/azure-vnet-telemetry -trimpath -ldflags "-X main.version="$VERSION"" -gcflags="-dwarflocationlists=true" cni/telemetry/service/telemetrymain.go RUN GOOS=$OS CGO_ENABLED=0 go build -a -o /go/bin/azure-vnet-ipam -trimpath -ldflags "-X main.version="$VERSION"" -gcflags="-dwarflocationlists=true" cni/ipam/plugin/main.go +RUN GOOS=$OS CGO_ENABLED=0 go build -a -o /go/bin/azurecni-stateless -trimpath -ldflags "-X main.version="$VERSION"" -gcflags="-dwarflocationlists=true" cni/network/stateless/main.go FROM --platform=linux/${ARCH} mcr.microsoft.com/cbl-mariner/base/core:2.0 AS compressor ARG OS diff --git a/cns/restserver/ipam.go b/cns/restserver/ipam.go index baee48f187..d61d07833f 100644 --- a/cns/restserver/ipam.go +++ b/cns/restserver/ipam.go @@ -23,9 +23,9 @@ import ( var ( ErrStoreEmpty = errors.New("empty endpoint state store") ErrParsePodIPFailed = errors.New("failed to parse pod's ip") - ErrNoNCs = errors.New("No NCs found in the CNS internal state") + ErrNoNCs = errors.New("no NCs found in the CNS internal state") ErrOptManageEndpointState = errors.New("CNS is not set to manage the endpoint state") - ErrEndpointStateNotFound = errors.New("Endpoint state could not be found in the statefile") + ErrEndpointStateNotFound = errors.New("endpoint state could not be found in the statefile") ) // requestIPConfigHandlerHelper validates the request, assign IPs and return the IPConfigs