From 42b321caa9fb74aa59ba21c8bf8765781393c544 Mon Sep 17 00:00:00 2001 From: camrynl <31013536+camrynl@users.noreply.github.com> Date: Thu, 15 Sep 2022 14:31:04 -0700 Subject: [PATCH 01/10] add new dockerfile for testing cni-dropgz --- .pipelines/pipeline.yaml | 11 +++++++ Makefile | 30 +++++++++++++++++ dropgz/build/cniTest.Dockerfile | 32 +++++++++++++++++++ test/integration/manifests/cns/daemonset.yaml | 2 +- 4 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 dropgz/build/cniTest.Dockerfile diff --git a/.pipelines/pipeline.yaml b/.pipelines/pipeline.yaml index 25c5f879d7..596469fdfe 100644 --- a/.pipelines/pipeline.yaml +++ b/.pipelines/pipeline.yaml @@ -157,6 +157,10 @@ stages: arch: amd64 os: linux name: cni-dropgz + cni_dropgz_test_linux_amd64: + arch: amd64 + os: linux + name: cni-dropgz-test cns_linux_amd64: arch: amd64 os: linux @@ -187,6 +191,10 @@ stages: arch: arm64 os: linux name: cni-dropgz + cni_dropgz_test_linux_arm64: + arch: arm64 + os: linux + name: cni-dropgz-test cns_linux_arm64: arch: arm64 os: linux @@ -239,6 +247,9 @@ stages: cni_dropgz: name: cni-dropgz platforms: linux/amd64 linux/arm64 + cni_dropgz_test: + name: cni-dropgz-test + platforms: linux/amd64 linux/arm64 cns: name: cns platforms: linux/amd64 linux/arm64 windows/amd64 diff --git a/Makefile b/Makefile index 5e8cfb4512..2e42828676 100644 --- a/Makefile +++ b/Makefile @@ -153,6 +153,9 @@ cni-version: ## prints the cni version cni-dropgz-version: ## prints the cni-dropgz version @echo $(CNI_DROPGZ_VERSION) +cni-dropgz-test-version: ## prints the cni-dropgz version + @echo $(CNI_DROPGZ_TEST_VERSION) + cns-version: @echo $(CNS_VERSION) @@ -223,12 +226,14 @@ endif ## Image name definitions. ACNCLI_IMAGE = acncli CNI_DROPGZ_IMAGE = cni-dropgz +CNI_DROPGZ_TEST_IMAGE = cni-dropgz-test CNS_IMAGE = azure-cns NPM_IMAGE = azure-npm ## Image platform tags. ACNCLI_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))-$(ACN_VERSION) CNI_DROPGZ_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))-$(CNI_DROPGZ_VERSION) +CNI_DROPGZ_TEST_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))-$(CNI_DROPGZ_TEST_VERSION) CNS_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))-$(CNS_VERSION) NPM_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))-$(NPM_VERSION) @@ -326,6 +331,31 @@ cni-dropgz-skopeo-export: $(MAKE) skopeo-export \ REF=$(IMAGE_REGISTRY)/$(CNI_DROPGZ_IMAGE):$(CNI_DROPGZ_PLATFORM_TAG) +# cni-dropgz-test + +cni-dropgz-test-image-name: # util target to print the CNI dropgz test image name. + @echo $(CNI_DROPGZ_TEST_IMAGE) + +cni-dropgz-test-image: ## build cni-dropgz-test container image. + $(MAKE) container \ + DOCKERFILE=dropgz/build/cniTest.Dockerfile \ + IMAGE=$(CNI_DROPGZ_TEST_IMAGE) \ + TAG=$(CNI_DROPGZ_TEST_PLATFORM_TAG) + +cni-dropgz-test-image-push: ## push cni-dropgz-test container image. + $(MAKE) container-push \ + IMAGE=$(CNI_DROPGZ_TEST_IMAGE) \ + TAG=$(CNI_DROPGZ_TEST_PLATFORM_TAG) + +cni-dropgz-test-image-pull: ## pull cni-dropgz-test container image. + $(MAKE) container-pull \ + IMAGE=$(CNI_DROPGZ_TEST_IMAGE) \ + TAG=$(CNI_DROPGZ_TEST_PLATFORM_TAG) + +cni-dropgz-test-skopeo-export: + $(MAKE) skopeo-export \ + REF=$(IMAGE_REGISTRY)/$(CNI_DROPGZ_TEST_IMAGE):$(CNI_DROPGZ_TEST_PLATFORM_TAG) + # cns cns-image-name: # util target to print the CNS image name diff --git a/dropgz/build/cniTest.Dockerfile b/dropgz/build/cniTest.Dockerfile new file mode 100644 index 0000000000..c5c18ec214 --- /dev/null +++ b/dropgz/build/cniTest.Dockerfile @@ -0,0 +1,32 @@ +FROM mcr.microsoft.com/oss/go/microsoft/golang:1.19 AS azure-ipam +ARG VERSION +WORKDIR /azure-ipam +COPY ./azure-ipam . +RUN CGO_ENABLED=0 go build -a -o bin/azure-ipam -trimpath -ldflags "-X main.version="$VERSION"" -gcflags="-dwarflocationlists=true" . + +FROM mcr.microsoft.com/oss/go/microsoft/golang:1.19 AS azure-vnet +ARG VERSION +WORKDIR /azure-container-networking +COPY . . +RUN CGO_ENABLED=0 go build -a -o bin/azure-vnet -trimpath -ldflags "-X main.version="$VERSION"" -gcflags="-dwarflocationlists=true" cni/network/plugin/main.go + +FROM mcr.microsoft.com/cbl-mariner/base/core:2.0 AS compressor +WORKDIR /dropgz +COPY dropgz . +COPY --from=azure-vnet /azure-container-networking/bin/* pkg/embed/fs +COPY --from=azure-ipam /azure-ipam/*.conflist pkg/embed/fs +COPY --from=azure-ipam /azure-ipam/bin/* pkg/embed/fs +COPY --from=azure-vnet /azure-container-networking/cni/*.conflist pkg/embed/fs/azure-swift.conflist +COPY --from=azure-vnet /azure-container-networking/bin/* pkg/embed/fs +RUN cd pkg/embed/fs/ && sha256sum * > sum.txt +RUN gzip --verbose --best --recursive pkg/embed/fs && for f in pkg/embed/fs/*.gz; do mv -- "$f" "${f%%.gz}"; done + +FROM mcr.microsoft.com/oss/go/microsoft/golang:1.18 AS dropgz +ARG VERSION +WORKDIR /dropgz +COPY --from=compressor /dropgz . +RUN CGO_ENABLED=0 go build -a -o bin/dropgz -trimpath -ldflags "-X github.com/Azure/azure-container-networking/dropgz/internal/buildinfo.Version="$VERSION"" -gcflags="-dwarflocationlists=true" main.go + +FROM scratch +COPY --from=dropgz /dropgz/bin/dropgz /dropgz +ENTRYPOINT [ "/dropgz" ] diff --git a/test/integration/manifests/cns/daemonset.yaml b/test/integration/manifests/cns/daemonset.yaml index 4a86181c4f..7f163ec746 100644 --- a/test/integration/manifests/cns/daemonset.yaml +++ b/test/integration/manifests/cns/daemonset.yaml @@ -81,7 +81,7 @@ spec: fieldPath: spec.nodeName initContainers: - name: init-cni-dropgz - image: acnpublic.azurecr.io/cni-dropgz:v1.4.28-41-g3ecb7fb1 + image: acnpublic.azurecr.io/cni-dropgz-test:latest imagePullPolicy: Always command: ["/dropgz"] volumeMounts: From 2b83ba9b031a4458ee9aa561e753f43a2d4dc8a3 Mon Sep 17 00:00:00 2001 From: camrynl <31013536+camrynl@users.noreply.github.com> Date: Thu, 15 Sep 2022 16:26:02 -0700 Subject: [PATCH 02/10] add make targets for cni-dropgz-test manifest --- Makefile | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Makefile b/Makefile index 2e42828676..caf422dbd0 100644 --- a/Makefile +++ b/Makefile @@ -523,6 +523,22 @@ cni-dropgz-skopeo-archive: ## export tar archive of cni-dropgz multiplat contain IMAGE=$(CNI_DROPGZ_IMAGE) \ TAG=$(CNI_DROPGZ_VERSION) +cni-dropgz-test-manifest-create: ## build cni-dropgz multiplat container manifest. + $(MAKE) manifest-create \ + PLATFORMS="$(PLATFORMS)" \ + IMAGE=$(CNI_DROPGZ_TEST_IMAGE) \ + TAG=$(CNI_DROPGZ_TEST_VERSION) + +cni-dropgz-test-manifest-push: ## push cni-dropgz multiplat container manifest + $(MAKE) manifest-push \ + IMAGE=$(CNI_DROPGZ_TEST_IMAGE) \ + TAG=$(CNI_DROPGZ_TEST_VERSION) + +cni-dropgz-test-skopeo-archive: ## export tar archive of cni-dropgz multiplat container manifest. + $(MAKE) manifest-skopeo-archive \ + IMAGE=$(CNI_DROPGZ_TEST_IMAGE) \ + TAG=$(CNI_DROPGZ_TEST_VERSION) + cns-manifest-create: ## build azure-cns multiplat container manifest. $(MAKE) manifest-create \ PLATFORMS="$(PLATFORMS)" \ From e549aec9b5cf42ea9b7d3f569cec2e9fed920e94 Mon Sep 17 00:00:00 2001 From: camrynl <31013536+camrynl@users.noreply.github.com> Date: Fri, 16 Sep 2022 09:45:09 -0700 Subject: [PATCH 03/10] modify versioning in cni-dropgz-test manifest --- Makefile | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index caf422dbd0..9233afffd9 100644 --- a/Makefile +++ b/Makefile @@ -153,9 +153,6 @@ cni-version: ## prints the cni version cni-dropgz-version: ## prints the cni-dropgz version @echo $(CNI_DROPGZ_VERSION) -cni-dropgz-test-version: ## prints the cni-dropgz version - @echo $(CNI_DROPGZ_TEST_VERSION) - cns-version: @echo $(CNS_VERSION) @@ -233,7 +230,6 @@ NPM_IMAGE = azure-npm ## Image platform tags. ACNCLI_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))-$(ACN_VERSION) CNI_DROPGZ_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))-$(CNI_DROPGZ_VERSION) -CNI_DROPGZ_TEST_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))-$(CNI_DROPGZ_TEST_VERSION) CNS_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))-$(CNS_VERSION) NPM_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))-$(NPM_VERSION) @@ -340,17 +336,17 @@ cni-dropgz-test-image: ## build cni-dropgz-test container image. $(MAKE) container \ DOCKERFILE=dropgz/build/cniTest.Dockerfile \ IMAGE=$(CNI_DROPGZ_TEST_IMAGE) \ - TAG=$(CNI_DROPGZ_TEST_PLATFORM_TAG) + TAG=$(CNI_DROPGZ_PLATFORM_TAG) cni-dropgz-test-image-push: ## push cni-dropgz-test container image. $(MAKE) container-push \ IMAGE=$(CNI_DROPGZ_TEST_IMAGE) \ - TAG=$(CNI_DROPGZ_TEST_PLATFORM_TAG) + TAG=$(CNI_DROPGZ_PLATFORM_TAG) cni-dropgz-test-image-pull: ## pull cni-dropgz-test container image. $(MAKE) container-pull \ IMAGE=$(CNI_DROPGZ_TEST_IMAGE) \ - TAG=$(CNI_DROPGZ_TEST_PLATFORM_TAG) + TAG=$(CNI_DROPGZ_PLATFORM_TAG) cni-dropgz-test-skopeo-export: $(MAKE) skopeo-export \ @@ -527,17 +523,17 @@ cni-dropgz-test-manifest-create: ## build cni-dropgz multiplat container manifes $(MAKE) manifest-create \ PLATFORMS="$(PLATFORMS)" \ IMAGE=$(CNI_DROPGZ_TEST_IMAGE) \ - TAG=$(CNI_DROPGZ_TEST_VERSION) + TAG=$(CNI_DROPGZ_VERSION) cni-dropgz-test-manifest-push: ## push cni-dropgz multiplat container manifest $(MAKE) manifest-push \ IMAGE=$(CNI_DROPGZ_TEST_IMAGE) \ - TAG=$(CNI_DROPGZ_TEST_VERSION) + TAG=$(CNI_DROPGZ_VERSION) cni-dropgz-test-skopeo-archive: ## export tar archive of cni-dropgz multiplat container manifest. $(MAKE) manifest-skopeo-archive \ IMAGE=$(CNI_DROPGZ_TEST_IMAGE) \ - TAG=$(CNI_DROPGZ_TEST_VERSION) + TAG=$(CNI_DROPGZ_VERSION) cns-manifest-create: ## build azure-cns multiplat container manifest. $(MAKE) manifest-create \ From 4b3aec0f0e88e0872024f0defd8154c3d2dfc290 Mon Sep 17 00:00:00 2001 From: camrynl <31013536+camrynl@users.noreply.github.com> Date: Fri, 16 Sep 2022 10:14:07 -0700 Subject: [PATCH 04/10] platform versioning for test image --- Makefile | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 9233afffd9..f6c81be8d1 100644 --- a/Makefile +++ b/Makefile @@ -37,6 +37,7 @@ ACN_VERSION ?= $(shell git describe --exclude "azure-ipam*" --exclude "cni- AZURE_IPAM_VERSION ?= $(notdir $(shell git describe --match "azure-ipam*" --tags --always)) CNI_VERSION ?= $(ACN_VERSION) CNI_DROPGZ_VERSION ?= $(notdir $(shell git describe --match "cni-dropgz*" --tags --always)) +CNI_DROPGZ_VERSION ?= $(notdir $(shell git describe --match "cni-dropgz-test*" --tags --always)) CNS_VERSION ?= $(ACN_VERSION) NPM_VERSION ?= $(ACN_VERSION) ZAPAI_VERSION ?= $(notdir $(shell git describe --match "zapai*" --tags --always)) @@ -153,6 +154,9 @@ cni-version: ## prints the cni version cni-dropgz-version: ## prints the cni-dropgz version @echo $(CNI_DROPGZ_VERSION) +cni-dropgz-test-version: ## prints the cni-dropgz version + @echo $(CNI_DROPGZ_TEST_VERSION) + cns-version: @echo $(CNS_VERSION) @@ -230,6 +234,7 @@ NPM_IMAGE = azure-npm ## Image platform tags. ACNCLI_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))-$(ACN_VERSION) CNI_DROPGZ_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))-$(CNI_DROPGZ_VERSION) +CNI_DROPGZ_TEST_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))-$(CNI_DROPGZ_TEST_VERSION) CNS_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))-$(CNS_VERSION) NPM_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))-$(NPM_VERSION) @@ -336,17 +341,17 @@ cni-dropgz-test-image: ## build cni-dropgz-test container image. $(MAKE) container \ DOCKERFILE=dropgz/build/cniTest.Dockerfile \ IMAGE=$(CNI_DROPGZ_TEST_IMAGE) \ - TAG=$(CNI_DROPGZ_PLATFORM_TAG) + TAG=$(CNI_DROPGZ_TEST_PLATFORM_TAG) cni-dropgz-test-image-push: ## push cni-dropgz-test container image. $(MAKE) container-push \ IMAGE=$(CNI_DROPGZ_TEST_IMAGE) \ - TAG=$(CNI_DROPGZ_PLATFORM_TAG) + TAG=$(CNI_DROPGZ_TEST_PLATFORM_TAG) cni-dropgz-test-image-pull: ## pull cni-dropgz-test container image. $(MAKE) container-pull \ IMAGE=$(CNI_DROPGZ_TEST_IMAGE) \ - TAG=$(CNI_DROPGZ_PLATFORM_TAG) + TAG=$(CNI_DROPGZ_TEST_PLATFORM_TAG) cni-dropgz-test-skopeo-export: $(MAKE) skopeo-export \ @@ -523,17 +528,17 @@ cni-dropgz-test-manifest-create: ## build cni-dropgz multiplat container manifes $(MAKE) manifest-create \ PLATFORMS="$(PLATFORMS)" \ IMAGE=$(CNI_DROPGZ_TEST_IMAGE) \ - TAG=$(CNI_DROPGZ_VERSION) + TAG=$(CNI_DROPGZ_TEST_VERSION) cni-dropgz-test-manifest-push: ## push cni-dropgz multiplat container manifest $(MAKE) manifest-push \ IMAGE=$(CNI_DROPGZ_TEST_IMAGE) \ - TAG=$(CNI_DROPGZ_VERSION) + TAG=$(CNI_DROPGZ_TEST_VERSION) cni-dropgz-test-skopeo-archive: ## export tar archive of cni-dropgz multiplat container manifest. $(MAKE) manifest-skopeo-archive \ IMAGE=$(CNI_DROPGZ_TEST_IMAGE) \ - TAG=$(CNI_DROPGZ_VERSION) + TAG=$(CNI_DROPGZ_TEST_VERSION) cns-manifest-create: ## build azure-cns multiplat container manifest. $(MAKE) manifest-create \ From e5a9dca0bf7970a6ffbdb186fe6447edeb1dfb71 Mon Sep 17 00:00:00 2001 From: camrynl <31013536+camrynl@users.noreply.github.com> Date: Fri, 16 Sep 2022 10:41:43 -0700 Subject: [PATCH 05/10] fix build of test image --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f6c81be8d1..c4110a5966 100644 --- a/Makefile +++ b/Makefile @@ -37,7 +37,7 @@ ACN_VERSION ?= $(shell git describe --exclude "azure-ipam*" --exclude "cni- AZURE_IPAM_VERSION ?= $(notdir $(shell git describe --match "azure-ipam*" --tags --always)) CNI_VERSION ?= $(ACN_VERSION) CNI_DROPGZ_VERSION ?= $(notdir $(shell git describe --match "cni-dropgz*" --tags --always)) -CNI_DROPGZ_VERSION ?= $(notdir $(shell git describe --match "cni-dropgz-test*" --tags --always)) +CNI_DROPGZ_TEST_VERSION ?= $(notdir $(shell git describe --match "cni-dropgz-test*" --tags --always)) CNS_VERSION ?= $(ACN_VERSION) NPM_VERSION ?= $(ACN_VERSION) ZAPAI_VERSION ?= $(notdir $(shell git describe --match "zapai*" --tags --always)) From 221f83919d9f155b13e04c6109431d56eb492291 Mon Sep 17 00:00:00 2001 From: camrynl <31013536+camrynl@users.noreply.github.com> Date: Tue, 27 Sep 2022 10:37:54 -0700 Subject: [PATCH 06/10] update go version for dropgz --- dropgz/build/cniTest.Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dropgz/build/cniTest.Dockerfile b/dropgz/build/cniTest.Dockerfile index c5c18ec214..5fc4986ffe 100644 --- a/dropgz/build/cniTest.Dockerfile +++ b/dropgz/build/cniTest.Dockerfile @@ -21,7 +21,7 @@ COPY --from=azure-vnet /azure-container-networking/bin/* pkg/embed/fs RUN cd pkg/embed/fs/ && sha256sum * > sum.txt RUN gzip --verbose --best --recursive pkg/embed/fs && for f in pkg/embed/fs/*.gz; do mv -- "$f" "${f%%.gz}"; done -FROM mcr.microsoft.com/oss/go/microsoft/golang:1.18 AS dropgz +FROM mcr.microsoft.com/oss/go/microsoft/golang:1.19 AS dropgz ARG VERSION WORKDIR /dropgz COPY --from=compressor /dropgz . From 6d2c7bfc2c49a34ce46420cf0bbd22bf8d94c711 Mon Sep 17 00:00:00 2001 From: camrynl <31013536+camrynl@users.noreply.github.com> Date: Tue, 27 Sep 2022 12:30:34 -0700 Subject: [PATCH 07/10] building vnet-ipam and vnet-telemetry --- dropgz/build/cniTest.Dockerfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dropgz/build/cniTest.Dockerfile b/dropgz/build/cniTest.Dockerfile index 5fc4986ffe..9ea72e2227 100644 --- a/dropgz/build/cniTest.Dockerfile +++ b/dropgz/build/cniTest.Dockerfile @@ -9,15 +9,18 @@ ARG VERSION WORKDIR /azure-container-networking COPY . . RUN CGO_ENABLED=0 go build -a -o bin/azure-vnet -trimpath -ldflags "-X main.version="$VERSION"" -gcflags="-dwarflocationlists=true" cni/network/plugin/main.go +RUN CGO_ENABLED=0 go build -a -o bin/azure-vnet-telemetry -trimpath -ldflags "-X main.version="$VERSION"" -gcflags="-dwarflocationlists=true" cni/network/plugin/main.go +RUN CGO_ENABLED=0 go build -a -o bin/azure-vnet-ipam -trimpath -ldflags "-X main.version="$VERSION"" -gcflags="-dwarflocationlists=true" cni/network/plugin/main.go FROM mcr.microsoft.com/cbl-mariner/base/core:2.0 AS compressor WORKDIR /dropgz COPY dropgz . -COPY --from=azure-vnet /azure-container-networking/bin/* pkg/embed/fs COPY --from=azure-ipam /azure-ipam/*.conflist pkg/embed/fs COPY --from=azure-ipam /azure-ipam/bin/* pkg/embed/fs COPY --from=azure-vnet /azure-container-networking/cni/*.conflist pkg/embed/fs/azure-swift.conflist -COPY --from=azure-vnet /azure-container-networking/bin/* pkg/embed/fs +COPY --from=azure-vnet /azure-container-networking/bin/azure-vnet pkg/embed/fs +COPY --from=azure-vnet /azure-container-networking/bin/azure-vnet-telemetry pkg/embed/fs +COPY --from=azure-vnet /azure-container-networking/bin/azure-vnet-ipam pkg/embed/fs RUN cd pkg/embed/fs/ && sha256sum * > sum.txt RUN gzip --verbose --best --recursive pkg/embed/fs && for f in pkg/embed/fs/*.gz; do mv -- "$f" "${f%%.gz}"; done From c174a8ccc75a8bddf638cffe6d016630c3691a04 Mon Sep 17 00:00:00 2001 From: camrynl <31013536+camrynl@users.noreply.github.com> Date: Tue, 27 Sep 2022 14:28:38 -0700 Subject: [PATCH 08/10] copy azure-vnet* to grab all vnet binaries --- dropgz/build/cniTest.Dockerfile | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/dropgz/build/cniTest.Dockerfile b/dropgz/build/cniTest.Dockerfile index 9ea72e2227..637e6943a8 100644 --- a/dropgz/build/cniTest.Dockerfile +++ b/dropgz/build/cniTest.Dockerfile @@ -9,8 +9,6 @@ ARG VERSION WORKDIR /azure-container-networking COPY . . RUN CGO_ENABLED=0 go build -a -o bin/azure-vnet -trimpath -ldflags "-X main.version="$VERSION"" -gcflags="-dwarflocationlists=true" cni/network/plugin/main.go -RUN CGO_ENABLED=0 go build -a -o bin/azure-vnet-telemetry -trimpath -ldflags "-X main.version="$VERSION"" -gcflags="-dwarflocationlists=true" cni/network/plugin/main.go -RUN CGO_ENABLED=0 go build -a -o bin/azure-vnet-ipam -trimpath -ldflags "-X main.version="$VERSION"" -gcflags="-dwarflocationlists=true" cni/network/plugin/main.go FROM mcr.microsoft.com/cbl-mariner/base/core:2.0 AS compressor WORKDIR /dropgz @@ -18,9 +16,8 @@ COPY dropgz . COPY --from=azure-ipam /azure-ipam/*.conflist pkg/embed/fs COPY --from=azure-ipam /azure-ipam/bin/* pkg/embed/fs COPY --from=azure-vnet /azure-container-networking/cni/*.conflist pkg/embed/fs/azure-swift.conflist -COPY --from=azure-vnet /azure-container-networking/bin/azure-vnet pkg/embed/fs -COPY --from=azure-vnet /azure-container-networking/bin/azure-vnet-telemetry pkg/embed/fs -COPY --from=azure-vnet /azure-container-networking/bin/azure-vnet-ipam pkg/embed/fs +COPY --from=azure-vnet /azure-container-networking/bin/* pkg/embed/fs +COPY --from=azure-vnet /azure-container-networking/azure-vnet* pkg/embed/fs RUN cd pkg/embed/fs/ && sha256sum * > sum.txt RUN gzip --verbose --best --recursive pkg/embed/fs && for f in pkg/embed/fs/*.gz; do mv -- "$f" "${f%%.gz}"; done From 43db0e6a03f452ebe4916383fdfa506c1c057658 Mon Sep 17 00:00:00 2001 From: camrynl <31013536+camrynl@users.noreply.github.com> Date: Tue, 27 Sep 2022 15:08:10 -0700 Subject: [PATCH 09/10] modify build for vnet-ipam --- dropgz/build/cniTest.Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dropgz/build/cniTest.Dockerfile b/dropgz/build/cniTest.Dockerfile index 637e6943a8..73ce739a8b 100644 --- a/dropgz/build/cniTest.Dockerfile +++ b/dropgz/build/cniTest.Dockerfile @@ -9,6 +9,7 @@ ARG VERSION WORKDIR /azure-container-networking COPY . . RUN CGO_ENABLED=0 go build -a -o bin/azure-vnet -trimpath -ldflags "-X main.version="$VERSION"" -gcflags="-dwarflocationlists=true" cni/network/plugin/main.go +RUN CGO_ENABLED=0 go build -a -o bin/azure-vnet-ipam -trimpath -ldflags "-X main.version="$VERSION"" -gcflags="-dwarflocationlists=true" cni/ipam/plugin/main.go FROM mcr.microsoft.com/cbl-mariner/base/core:2.0 AS compressor WORKDIR /dropgz @@ -17,7 +18,7 @@ COPY --from=azure-ipam /azure-ipam/*.conflist pkg/embed/fs COPY --from=azure-ipam /azure-ipam/bin/* pkg/embed/fs COPY --from=azure-vnet /azure-container-networking/cni/*.conflist pkg/embed/fs/azure-swift.conflist COPY --from=azure-vnet /azure-container-networking/bin/* pkg/embed/fs -COPY --from=azure-vnet /azure-container-networking/azure-vnet* pkg/embed/fs +COPY --from=azure-vnet /azure-container-networking/bin/azure-vnet-ipam pkg/embed/fs RUN cd pkg/embed/fs/ && sha256sum * > sum.txt RUN gzip --verbose --best --recursive pkg/embed/fs && for f in pkg/embed/fs/*.gz; do mv -- "$f" "${f%%.gz}"; done From 8568afff1f356203a23964d229af863d28d7b929 Mon Sep 17 00:00:00 2001 From: camrynl <31013536+camrynl@users.noreply.github.com> Date: Tue, 27 Sep 2022 17:07:39 -0700 Subject: [PATCH 10/10] fix copying of cns conflist --- Makefile | 1 + dropgz/build/cniTest.Dockerfile | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index c4110a5966..e71f97715a 100644 --- a/Makefile +++ b/Makefile @@ -340,6 +340,7 @@ cni-dropgz-test-image-name: # util target to print the CNI dropgz test image nam cni-dropgz-test-image: ## build cni-dropgz-test container image. $(MAKE) container \ DOCKERFILE=dropgz/build/cniTest.Dockerfile \ + EXTRA_BUILD_ARGS='--build-arg OS=$(OS)' \ IMAGE=$(CNI_DROPGZ_TEST_IMAGE) \ TAG=$(CNI_DROPGZ_TEST_PLATFORM_TAG) diff --git a/dropgz/build/cniTest.Dockerfile b/dropgz/build/cniTest.Dockerfile index 73ce739a8b..dea631fb1b 100644 --- a/dropgz/build/cniTest.Dockerfile +++ b/dropgz/build/cniTest.Dockerfile @@ -9,16 +9,15 @@ ARG VERSION WORKDIR /azure-container-networking COPY . . RUN CGO_ENABLED=0 go build -a -o bin/azure-vnet -trimpath -ldflags "-X main.version="$VERSION"" -gcflags="-dwarflocationlists=true" cni/network/plugin/main.go -RUN CGO_ENABLED=0 go build -a -o bin/azure-vnet-ipam -trimpath -ldflags "-X main.version="$VERSION"" -gcflags="-dwarflocationlists=true" cni/ipam/plugin/main.go FROM mcr.microsoft.com/cbl-mariner/base/core:2.0 AS compressor +ARG OS WORKDIR /dropgz COPY dropgz . COPY --from=azure-ipam /azure-ipam/*.conflist pkg/embed/fs COPY --from=azure-ipam /azure-ipam/bin/* pkg/embed/fs -COPY --from=azure-vnet /azure-container-networking/cni/*.conflist pkg/embed/fs/azure-swift.conflist +COPY --from=azure-vnet /azure-container-networking/cni/azure-$OS-swift.conflist pkg/embed/fs/azure-swift.conflist COPY --from=azure-vnet /azure-container-networking/bin/* pkg/embed/fs -COPY --from=azure-vnet /azure-container-networking/bin/azure-vnet-ipam pkg/embed/fs RUN cd pkg/embed/fs/ && sha256sum * > sum.txt RUN gzip --verbose --best --recursive pkg/embed/fs && for f in pkg/embed/fs/*.gz; do mv -- "$f" "${f%%.gz}"; done