From e61fca8c68e04559fa33439402ece1bca08b4dde Mon Sep 17 00:00:00 2001 From: Evan Baker Date: Mon, 20 Nov 2023 21:59:16 -0600 Subject: [PATCH] chore: migrate to azure-cni and azure-ipam from dropgz-test (#2372) chore: migrate to azure-cni from dropgz-test Signed-off-by: Evan Baker --- .../cilium-overlay-load-test-template.yaml | 4 +- .../cni/cilium/nightly-release-test.yml | 1 - .pipelines/cni/pipeline.yaml | 38 ++++-- .../cni/singletenancy/cniv1-template.yaml | 18 ++- .../singletenancy/linux-cniv2-template.yaml | 6 +- .pipelines/pipeline.yaml | 125 +++--------------- .../aks-swift/e2e-job-template.yaml | 2 - .../aks-swift/e2e-step-template.yaml | 33 ++--- .../singletenancy/aks/e2e-job-template.yaml | 4 - .../singletenancy/aks/e2e-step-template.yaml | 16 +-- .../azure-cni-overlay-e2e-job-template.yaml | 2 - .../azure-cni-overlay-e2e-step-template.yaml | 20 +-- .../cilium-overlay-e2e-job-template.yaml | 2 - .../cilium-overlay-e2e-step-template.yaml | 21 +-- .../cilium/cilium-e2e-job-template.yaml | 2 - .../cilium/cilium-e2e-step-template.yaml | 14 +- .../dualstackoverlay-e2e-job-template.yaml | 2 - .../dualstackoverlay-e2e-step-template.yaml | 17 +-- Makefile | 67 ++-------- azure-ipam/linux.Dockerfile | 4 +- azure-ipam/windows.Dockerfile | 4 +- cni/linux.Dockerfile | 4 +- cni/windows.Dockerfile | 4 +- dropgz/build/cniTest_linux.Dockerfile | 40 ------ dropgz/build/cniTest_windows.Dockerfile | 30 ----- dropgz/build/windows.Dockerfile | 76 +++++------ hack/manifests/cni-installer-v1.yaml | 2 +- hack/manifests/cni-installer.yaml | 2 +- .../manifests/cilium/cns-write-ovly.yaml | 4 +- .../cni/cni-installer-v1-windows.yaml | 12 +- .../manifests/cni/cni-installer-v1.yaml | 4 +- .../manifests/cns/daemonset-linux.yaml | 4 +- .../manifests/cns/daemonset-windows.yaml | 8 +- test/internal/kubernetes/utils.go | 13 -- test/internal/kubernetes/utils_create.go | 94 ++++++------- 35 files changed, 199 insertions(+), 500 deletions(-) delete mode 100644 dropgz/build/cniTest_linux.Dockerfile delete mode 100644 dropgz/build/cniTest_windows.Dockerfile diff --git a/.pipelines/cni/cilium/cilium-overlay-load-test-template.yaml b/.pipelines/cni/cilium/cilium-overlay-load-test-template.yaml index d42f9d90c9..ef6520b28d 100644 --- a/.pipelines/cni/cilium/cilium-overlay-load-test-template.yaml +++ b/.pipelines/cni/cilium/cilium-overlay-load-test-template.yaml @@ -5,7 +5,6 @@ parameters: clusterName: "cilium-overlay" nodeCount: 10 vmSize: "Standard_DS4_v2" - testDropgz: true os: "linux" arch: "" osSKU: Ubuntu @@ -42,7 +41,6 @@ stages: variables: commitID: $[ stagedependencies.setup.env.outputs['SetEnvVars.commitID'] ] cnsVersion: $[ stagedependencies.setup.env.outputs['SetEnvVars.cnsVersion'] ] - dropgzVersion: $[ stagedependencies.setup.env.outputs['SetEnvVars.dropgzVersion'] ] pool: name: "$(BUILD_POOL_NAME_DEFAULT)" dependsOn: @@ -80,7 +78,7 @@ stages: kubectl get po -owide -A echo "Deploy Azure-CNS" - sudo -E env "PATH=$PATH" make test-integration CNS_VERSION=$(cnsVersion) CNI_DROPGZ_VERSION=$(dropgzVersion) INSTALL_CNS=true INSTALL_OVERLAY=true TEST_DROPGZ=${{ parameters.testDropgz }} CNS_IMAGE_REPO=$(CNS_IMAGE_REPO) + sudo -E env "PATH=$PATH" make test-integration AZURE_IPAM_VERSION=$(make azure-ipam-version) CNS_VERSION=$(make cns-version) INSTALL_CNS=true INSTALL_OVERLAY=true CNS_IMAGE_REPO=$(CNS_IMAGE_REPO) kubectl get po -owide -A - job: deploy_pods condition: and( and( not(canceled()), not(failed()) ), or( contains(variables.CONTROL_SCENARIO, 'scaleTest') , contains(variables.CONTROL_SCENARIO, 'all') ) ) diff --git a/.pipelines/cni/cilium/nightly-release-test.yml b/.pipelines/cni/cilium/nightly-release-test.yml index a1eb33c949..e8e86bb4f2 100644 --- a/.pipelines/cni/cilium/nightly-release-test.yml +++ b/.pipelines/cni/cilium/nightly-release-test.yml @@ -89,7 +89,6 @@ stages: - template: ../../singletenancy/cilium-overlay/cilium-overlay-e2e-step-template.yaml parameters: name: "cilium_nightly" - testDropgz: "" clusterName: ciliumnightly-$(commitID) testHubble: true - job: logs diff --git a/.pipelines/cni/pipeline.yaml b/.pipelines/cni/pipeline.yaml index 53ddf1896f..415869ead8 100644 --- a/.pipelines/cni/pipeline.yaml +++ b/.pipelines/cni/pipeline.yaml @@ -16,12 +16,6 @@ stages: echo "##vso[task.setvariable variable=commitID;isOutput=true]$(echo $(make revision)-$(date "+%d%H%M"))" echo "##vso[task.setvariable variable=npmVersion;isOutput=true]$(make npm-version)" echo "##vso[task.setvariable variable=cnsVersion;isOutput=true]$(CNS_VERSION)" - - if [ -z $(DROP_GZ_VERSION) ]; then - echo "##vso[task.setvariable variable=dropgzVersion;isOutput=true]$(make cni-dropgz-test-version)" - else - echo "##vso[task.setvariable variable=dropgzVersion;isOutput=true]$(DROP_GZ_VERSION)" - fi name: "SetEnvVars" displayName: "Set Environment Variables" condition: always() @@ -36,13 +30,22 @@ stages: name: "$(BUILD_POOL_NAME_LINUX_AMD64)" strategy: matrix: - cni_dropgz_test_linux_amd64: + azure_ipam_linux_amd64: arch: amd64 - name: cni-dropgz-test + name: azure-ipam os: linux - cni_dropgz_test_windows2022_amd64: + azure_ipam_windows2022_amd64: arch: amd64 - name: cni-dropgz-test + name: azure-ipam + os: windows + os_version: ltsc2022 + cni_linux_amd64: + arch: amd64 + name: cni + os: linux + cni_windows2022_amd64: + arch: amd64 + name: cni os: windows os_version: ltsc2022 npm_linux_amd64: @@ -67,9 +70,13 @@ stages: name: "$(BUILD_POOL_NAME_LINUX_ARM64)" strategy: matrix: - cni_dropgz_test_linux_arm64: + azure_ipam_linux_arm64: + arch: arm64 + name: azure-ipam + os: linux + cni_linux_arm64: arch: arm64 - name: cni-dropgz-test + name: cni os: linux npm_linux_arm64: arch: arm64 @@ -125,8 +132,11 @@ stages: name: "$(BUILD_POOL_NAME_DEFAULT)" strategy: matrix: - cni_dropgz_test: - name: cni-dropgz-test + azure-ipam: + name: azure-ipam + platforms: linux/amd64 linux/arm64 windows/amd64 + cni: + name: cni platforms: linux/amd64 linux/arm64 windows/amd64 npm: name: npm diff --git a/.pipelines/cni/singletenancy/cniv1-template.yaml b/.pipelines/cni/singletenancy/cniv1-template.yaml index e10749aa4c..ebba7e9eb6 100644 --- a/.pipelines/cni/singletenancy/cniv1-template.yaml +++ b/.pipelines/cni/singletenancy/cniv1-template.yaml @@ -87,7 +87,6 @@ stages: variables: commitID: $[ stagedependencies.setup.env.outputs['SetEnvVars.commitID'] ] npmVersion: $[ stagedependencies.setup.env.outputs['SetEnvVars.npmVersion'] ] - dropgzVersion: $[ stagedependencies.setup.env.outputs['SetEnvVars.dropgzVersion'] ] pool: name: $(BUILD_POOL_NAME_DEFAULT) dependsOn: @@ -110,24 +109,24 @@ stages: echo "Upload CNI" echo "Deploying on Linux nodes" if [ "${{parameters.os}}" == "windows" ]; then - export DROP_GZ_URL=$( make cni-dropgz-test-image-name-and-tag OS='linux' ARCH=${{ parameters.arch }} CNI_DROPGZ_TEST_VERSION=$(dropgzVersion)) - echo "Dropgz image: $DROP_GZ_URL" + export CNI_IMAGE=$(make cni-image-name-and-tag OS='linux' ARCH=${{ parameters.arch }} CNI_VERSION=$(make cni-version)) + echo "CNI image: $CNI_IMAGE" envsubst < ./test/integration/manifests/cni/cni-installer-v1.yaml | kubectl apply -f - kubectl rollout status daemonset/azure-cni -n kube-system echo "Deploying on windows nodes" - export DROP_GZ_URL=$( make cni-dropgz-test-image-name-and-tag OS='windows' ARCH=${{ parameters.arch }} OS_VERSION=${{ parameters.os_version }} CNI_DROPGZ_TEST_VERSION=$(dropgzVersion)) - echo "Dropgz image: $DROP_GZ_URL" + export CNI_IMAGE=$(make cni-image-name-and-tag OS='windows' ARCH=${{ parameters.arch }} OS_VERSION=${{ parameters.os_version }} CNI_VERSION=$(make cni-version)) + echo "CNI image: $CNI_IMAGE" envsubst < ./test/integration/manifests/cni/cni-installer-v1-windows.yaml | kubectl apply -f - kubectl rollout status daemonset/azure-cni-windows -n kube-system else - export DROP_GZ_URL=$( make cni-dropgz-test-image-name-and-tag OS=${{ parameters.os }} ARCH=${{ parameters.arch }} CNI_DROPGZ_TEST_VERSION=$(dropgzVersion)) - echo "Dropgz image: $DROP_GZ_URL" + export CNI_IMAGE=$(make cni-image-name-and-tag OS=${{ parameters.os }} ARCH=${{ parameters.arch }} CNI_VERSION=$(make cni-version)) + echo "CNI image: $CNI_IMAGE" envsubst < ./test/integration/manifests/cni/cni-installer-v1.yaml | kubectl apply -f - kubectl rollout status daemonset/azure-cni -n kube-system fi kubectl get pods -A -owide - name: "UploadCNI" - displayName: "Upload CNI" + name: "deployCNI" + displayName: "Deploy CNI" - template: ../../npm/npm-cni-integration-test.yaml parameters: clusterName: ${{ parameters.clusterName }}-$(commitID) @@ -227,7 +226,6 @@ stages: variables: commitID: $[ stagedependencies.setup.env.outputs['SetEnvVars.commitID'] ] npmVersion: $[ stagedependencies.setup.env.outputs['SetEnvVars.npmVersion'] ] - dropgzVersion: $[ stagedependencies.setup.env.outputs['SetEnvVars.dropgzVersion'] ] pool: name: $(BUILD_POOL_NAME_DEFAULT) dependsOn: diff --git a/.pipelines/cni/singletenancy/linux-cniv2-template.yaml b/.pipelines/cni/singletenancy/linux-cniv2-template.yaml index 6fbe806e33..ee71e83ea2 100644 --- a/.pipelines/cni/singletenancy/linux-cniv2-template.yaml +++ b/.pipelines/cni/singletenancy/linux-cniv2-template.yaml @@ -7,7 +7,6 @@ parameters: vmSize: "" os: linux arch: "" - testDropgz: true osSKU: Ubuntu # CNIv2 @@ -80,7 +79,6 @@ stages: - stage: ${{ parameters.name }} variables: commitID: $[ stagedependencies.setup.env.outputs['SetEnvVars.commitID'] ] - dropgzVersion: $[ stagedependencies.setup.env.outputs['SetEnvVars.dropgzVersion'] ] cnsVersion: $[ stagedependencies.setup.env.outputs['SetEnvVars.cnsVersion'] ] npmVersion: $[ stagedependencies.setup.env.outputs['SetEnvVars.npmVersion'] ] pool: @@ -106,7 +104,7 @@ stages: make -C ./hack/aks set-kubeconf AZCLI=az CLUSTER=${{ parameters.clusterName }}-$(commitID) kubectl cluster-info kubectl get po -owide -A - sudo -E env "PATH=$PATH" make test-integration CNS_VERSION=$(cnsVersion) CNI_DROPGZ_VERSION=$(dropgzVersion) INSTALL_CNS=true INSTALL_AZURE_CNI_OVERLAY=true TEST_DROPGZ=${{ parameters.testDropgz }} CNS_IMAGE_REPO=$(CNS_IMAGE_REPO) + sudo -E env "PATH=$PATH" make test-integration CNS_VERSION=$(make cns-version) CNI_VERSION=$(make cni-version) INSTALL_CNS=true INSTALL_AZURE_CNI_OVERLAY=true CNS_IMAGE_REPO=$(CNS_IMAGE_REPO) name: "overlaye2e" displayName: "Overlay Integration" - ${{ if contains(parameters.clusterType, 'swift') }}: @@ -121,7 +119,7 @@ stages: make -C ./hack/aks set-kubeconf AZCLI=az CLUSTER=${{ parameters.clusterName }}-$(commitID) kubectl cluster-info kubectl get po -owide -A - sudo -E env "PATH=$PATH" make test-integration CNS_VERSION=$(cnsVersion) CNI_DROPGZ_VERSION=$(dropgzVersion) INSTALL_CNS=true INSTALL_AZURE_VNET=true TEST_DROPGZ=${{ parameters.testDropgz }} CNS_IMAGE_REPO=$(CNS_IMAGE_REPO) + sudo -E env "PATH=$PATH" make test-integration CNS_VERSION=$(make cns-version) CNI_VERSION=$(make cni-version) INSTALL_CNS=true INSTALL_AZURE_VNET=true CNS_IMAGE_REPO=$(CNS_IMAGE_REPO) name: "swifte2e" displayName: "Swift Integration" - template: ../../npm/npm-cni-integration-test.yaml diff --git a/.pipelines/pipeline.yaml b/.pipelines/pipeline.yaml index a673b86de2..dcd6fae7d3 100644 --- a/.pipelines/pipeline.yaml +++ b/.pipelines/pipeline.yaml @@ -37,9 +37,7 @@ stages: echo "##vso[task.setvariable variable=StorageID;isOutput=true]$(echo ${BUILD_NUMBER//./-})" echo "##vso[task.setvariable variable=commitID;isOutput=true]$(echo $(make revision)-$(date "+%d%H%M"))" echo "##vso[task.setvariable variable=Tag;isOutput=true]$(make version)" - echo "##vso[task.setvariable variable=cniVersion;isOutput=true]$(make cni-version)" echo "##vso[task.setvariable variable=npmVersion;isOutput=true]$(make npm-version)" - echo "##vso[task.setvariable variable=dropgzVersion;isOutput=true]$(make cni-dropgz-version)" cat /etc/os-release uname -a sudo chown -R $(whoami):$(whoami) . @@ -191,10 +189,6 @@ stages: arch: amd64 name: cni-dropgz os: linux - cni_dropgz_test_linux_amd64: - arch: amd64 - name: cni-dropgz-test - os: linux cni_dropgz_windows2019_amd64: arch: amd64 name: cni-dropgz @@ -205,16 +199,6 @@ stages: name: cni-dropgz os: windows os_version: ltsc2022 - cni_dropgz_test_windows2019_amd64: - arch: amd64 - name: cni-dropgz-test - os: windows - os_version: ltsc2019 - cni_dropgz_test_windows2022_amd64: - arch: amd64 - name: cni-dropgz-test - os: windows - os_version: ltsc2022 cns_linux_amd64: arch: amd64 name: cns @@ -265,10 +249,6 @@ stages: arch: arm64 name: cni-dropgz os: linux - cni_dropgz_test_linux_arm64: - arch: arm64 - name: cni-dropgz-test - os: linux cns_linux_arm64: arch: arm64 name: cns @@ -342,10 +322,6 @@ stages: name: cni-dropgz os_versions: ltsc2019 ltsc2022 platforms: linux/amd64 linux/arm64 windows/amd64 - cni_dropgz_test: - name: cni-dropgz-test - os_versions: ltsc2019 ltsc2022 - platforms: linux/amd64 linux/arm64 windows/amd64 cns: name: cns os_versions: ltsc2019 ltsc2022 @@ -377,46 +353,22 @@ stages: parameters: name: "cilium_e2e" displayName: Cilium - testDropgz: "" clusterType: swift-byocni-nokubeproxy-up clusterName: "ciliume2e" vmSize: Standard_B2ms k8sVersion: "" - dependsOn: "containerize" - - - template: singletenancy/cilium/cilium-e2e-job-template.yaml - parameters: - name: "cilium_podsubnet_cni_e2e" - displayName: CNI - Cilium Podsubnet - testDropgz: true - clusterType: swift-byocni-nokubeproxy-up - clusterName: "cilpodcnie2e" - vmSize: Standard_B2ms - k8sVersion: "" - dependsOn: "containerize" + dependsOn: "test" # Cilium Overlay E2E tests - template: singletenancy/cilium-overlay/cilium-overlay-e2e-job-template.yaml parameters: name: "cilium_overlay_e2e" displayName: Cilium on AKS Overlay - testDropgz: "" clusterType: overlay-byocni-nokubeproxy-up clusterName: "cilovere2e" vmSize: Standard_B2ms k8sVersion: "" - dependsOn: "containerize" - - - template: singletenancy/cilium-overlay/cilium-overlay-e2e-job-template.yaml - parameters: - name: "cilium_overlay_cni_e2e" - displayName: CNI - Cilium on AKS Overlay - testDropgz: true - clusterType: overlay-byocni-nokubeproxy-up - clusterName: "cilovercnie2e" - vmSize: Standard_B2ms - k8sVersion: "" - dependsOn: "containerize" + dependsOn: "test" # Azure Overlay E2E tests - template: singletenancy/azure-cni-overlay/azure-cni-overlay-e2e-job-template.yaml @@ -424,47 +376,22 @@ stages: name: "azure_overlay_e2e" displayName: Azure Overlay os: linux - testDropgz: "" clusterType: overlay-byocni-up clusterName: "azovere2e" vmSize: Standard_B2ms k8sVersion: "" - dependsOn: "containerize" - - - template: singletenancy/azure-cni-overlay/azure-cni-overlay-e2e-job-template.yaml - parameters: - name: "azure_overlay_cni_e2e" - displayName: CNI - Azure Overlay - os: linux - testDropgz: true - clusterType: overlay-byocni-up - clusterName: "azovercnie2e" - vmSize: Standard_B2ms - k8sVersion: "" - dependsOn: "containerize" + dependsOn: "test" # AKS Swift E2E tests - template: singletenancy/aks-swift/e2e-job-template.yaml parameters: name: "aks_swift_e2e" displayName: AKS Swift Ubuntu - testDropgz: "" clusterType: swift-byocni-up clusterName: "swifte2e" vmSize: Standard_B2s k8sVersion: "" - dependsOn: "containerize" - - - template: singletenancy/aks-swift/e2e-job-template.yaml - parameters: - name: "aks_swift_cni_e2e" - displayName: CNI - AKS Swift - testDropgz: true - clusterType: swift-byocni-up - clusterName: "swiftcnie2e" - vmSize: Standard_B2ms - k8sVersion: "" - dependsOn: "containerize" + dependsOn: "test" # CNIv1 E2E tests - template: singletenancy/aks/e2e-job-template.yaml @@ -478,7 +405,7 @@ stages: vmSize: Standard_B2s k8sVersion: 1.25 scaleup: 100 - dependsOn: "containerize" + dependsOn: "test" - template: singletenancy/aks/e2e-job-template.yaml parameters: @@ -491,7 +418,7 @@ stages: vmSize: Standard_B2ms os_version: "ltsc2022" scaleup: 50 - dependsOn: "containerize" + dependsOn: "test" # CNI dual stack overlay E2E tests - template: singletenancy/dualstack-overlay/dualstackoverlay-e2e-job-template.yaml @@ -502,25 +429,20 @@ stages: clusterType: dualstack-overlay-byocni-up clusterName: "dsovere2e" vmSize: Standard_B2ms - dependsOn: "containerize" - testDropgz: true + dependsOn: "test" - stage: delete displayName: Delete Clusters condition: always() dependsOn: - setup - - "azure_overlay_e2e" - - "azure_overlay_cni_e2e" - - "aks_swift_e2e" - - "aks_swift_cni_e2e" - - "cilium_e2e" - - "cilium_podsubnet_cni_e2e" - - "cilium_overlay_e2e" - - "cilium_overlay_cni_e2e" - - "aks_ubuntu_22_linux_e2e" - - "aks_windows_22_e2e" - - "dualstackoverlay_e2e" + - azure_overlay_e2e + - aks_swift_e2e + - cilium_e2e + - cilium_overlay_e2e + - aks_ubuntu_22_linux_e2e + - aks_windows_22_e2e + - dualstackoverlay_e2e variables: commitID: $[ stagedependencies.setup.env.outputs['EnvironmentalVariables.commitID'] ] jobs: @@ -593,18 +515,13 @@ stages: - stage: cleanup displayName: Cleanup dependsOn: - - "azure_overlay_e2e" - - "azure_overlay_cni_e2e" - - "aks_swift_e2e" - - "aks_swift_cni_e2e" - - "cilium_e2e" - - "cilium_podsubnet_cni_e2e" - - "cilium_overlay_e2e" - - "cilium_overlay_cni_e2e" - - "aks_ubuntu_22_linux_e2e" - - "aks_windows_22_e2e" - - "dualstackoverlay_e2e" - + - azure_overlay_e2e + - aks_swift_e2e + - cilium_e2e + - cilium_overlay_e2e + - aks_ubuntu_22_linux_e2e + - aks_windows_22_e2e + - dualstackoverlay_e2e jobs: - job: delete_remote_artifacts displayName: Delete remote artifacts diff --git a/.pipelines/singletenancy/aks-swift/e2e-job-template.yaml b/.pipelines/singletenancy/aks-swift/e2e-job-template.yaml index 3868664ff7..0914aafc47 100644 --- a/.pipelines/singletenancy/aks-swift/e2e-job-template.yaml +++ b/.pipelines/singletenancy/aks-swift/e2e-job-template.yaml @@ -1,7 +1,6 @@ parameters: name: "" displayName: "" - testDropgz: "" clusterType: "" clusterName: "" vmSize: "" @@ -59,7 +58,6 @@ stages: - template: e2e-step-template.yaml parameters: name: ${{ parameters.name }} - testDropgz: ${{ parameters.testDropgz }} clusterName: ${{ parameters.clusterName }}-$(commitID) - job: failedE2ELogs diff --git a/.pipelines/singletenancy/aks-swift/e2e-step-template.yaml b/.pipelines/singletenancy/aks-swift/e2e-step-template.yaml index 0563cafafe..61b39e23bb 100644 --- a/.pipelines/singletenancy/aks-swift/e2e-step-template.yaml +++ b/.pipelines/singletenancy/aks-swift/e2e-step-template.yaml @@ -1,6 +1,5 @@ parameters: name: "" - testDropgz: "" clusterName: "" steps: @@ -48,23 +47,12 @@ steps: name: "installKubetest" displayName: "Set up Conformance Tests" - - ${{ if eq( parameters['testDropgz'], true) }}: - - script: | - echo "##vso[task.setvariable variable=dropgzVersion]$(make cni-dropgz-test-version)" - name: dropgzTestVersion - displayName: "Dropgz Test Version" - - ${{ else }}: - - script: | - echo "##vso[task.setvariable variable=dropgzVersion]$(make cni-dropgz-version)" - name: dropgzVersion - displayName: "Dropgz Version" - - script: | ls -lah pwd kubectl cluster-info kubectl get po -owide -A - sudo -E env "PATH=$PATH" make test-integration CNS_VERSION=$(make cns-version) CNI_DROPGZ_VERSION=$(dropgzVersion) INSTALL_CNS=true INSTALL_AZURE_VNET=true TEST_DROPGZ=${{ parameters.testDropgz }} + sudo -E env "PATH=$PATH" make test-integration CNS_VERSION=$(make cns-version) CNI_VERSION=$(make cni-version) INSTALL_CNS=true INSTALL_AZURE_VNET=true retryCountOnTaskFailure: 3 name: "aksswifte2e" displayName: "Run AKS Swift E2E" @@ -111,16 +99,15 @@ steps: name: "WireserverMetadataConnectivityTests" displayName: "Run Wireserver and Metadata Connectivity Tests" - - ${{ if eq( parameters['testDropgz'], true) }}: - - script: | - cd hack/scripts - chmod +x async-delete-test.sh - ./async-delete-test.sh - if ! [ -z $(kubectl -n kube-system get ds azure-cns | grep non-existing) ]; then - kubectl -n kube-system patch daemonset azure-cns --type json -p='[{"op": "remove", "path": "/spec/template/spec/nodeSelector/non-existing"}]' - fi - name: "testAsyncDelete" - displayName: "Verify Async Delete when CNS is down" + - script: | + cd hack/scripts + chmod +x async-delete-test.sh + ./async-delete-test.sh + if ! [ -z $(kubectl -n kube-system get ds azure-cns | grep non-existing) ]; then + kubectl -n kube-system patch daemonset azure-cns --type json -p='[{"op": "remove", "path": "/spec/template/spec/nodeSelector/non-existing"}]' + fi + name: "testAsyncDelete" + displayName: "Verify Async Delete when CNS is down" - script: | ARTIFACT_DIR=$(Build.ArtifactStagingDirectory)/aks-swift-output/ diff --git a/.pipelines/singletenancy/aks/e2e-job-template.yaml b/.pipelines/singletenancy/aks/e2e-job-template.yaml index 3d270facf1..869ef28484 100644 --- a/.pipelines/singletenancy/aks/e2e-job-template.yaml +++ b/.pipelines/singletenancy/aks/e2e-job-template.yaml @@ -40,8 +40,6 @@ stages: GOPATH: "$(Agent.TempDirectory)/go" # Go workspace path GOBIN: "$(GOPATH)/bin" # Go binaries path modulePath: "$(GOPATH)/src/github.com/Azure/azure-container-networking" - dropgzVersion: $[ stagedependencies.setup.env.outputs['EnvironmentalVariables.dropgzVersion'] ] - cniVersion: $[ stagedependencies.setup.env.outputs['EnvironmentalVariables.cniVersion'] ] commitID: $[ stagedependencies.setup.env.outputs['EnvironmentalVariables.commitID'] ] dependsOn: - setup @@ -65,8 +63,6 @@ stages: arch: ${{ parameters.arch }} os: ${{ parameters.os }} os_version: ${{ parameters.os_version }} - version: $(dropgzVersion) - cniVersion: $(cniVersion) scaleup: ${{ parameters.scaleup }} - template: ../../cni/k8s-e2e/k8s-e2e-job-template.yaml diff --git a/.pipelines/singletenancy/aks/e2e-step-template.yaml b/.pipelines/singletenancy/aks/e2e-step-template.yaml index fc58cf97c7..41128844db 100644 --- a/.pipelines/singletenancy/aks/e2e-step-template.yaml +++ b/.pipelines/singletenancy/aks/e2e-step-template.yaml @@ -32,23 +32,23 @@ steps: echo "Upload CNI" echo "Deploying on Linux nodes" if [ "${{parameters.os}}" == "windows" ]; then - export DROP_GZ_URL=$( make cni-dropgz-test-image-name-and-tag OS='linux' ARCH=${{ parameters.arch }} CNI_DROPGZ_VERSION=${{ parameters.version }}) - echo "Dropgz image: $DROP_GZ_URL" + export CNI_IMAGE=$(make cni-image-name-and-tag OS='linux' ARCH=${{ parameters.arch }}) + echo "CNI image: $CNI_IMAGE" envsubst < ./test/integration/manifests/cni/cni-installer-v1.yaml | kubectl apply -f - kubectl rollout status daemonset/azure-cni -n kube-system echo "Deploying on windows nodes" - export DROP_GZ_URL=$( make cni-dropgz-test-image-name-and-tag OS='windows' ARCH=${{ parameters.arch }} OS_VERSION=${{ parameters.os_version }} CNI_DROPGZ_VERSION=${{ parameters.version }}) - echo "Dropgz image: $DROP_GZ_URL" + export CNI_IMAGE=$( make cni-image-name-and-tag OS='windows' ARCH=${{ parameters.arch }} OS_VERSION=${{ parameters.os_version }}) + echo "CNI image: $CNI_IMAGE" envsubst < ./test/integration/manifests/cni/cni-installer-v1-windows.yaml | kubectl apply -f - kubectl rollout status daemonset/azure-cni-windows -n kube-system else - export DROP_GZ_URL=$( make cni-dropgz-test-image-name-and-tag OS=${{ parameters.os }} ARCH=${{ parameters.arch }} CNI_DROPGZ_VERSION=${{ parameters.version }}) - echo "Dropgz image: $DROP_GZ_URL" + export CNI_IMAGE=$(make cni-image-name-and-tag OS=${{ parameters.os }} ARCH=${{ parameters.arch }}) + echo "CNI image: $CNI_IMAGE" envsubst < ./test/integration/manifests/cni/cni-installer-v1.yaml | kubectl apply -f - kubectl rollout status daemonset/azure-cni -n kube-system fi - name: "UploadCni" - displayName: "Upload CNI" + name: "deployCNI" + displayName: "Deploy CNI" - task: AzureCLI@1 inputs: azureSubscription: $(BUILD_VALIDATIONS_SERVICE_CONNECTION) diff --git a/.pipelines/singletenancy/azure-cni-overlay/azure-cni-overlay-e2e-job-template.yaml b/.pipelines/singletenancy/azure-cni-overlay/azure-cni-overlay-e2e-job-template.yaml index d2aa29936f..a359738162 100644 --- a/.pipelines/singletenancy/azure-cni-overlay/azure-cni-overlay-e2e-job-template.yaml +++ b/.pipelines/singletenancy/azure-cni-overlay/azure-cni-overlay-e2e-job-template.yaml @@ -1,7 +1,6 @@ parameters: name: "" displayName: "" - testDropgz: "" clusterType: "" clusterName: "" vmSize: "" @@ -56,7 +55,6 @@ stages: - template: azure-cni-overlay-e2e-step-template.yaml parameters: name: ${{ parameters.name }} - testDropgz: ${{ parameters.testDropgz }} clusterName: ${{ parameters.clusterName }}-$(commitID) - template: ../../cni/k8s-e2e/k8s-e2e-job-template.yaml diff --git a/.pipelines/singletenancy/azure-cni-overlay/azure-cni-overlay-e2e-step-template.yaml b/.pipelines/singletenancy/azure-cni-overlay/azure-cni-overlay-e2e-step-template.yaml index 1b04521dc3..a85677d1dd 100644 --- a/.pipelines/singletenancy/azure-cni-overlay/azure-cni-overlay-e2e-step-template.yaml +++ b/.pipelines/singletenancy/azure-cni-overlay/azure-cni-overlay-e2e-step-template.yaml @@ -1,6 +1,5 @@ parameters: name: "" - testDropgz: "" clusterName: "" steps: @@ -37,22 +36,10 @@ steps: make -C ./hack/aks set-kubeconf AZCLI=az CLUSTER=${{ parameters.clusterName }} name: "kubeconfig" displayName: "Set Kubeconfig" - - - ${{ if eq( parameters['testDropgz'], true) }}: - - script: | - echo "##vso[task.setvariable variable=dropgzVersion]$(make cni-dropgz-test-version)" - name: dropgzTestVersion - displayName: "Dropgz Test Version" - - ${{ else }}: - - script: | - echo "##vso[task.setvariable variable=dropgzVersion]$(make cni-dropgz-version)" - name: dropgzVersion - displayName: "Dropgz Version" - + - script: | echo "Start Integration Tests on Overlay Cluster" - CNS=$(make cns-version) - sudo -E env "PATH=$PATH" make test-integration CNS_VERSION=${CNS} CNI_DROPGZ_VERSION=$(dropgzVersion) INSTALL_CNS=true INSTALL_AZURE_CNI_OVERLAY=true TEST_DROPGZ=${{ parameters.testDropgz }} + sudo -E env "PATH=$PATH" make test-integration AZURE_IPAM_VERSION=$(make azure-ipam-version) CNS_VERSION=$(make cns-version) INSTALL_CNS=true INSTALL_AZURE_CNI_OVERLAY=true retryCountOnTaskFailure: 3 name: "integrationTest" displayName: "Run CNS Integration Tests on AKS Overlay" @@ -164,8 +151,7 @@ steps: kubectl taint nodes $node node.cloudprovider.kubernetes.io/uninitialized=true:NoSchedule- fi done - CNS=$(make cns-version) - sudo -E env "PATH=$PATH" make test-load SCALE_UP=32 OS_TYPE=windows CNI_TYPE=cniv2 VALIDATE_STATEFILE=true INSTALL_CNS=true INSTALL_AZURE_CNI_OVERLAY=true VALIDATE_V4OVERLAY=true CNS_VERSION=${CNS} CNI_DROPGZ_VERSION=$(dropgzVersion) TEST_DROPGZ=${{ parameters.testDropgz }} CLEANUP=true + sudo -E env "PATH=$PATH" make test-load SCALE_UP=32 OS_TYPE=windows CNI_TYPE=cniv2 VALIDATE_STATEFILE=true INSTALL_CNS=true INSTALL_AZURE_CNI_OVERLAY=true VALIDATE_V4OVERLAY=true CNS_VERSION=$(make cns-version) CNI_VERSION=$(make cni-version) CLEANUP=true name: "WindowsOverlayControlPlaneScaleTests" displayName: "Windows v4Overlay ControlPlane Scale Tests" retryCountOnTaskFailure: 3 diff --git a/.pipelines/singletenancy/cilium-overlay/cilium-overlay-e2e-job-template.yaml b/.pipelines/singletenancy/cilium-overlay/cilium-overlay-e2e-job-template.yaml index 124ce2ea25..1de3f5930d 100644 --- a/.pipelines/singletenancy/cilium-overlay/cilium-overlay-e2e-job-template.yaml +++ b/.pipelines/singletenancy/cilium-overlay/cilium-overlay-e2e-job-template.yaml @@ -1,7 +1,6 @@ parameters: name: "" displayName: "" - testDropgz: "" clusterType: "" clusterName: "" vmSize: "" @@ -56,7 +55,6 @@ stages: - template: cilium-overlay-e2e-step-template.yaml parameters: name: ${{ parameters.name }} - testDropgz: ${{ parameters.testDropgz }} clusterName: ${{ parameters.clusterName }}-$(commitID) - job: failedE2ELogs diff --git a/.pipelines/singletenancy/cilium-overlay/cilium-overlay-e2e-step-template.yaml b/.pipelines/singletenancy/cilium-overlay/cilium-overlay-e2e-step-template.yaml index dc7a7da72b..925a3cd257 100644 --- a/.pipelines/singletenancy/cilium-overlay/cilium-overlay-e2e-step-template.yaml +++ b/.pipelines/singletenancy/cilium-overlay/cilium-overlay-e2e-step-template.yaml @@ -1,6 +1,5 @@ parameters: name: "" - testDropgz: "" clusterName: "" testHubble: false @@ -88,27 +87,9 @@ steps: name: "installKubetest" displayName: "Set up Conformance Tests" - - ${{ if eq( parameters['testDropgz'], true) }}: - - script: | - echo "##vso[task.setvariable variable=dropgzVersion]$(make cni-dropgz-test-version)" - name: dropgzTestVersion - displayName: "Dropgz Test Version" - - ${{ else }}: - - script: | - echo "##vso[task.setvariable variable=dropgzVersion]$(make cni-dropgz-version)" - name: dropgzVersion - displayName: "Dropgz Version" - - script: | echo "Start Azilium E2E Tests on Overlay Cluster" - # Nightly does not build images per commit. Will use existing image. - if [ "$CILIUM_VERSION_TAG" = "cilium-nightly-pipeline" ] - then - CNS=$(CNS_VERSION) DROPGZ=$(DROP_GZ_VERSION) && echo "Running nightly" - else - CNS=$(make cns-version) DROPGZ=$(dropgzVersion) - fi - sudo -E env "PATH=$PATH" make test-integration CNS_VERSION=${CNS} CNI_DROPGZ_VERSION=${DROPGZ} INSTALL_CNS=true INSTALL_OVERLAY=true TEST_DROPGZ=${{ parameters.testDropgz }} + sudo -E env "PATH=$PATH" make test-integration AZURE_IPAM_VERSION=$(make azure-ipam-version) CNS_VERSION=$(make cns-version) INSTALL_CNS=true INSTALL_OVERLAY=true retryCountOnTaskFailure: 3 name: "aziliumTest" displayName: "Run Azilium E2E on AKS Overlay" diff --git a/.pipelines/singletenancy/cilium/cilium-e2e-job-template.yaml b/.pipelines/singletenancy/cilium/cilium-e2e-job-template.yaml index 0beefb0cce..90b706817e 100644 --- a/.pipelines/singletenancy/cilium/cilium-e2e-job-template.yaml +++ b/.pipelines/singletenancy/cilium/cilium-e2e-job-template.yaml @@ -1,7 +1,6 @@ parameters: name: "" displayName: "" - testDropgz: "" clusterType: "" clusterName: "" vmSize: "" @@ -59,7 +58,6 @@ stages: - template: cilium-e2e-step-template.yaml parameters: name: ${{ parameters.name }} - testDropgz: ${{ parameters.testDropgz }} clusterName: ${{ parameters.clusterName }}-$(commitID) - job: failedE2ELogs diff --git a/.pipelines/singletenancy/cilium/cilium-e2e-step-template.yaml b/.pipelines/singletenancy/cilium/cilium-e2e-step-template.yaml index eb347089b5..2d95d6c859 100644 --- a/.pipelines/singletenancy/cilium/cilium-e2e-step-template.yaml +++ b/.pipelines/singletenancy/cilium/cilium-e2e-step-template.yaml @@ -1,6 +1,5 @@ parameters: name: "" - testDropgz: "" clusterName: "" steps: @@ -84,21 +83,10 @@ steps: name: "installKubetest" displayName: "Set up Conformance Tests" - - ${{ if eq( parameters['testDropgz'], true) }}: - - script: | - echo "##vso[task.setvariable variable=dropgzVersion]$(make cni-dropgz-test-version)" - name: dropgzTestVersion - displayName: "Dropgz Test Version" - - ${{ else }}: - - script: | - echo "##vso[task.setvariable variable=dropgzVersion]$(make cni-dropgz-version)" - name: dropgzVersion - displayName: "Dropgz Version" - - script: | echo "Start Azilium E2E Tests" kubectl get po -owide -A - sudo -E env "PATH=$PATH" make test-integration CNS_VERSION=$(make cns-version) CNI_DROPGZ_VERSION=$(dropgzVersion) INSTALL_CNS=true INSTALL_AZILIUM=true TEST_DROPGZ=${{ parameters.testDropgz }} + sudo -E env "PATH=$PATH" make test-integration AZURE_IPAM_VERSION=$(make azure-ipam-version) CNS_VERSION=$(make cns-version) INSTALL_CNS=true INSTALL_AZILIUM=true retryCountOnTaskFailure: 3 name: "aziliumTest" displayName: "Run Azilium E2E" diff --git a/.pipelines/singletenancy/dualstack-overlay/dualstackoverlay-e2e-job-template.yaml b/.pipelines/singletenancy/dualstack-overlay/dualstackoverlay-e2e-job-template.yaml index 37e119e858..4e93e6d1b2 100644 --- a/.pipelines/singletenancy/dualstack-overlay/dualstackoverlay-e2e-job-template.yaml +++ b/.pipelines/singletenancy/dualstack-overlay/dualstackoverlay-e2e-job-template.yaml @@ -1,7 +1,6 @@ parameters: name: "" displayName: "" - testDropgz: "" clusterType: "" clusterName: "" vmSize: "" @@ -56,7 +55,6 @@ stages: - template: dualstackoverlay-e2e-step-template.yaml parameters: name: ${{ parameters.name }} - testDropgz: ${{ parameters.testDropgz }} clusterName: ${{ parameters.clusterName }}-$(commitID) - template: ../../cni/k8s-e2e/k8s-e2e-job-template.yaml diff --git a/.pipelines/singletenancy/dualstack-overlay/dualstackoverlay-e2e-step-template.yaml b/.pipelines/singletenancy/dualstack-overlay/dualstackoverlay-e2e-step-template.yaml index ea20c90f36..003f897b3f 100644 --- a/.pipelines/singletenancy/dualstack-overlay/dualstackoverlay-e2e-step-template.yaml +++ b/.pipelines/singletenancy/dualstack-overlay/dualstackoverlay-e2e-step-template.yaml @@ -1,6 +1,5 @@ parameters: name: "" - testDropgz: "" clusterName: "" cni: "dualstack" @@ -32,21 +31,10 @@ steps: name: "kubeconfig" displayName: "Set Kubeconfig" - - ${{ if eq( parameters['testDropgz'], true) }}: - - script: | - echo "##vso[task.setvariable variable=dropgzVersion]$(make cni-dropgz-test-version)" - name: dropgzTestVersion - displayName: "Dropgz Test Version" - - ${{ else }}: - - script: | - echo "##vso[task.setvariable variable=dropgzVersion]$(make cni-dropgz-version)" - name: dropgzVersion - displayName: "Dropgz Version" - - script: | kubectl cluster-info kubectl get node - sudo -E env "PATH=$PATH" make test-integration CNS_VERSION=$(make cns-version) CNI_DROPGZ_VERSION=$(dropgzVersion) INSTALL_CNS=true INSTALL_DUALSTACK_OVERLAY=true TEST_DROPGZ=${{ parameters.testDropgz }} + sudo -E env "PATH=$PATH" make test-integration CNI_VERSION=$(make cni-version) CNS_VERSION=$(make cns-version) INSTALL_CNS=true INSTALL_DUALSTACK_OVERLAY=true kubectl get po -owide -A retryCountOnTaskFailure: 3 name: "integrationTest" @@ -143,8 +131,7 @@ steps: kubectl taint nodes $node node.cloudprovider.kubernetes.io/uninitialized=true:NoSchedule- fi done - CNS=$(make cns-version) - sudo -E env "PATH=$PATH" make test-load SCALE_UP=32 OS_TYPE=windows CNI_TYPE=cniv2 VALIDATE_STATEFILE=true INSTALL_CNS=true INSTALL_DUALSTACK_OVERLAY=true VALIDATE_DUALSTACK=true CNS_VERSION=${CNS} CNI_DROPGZ_VERSION=$(dropgzVersion) TEST_DROPGZ=${{ parameters.testDropgz }} CLEANUP=true + sudo -E env "PATH=$PATH" make test-load SCALE_UP=32 OS_TYPE=windows CNI_TYPE=cniv2 VALIDATE_STATEFILE=true INSTALL_CNS=true INSTALL_DUALSTACK_OVERLAY=true VALIDATE_DUALSTACK=true CNI_VERSION=$(make cni-version) CNS_VERSION=$(make cns-version) CLEANUP=true name: "WindowsDualStackOverlayControlPlaneScaleTests" displayName: "Windows DualStack Overlay ControlPlane Scale Tests" retryCountOnTaskFailure: 3 diff --git a/Makefile b/Makefile index e80f9f08ef..2fe3a52465 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,6 @@ 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)) -CNI_DROPGZ_TEST_VERSION ?= $(notdir $(shell git describe --match "dropgz-test*" --tags --always)) CNS_VERSION ?= $(ACN_VERSION) NPM_VERSION ?= $(ACN_VERSION) ZAPAI_VERSION ?= $(notdir $(shell git describe --match "zapai*" --tags --always)) @@ -158,9 +157,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) @@ -247,13 +243,12 @@ CONTAINER_TRANSPORT = docker endif ## Image name definitions. -ACNCLI_IMAGE = acncli -AZURE_IPAM_IMAGE = azure-ipam -CNI_IMAGE = azure-cni -CNI_DROPGZ_IMAGE = cni-dropgz -CNI_DROPGZ_TEST_IMAGE = cni-dropgz-test -CNS_IMAGE = azure-cns -NPM_IMAGE = azure-npm +ACNCLI_IMAGE = acncli +AZURE_IPAM_IMAGE = azure-ipam +CNI_IMAGE = azure-cni +CNI_DROPGZ_IMAGE = cni-dropgz +CNS_IMAGE = azure-cns +NPM_IMAGE = azure-npm ## Image platform tags. ACNCLI_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))$(if $(OS_VERSION),-$(OS_VERSION),)-$(ACN_VERSION) @@ -261,8 +256,7 @@ AZURE_IPAM_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))$(if $(OS_VERSION),-$(OS_VE AZURE_IPAM_WINDOWS_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))$(if $(OS_VERSION),-$(OS_VERSION),)-$(AZURE_IPAM_VERSION)-$(OS_SKU_WIN) CNI_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))$(if $(OS_VERSION),-$(OS_VERSION),)-$(CNI_VERSION) CNI_WINDOWS_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))$(if $(OS_VERSION),-$(OS_VERSION),)-$(CNI_VERSION)-$(OS_SKU_WIN) -CNI_DROPGZ_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))$(if $(OS_VERSION),-$(OS_VERSION),)-$(CNI_DROPGZ_VERSION) -CNI_DROPGZ_TEST_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))$(if $(OS_VERSION),-$(OS_VERSION),)-$(CNI_DROPGZ_TEST_VERSION) +CNI_DROPGZ_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))$(if $(OS_VERSION),-$(OS_VERSION),)-$(CNI_DROPGZ_VERSION) CNS_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))$(if $(OS_VERSION),-$(OS_VERSION),)-$(CNS_VERSION) CNS_WINDOWS_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))$(if $(OS_VERSION),-$(OS_VERSION),)-$(CNS_VERSION)-$(OS_SKU_WIN) NPM_PLATFORM_TAG ?= $(subst /,-,$(PLATFORM))$(if $(OS_VERSION),-$(OS_VERSION),)-$(NPM_VERSION) @@ -423,30 +417,6 @@ cni-dropgz-image-pull: ## pull cni-dropgz container image. IMAGE=$(CNI_DROPGZ_IMAGE) \ TAG=$(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-name-and-tag: # util target to print the CNI dropgz test image name and tag. - @echo $(IMAGE_REGISTRY)/$(CNI_DROPGZ_TEST_IMAGE):$(CNI_DROPGZ_TEST_PLATFORM_TAG) - -cni-dropgz-test-image: ## build cni-dropgz-test container image. - $(MAKE) container \ - DOCKERFILE=dropgz/build/cniTest_$(OS).Dockerfile \ - EXTRA_BUILD_ARGS='--build-arg OS=$(OS) --build-arg ARCH=$(ARCH) --build-arg OS_VERSION=$(OS_VERSION)' \ - 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) # cns @@ -638,23 +608,6 @@ cni-dropgz-skopeo-archive: ## export tar archive of cni-dropgz multiplat contain IMAGE=$(CNI_DROPGZ_IMAGE) \ TAG=$(CNI_DROPGZ_VERSION) -cni-dropgz-test-manifest-build: ## build cni-dropgz multiplat container manifest. - $(MAKE) manifest-build \ - PLATFORMS="$(PLATFORMS)" \ - IMAGE=$(CNI_DROPGZ_TEST_IMAGE) \ - TAG=$(CNI_DROPGZ_TEST_VERSION) \ - OS_VERSIONS="$(OS_VERSIONS)" - -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-build: ## build azure-cns multiplat container manifest. $(MAKE) manifest-build \ PLATFORMS="$(PLATFORMS)" \ @@ -825,12 +778,14 @@ test-all: ## run all unit tests. go test -mod=readonly -buildvcs=false -tags "unit" -coverpkg=$(COVER_FILTER) -race -covermode atomic -coverprofile=coverage.out $(COVER_PKG)/... test-integration: ## run all integration tests. - CNI_DROPGZ_VERSION=$(CNI_DROPGZ_VERSION) \ + AZURE_IPAM_VERSION=$(AZURE_IPAM_VERSION) \ + CNI_VERSION=$(CNI_VERSION) \ CNS_VERSION=$(CNS_VERSION) \ go test -mod=readonly -buildvcs=false -timeout 1h -coverpkg=./... -race -covermode atomic -coverprofile=coverage.out -tags=integration ./test/integration... test-load: ## run all load tests - CNI_DROPGZ_VERSION=$(CNI_DROPGZ_VERSION) \ + AZURE_IPAM_VERSION=$(AZURE_IPAM_VERSION) \ + CNI_VERSION=$(CNI_VERSION) CNS_VERSION=$(CNS_VERSION) \ go test -timeout 30m -race -tags=load ./test/integration/load... diff --git a/azure-ipam/linux.Dockerfile b/azure-ipam/linux.Dockerfile index c15f67bdb8..aa9ddcc052 100644 --- a/azure-ipam/linux.Dockerfile +++ b/azure-ipam/linux.Dockerfile @@ -24,9 +24,9 @@ ARG OS ARG VERSION RUN go mod download github.com/azure/azure-container-networking/dropgz@$DROPGZ_VERSION WORKDIR /go/pkg/mod/github.com/azure/azure-container-networking/dropgz\@$DROPGZ_VERSION -COPY --from=compressor /payload/* /pkg/embed/fs/ +COPY --from=compressor /payload/* pkg/embed/fs/ RUN GOOS=$OS CGO_ENABLED=0 go build -a -o /go/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 /go/bin/dropgz dropgz -ENTRYPOINT [ "dropgz" ] +ENTRYPOINT [ "/dropgz" ] diff --git a/azure-ipam/windows.Dockerfile b/azure-ipam/windows.Dockerfile index e4b60a022a..7e3ffbb439 100644 --- a/azure-ipam/windows.Dockerfile +++ b/azure-ipam/windows.Dockerfile @@ -24,9 +24,9 @@ ARG OS ARG VERSION RUN go mod download github.com/azure/azure-container-networking/dropgz@$DROPGZ_VERSION WORKDIR /go/pkg/mod/github.com/azure/azure-container-networking/dropgz\@$DROPGZ_VERSION -COPY --from=compressor /payload/* /pkg/embed/fs/ +COPY --from=compressor /payload/* pkg/embed/fs/ RUN GOOS=$OS CGO_ENABLED=0 go build -a -o /go/bin/dropgz -trimpath -ldflags "-X github.com/Azure/azure-container-networking/dropgz/internal/buildinfo.Version="$VERSION"" -gcflags="-dwarflocationlists=true" main.go FROM mcr.microsoft.com/windows/nanoserver:${OS_VERSION} COPY --from=dropgz /go/bin/dropgz dropgz -ENTRYPOINT [ "dropgz" ] +ENTRYPOINT [ "/dropgz" ] diff --git a/cni/linux.Dockerfile b/cni/linux.Dockerfile index 32f0eb4a27..7f960ad9fc 100644 --- a/cni/linux.Dockerfile +++ b/cni/linux.Dockerfile @@ -31,9 +31,9 @@ ARG OS ARG VERSION RUN go mod download github.com/azure/azure-container-networking/dropgz@$DROPGZ_VERSION WORKDIR /go/pkg/mod/github.com/azure/azure-container-networking/dropgz\@$DROPGZ_VERSION -COPY --from=compressor /payload/* /pkg/embed/fs/ +COPY --from=compressor /payload/* pkg/embed/fs/ RUN GOOS=$OS CGO_ENABLED=0 go build -a -o /go/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 /go/bin/dropgz dropgz -ENTRYPOINT [ "dropgz" ] +ENTRYPOINT [ "/dropgz" ] diff --git a/cni/windows.Dockerfile b/cni/windows.Dockerfile index f7d89b0546..482fb76e01 100644 --- a/cni/windows.Dockerfile +++ b/cni/windows.Dockerfile @@ -30,9 +30,9 @@ ARG OS ARG VERSION RUN go mod download github.com/azure/azure-container-networking/dropgz@$DROPGZ_VERSION WORKDIR /go/pkg/mod/github.com/azure/azure-container-networking/dropgz\@$DROPGZ_VERSION -COPY --from=compressor /payload/* /pkg/embed/fs/ +COPY --from=compressor /payload/* pkg/embed/fs/ RUN GOOS=$OS CGO_ENABLED=0 go build -a -o /go/bin/dropgz -trimpath -ldflags "-X github.com/Azure/azure-container-networking/dropgz/internal/buildinfo.Version="$VERSION"" -gcflags="-dwarflocationlists=true" main.go FROM mcr.microsoft.com/windows/nanoserver:${OS_VERSION} COPY --from=dropgz /go/bin/dropgz dropgz -ENTRYPOINT [ "dropgz" ] +ENTRYPOINT [ "/dropgz" ] diff --git a/dropgz/build/cniTest_linux.Dockerfile b/dropgz/build/cniTest_linux.Dockerfile deleted file mode 100644 index b55f49ab7c..0000000000 --- a/dropgz/build/cniTest_linux.Dockerfile +++ /dev/null @@ -1,40 +0,0 @@ -FROM mcr.microsoft.com/oss/go/microsoft/golang:1.21 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.21 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 -RUN CGO_ENABLED=0 go build -a -o bin/azure-vnet-telemetry -trimpath -ldflags "-X main.version="$VERSION"" -gcflags="-dwarflocationlists=true" cni/telemetry/service/telemetrymain.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/azure-$OS.conflist pkg/embed/fs/azure.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/cni/azure-$OS-multitenancy-transparent-vlan.conflist pkg/embed/fs/azure-multitenancy-transparent-vlan.conflist -COPY --from=azure-vnet /azure-container-networking/cni/azure-$OS-swift-overlay.conflist pkg/embed/fs/azure-swift-overlay.conflist -COPY --from=azure-vnet /azure-container-networking/cni/azure-$OS-swift-overlay-dualstack.conflist pkg/embed/fs/azure-swift-overlay-dualstack.conflist -COPY --from=azure-vnet /azure-container-networking/bin/* pkg/embed/fs -COPY --from=azure-vnet /azure-container-networking/telemetry/azure-vnet-telemetry.config 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.21 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/dropgz/build/cniTest_windows.Dockerfile b/dropgz/build/cniTest_windows.Dockerfile deleted file mode 100644 index c869f07a7e..0000000000 --- a/dropgz/build/cniTest_windows.Dockerfile +++ /dev/null @@ -1,30 +0,0 @@ -ARG ARCH -ARG OS_VERSION -FROM --platform=linux/${ARCH} mcr.microsoft.com/oss/go/microsoft/golang:1.21 AS azure-vnet -ARG VERSION -WORKDIR /azure-container-networking -COPY . . -RUN GOOS=windows CGO_ENABLED=0 go build -a -o azure-vnet.exe -trimpath -ldflags "-X main.version="$VERSION"" -gcflags="-dwarflocationlists=true" cni/network/plugin/main.go -RUN GOOS=windows CGO_ENABLED=0 go build -a -o azure-vnet-telemetry.exe -trimpath -ldflags "-X main.version="$VERSION"" -gcflags="-dwarflocationlists=true" cni/telemetry/service/telemetrymain.go -RUN GOOS=windows CGO_ENABLED=0 go build -a -o azure-vnet-ipam.exe -trimpath -ldflags "-X main.version="$VERSION"" -gcflags="-dwarflocationlists=true" cni/ipam/plugin/main.go - -FROM --platform=linux/${ARCH} mcr.microsoft.com/cbl-mariner/base/core:2.0 AS compressor -ARG OS -WORKDIR /dropgz -COPY dropgz . -COPY --from=azure-vnet /azure-container-networking/azure-vnet.exe pkg/embed/fs -COPY --from=azure-vnet /azure-container-networking/azure-vnet-telemetry.exe pkg/embed/fs -COPY --from=azure-vnet /azure-container-networking/azure-vnet-ipam.exe pkg/embed/fs -COPY --from=azure-vnet /azure-container-networking/telemetry/azure-vnet-telemetry.config 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 --platform=linux/${ARCH} mcr.microsoft.com/oss/go/microsoft/golang:1.21 AS dropgz -ARG VERSION -WORKDIR /dropgz -COPY --from=compressor /dropgz . -RUN GOOS=windows CGO_ENABLED=0 go build -a -o bin/dropgz.exe -trimpath -ldflags "-X github.com/Azure/azure-container-networking/dropgz/internal/buildinfo.Version="$VERSION"" -gcflags="-dwarflocationlists=true" main.go - -FROM mcr.microsoft.com/windows/nanoserver:${OS_VERSION} -COPY --from=dropgz /dropgz/bin/dropgz.exe dropgz.exe -ENTRYPOINT [ "dropgz.exe" ] diff --git a/dropgz/build/windows.Dockerfile b/dropgz/build/windows.Dockerfile index c587fd8417..08b7687661 100644 --- a/dropgz/build/windows.Dockerfile +++ b/dropgz/build/windows.Dockerfile @@ -1,38 +1,38 @@ -ARG ARCH -ARG OS_VERSION -FROM --platform=linux/${ARCH} mcr.microsoft.com/cbl-mariner/base/core:2.0 AS tar -RUN tdnf install -y tar -RUN tdnf install -y unzip -RUN tdnf upgrade -y && tdnf install -y ca-certificates - -FROM tar AS azure-vnet -ARG AZCNI_VERSION=v1.5.15 -ARG VERSION -ARG OS -ARG ARCH -WORKDIR /azure-container-networking -COPY . . -RUN curl -LO --cacert /etc/ssl/certs/ca-certificates.crt https://github.com/Azure/azure-container-networking/releases/download/$AZCNI_VERSION/azure-vnet-cni-$OS-$ARCH-$AZCNI_VERSION.zip && unzip -o azure-vnet-cni-$OS-$ARCH-$AZCNI_VERSION.zip - -FROM --platform=linux/${ARCH} mcr.microsoft.com/cbl-mariner/base/core:2.0 AS compressor -ARG OS -WORKDIR /dropgz -COPY dropgz . -COPY --from=azure-vnet /azure-container-networking/cni/azure-$OS-swift-overlay.conflist pkg/embed/fs/azure-swift-overlay.conflist -COPY --from=azure-vnet /azure-container-networking/cni/azure-$OS-swift-overlay-dualstack.conflist pkg/embed/fs/azure-swift-overlay-dualstack.conflist -COPY --from=azure-vnet /azure-container-networking/azure-vnet.exe pkg/embed/fs -COPY --from=azure-vnet /azure-container-networking/azure-vnet-telemetry.exe pkg/embed/fs -COPY --from=azure-vnet /azure-container-networking/azure-vnet-ipam.exe pkg/embed/fs -COPY --from=azure-vnet /azure-container-networking/azure-vnet-telemetry.config 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 --platform=linux/${ARCH} mcr.microsoft.com/oss/go/microsoft/golang:1.21 AS dropgz -ARG VERSION -WORKDIR /dropgz -COPY --from=compressor /dropgz . -RUN GOOS=windows CGO_ENABLED=0 go build -a -o bin/dropgz.exe -trimpath -ldflags "-X github.com/Azure/azure-container-networking/dropgz/internal/buildinfo.Version="$VERSION"" -gcflags="-dwarflocationlists=true" main.go - -FROM mcr.microsoft.com/windows/nanoserver:${OS_VERSION} -COPY --from=dropgz /dropgz/bin/dropgz.exe dropgz.exe -ENTRYPOINT [ "dropgz.exe" ] +ARG ARCH +ARG OS_VERSION +FROM --platform=linux/${ARCH} mcr.microsoft.com/cbl-mariner/base/core:2.0 AS tar +RUN tdnf install -y tar +RUN tdnf install -y unzip +RUN tdnf upgrade -y && tdnf install -y ca-certificates + +FROM tar AS azure-vnet +ARG AZCNI_VERSION=v1.5.15 +ARG VERSION +ARG OS +ARG ARCH +WORKDIR /azure-container-networking +COPY . . +RUN curl -LO --cacert /etc/ssl/certs/ca-certificates.crt https://github.com/Azure/azure-container-networking/releases/download/$AZCNI_VERSION/azure-vnet-cni-$OS-$ARCH-$AZCNI_VERSION.zip && unzip -o azure-vnet-cni-$OS-$ARCH-$AZCNI_VERSION.zip + +FROM --platform=linux/${ARCH} mcr.microsoft.com/cbl-mariner/base/core:2.0 AS compressor +ARG OS +WORKDIR /dropgz +COPY dropgz . +COPY --from=azure-vnet /azure-container-networking/cni/azure-$OS-swift-overlay.conflist pkg/embed/fs/azure-swift-overlay.conflist +COPY --from=azure-vnet /azure-container-networking/cni/azure-$OS-swift-overlay-dualstack.conflist pkg/embed/fs/azure-swift-overlay-dualstack.conflist +COPY --from=azure-vnet /azure-container-networking/azure-vnet.exe pkg/embed/fs +COPY --from=azure-vnet /azure-container-networking/azure-vnet-telemetry.exe pkg/embed/fs +COPY --from=azure-vnet /azure-container-networking/azure-vnet-ipam.exe pkg/embed/fs +COPY --from=azure-vnet /azure-container-networking/azure-vnet-telemetry.config 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 --platform=linux/${ARCH} mcr.microsoft.com/oss/go/microsoft/golang:1.21 AS dropgz +ARG VERSION +WORKDIR /dropgz +COPY --from=compressor /dropgz . +RUN GOOS=windows CGO_ENABLED=0 go build -a -o bin/dropgz.exe -trimpath -ldflags "-X github.com/Azure/azure-container-networking/dropgz/internal/buildinfo.Version="$VERSION"" -gcflags="-dwarflocationlists=true" main.go + +FROM mcr.microsoft.com/windows/nanoserver:${OS_VERSION} +COPY --from=dropgz /dropgz/bin/dropgz.exe dropgz.exe +ENTRYPOINT [ "dropgz.exe" ] diff --git a/hack/manifests/cni-installer-v1.yaml b/hack/manifests/cni-installer-v1.yaml index e697873b32..90380d89ee 100644 --- a/hack/manifests/cni-installer-v1.yaml +++ b/hack/manifests/cni-installer-v1.yaml @@ -39,7 +39,7 @@ spec: effect: NoSchedule initContainers: - name: azure-cni - image: mcr.microsoft.com/containernetworking/cni-dropgz:v0.0.10 + image: mcr.microsoft.com/containernetworking/azure-cni:v1.5.14 imagePullPolicy: Always command: ["/dropgz"] args: diff --git a/hack/manifests/cni-installer.yaml b/hack/manifests/cni-installer.yaml index 47d782a232..5a5782cc9a 100644 --- a/hack/manifests/cni-installer.yaml +++ b/hack/manifests/cni-installer.yaml @@ -41,7 +41,7 @@ spec: effect: NoSchedule initContainers: - name: azure-cni - image: mcr.microsoft.com/containernetworking/cni-dropgz:v0.0.10 + image: mcr.microsoft.com/containernetworking/azure-cni:v1.5.14 imagePullPolicy: Always command: ["/dropgz"] args: diff --git a/test/integration/manifests/cilium/cns-write-ovly.yaml b/test/integration/manifests/cilium/cns-write-ovly.yaml index 6c647eb8e0..4f3d919757 100644 --- a/test/integration/manifests/cilium/cns-write-ovly.yaml +++ b/test/integration/manifests/cilium/cns-write-ovly.yaml @@ -139,8 +139,8 @@ spec: apiVersion: v1 fieldPath: spec.nodeName initContainers: - - name: init-cni-dropgz - image: mcr.microsoft.com/containernetworking/cni-dropgz:v0.0.10 + - name: cni-installer + image: mcr.microsoft.com/containernetworking/azure-ipam:latest imagePullPolicy: Always command: ["/dropgz"] args: diff --git a/test/integration/manifests/cni/cni-installer-v1-windows.yaml b/test/integration/manifests/cni/cni-installer-v1-windows.yaml index ca303efff1..f042e1b4fb 100644 --- a/test/integration/manifests/cni/cni-installer-v1-windows.yaml +++ b/test/integration/manifests/cni/cni-installer-v1-windows.yaml @@ -47,19 +47,19 @@ spec: image: mcr.microsoft.com/powershell:lts-nanoserver-ltsc2022 command: ["powershell.exe", "-command"] args: ["if (Get-Process -Name 'azure-vnet-telemetry' -ErrorAction SilentlyContinue) { Stop-Process -Name 'azure-vnet-telemetry' -Force }"] - - name: cni-drop - image: ${DROP_GZ_URL} + - name: cni-installer + image: ${CNI_IMAGE} imagePullPolicy: Always - command: ["%CONTAINER_SANDBOX_MOUNT_POINT%/dropgz.exe"] + command: ["%CONTAINER_SANDBOX_MOUNT_POINT%/dropgz"] args: - deploy - - azure-vnet.exe + - azure-vnet - -o - /k/azurecni/bin/azure-vnet.exe - - azure-vnet-ipam.exe + - azure-vnet-ipam - -o - /k/azurecni/bin/azure-vnet-ipam.exe - - azure-vnet-telemetry.exe + - azure-vnet-telemetry - -o - /k/azurecni/bin/azure-vnet-telemetry.exe - azure-vnet-telemetry.config diff --git a/test/integration/manifests/cni/cni-installer-v1.yaml b/test/integration/manifests/cni/cni-installer-v1.yaml index 74565cca13..534d237614 100644 --- a/test/integration/manifests/cni/cni-installer-v1.yaml +++ b/test/integration/manifests/cni/cni-installer-v1.yaml @@ -38,8 +38,8 @@ spec: - operator: "Exists" effect: NoSchedule initContainers: - - name: azure-cni - image: ${DROP_GZ_URL} + - name: cni-installer + image: ${CNI_IMAGE} imagePullPolicy: Always command: ["/dropgz"] args: diff --git a/test/integration/manifests/cns/daemonset-linux.yaml b/test/integration/manifests/cns/daemonset-linux.yaml index a371274f41..e633228329 100644 --- a/test/integration/manifests/cns/daemonset-linux.yaml +++ b/test/integration/manifests/cns/daemonset-linux.yaml @@ -41,7 +41,7 @@ spec: effect: NoSchedule containers: - name: cns-container - image: acnpublic.azurecr.io/azure-cns:v1.5.10 + image: acnpublic.azurecr.io/azure-cns:latest imagePullPolicy: IfNotPresent args: [ "-c", "tcp://$(CNSIpAddress):$(CNSPort)", "-t", "$(CNSLogTarget)"] securityContext: @@ -84,7 +84,7 @@ spec: apiVersion: v1 fieldPath: spec.nodeName initContainers: - - name: init-cni-dropgz + - name: cni-installer image: acnpublic.azurecr.io/cni-dropgz:latest imagePullPolicy: Always command: ["/dropgz"] diff --git a/test/integration/manifests/cns/daemonset-windows.yaml b/test/integration/manifests/cns/daemonset-windows.yaml index 8c4bb9f178..571109a7e8 100644 --- a/test/integration/manifests/cns/daemonset-windows.yaml +++ b/test/integration/manifests/cns/daemonset-windows.yaml @@ -104,13 +104,13 @@ spec: apiVersion: v1 fieldPath: spec.nodeName initContainers: - - name: init-cni-dropgz - image: acnpublic.azurecr.io/cni-dropgz:CNI_DROPGZ_VERSION + - name: cni-installer + image: acnpublic.azurecr.io/cni-dropgz:latest imagePullPolicy: Always - command: ["%CONTAINER_SANDBOX_MOUNT_POINT%/dropgz.exe"] + command: ["%CONTAINER_SANDBOX_MOUNT_POINT%/dropgz"] args: - deploy - - azure-vnet.exe + - azure-vnet - -o - /k/azurecni/bin/azure-vnet.exe # // TODO: add windows cni conflist when ready volumeMounts: diff --git a/test/internal/kubernetes/utils.go b/test/internal/kubernetes/utils.go index c40f18f6d6..16883f66ff 100644 --- a/test/internal/kubernetes/utils.go +++ b/test/internal/kubernetes/utils.go @@ -9,7 +9,6 @@ import ( "log" "os" "path/filepath" - "strings" "time" "github.com/Azure/azure-container-networking/test/internal/retry" @@ -156,18 +155,6 @@ func MustSetupConfigMap(ctx context.Context, clientset *kubernetes.Clientset, co func Int32ToPtr(i int32) *int32 { return &i } -func ParseImageString(s string) (url, image, version string) { - s1 := strings.Split(s, ":") - s2 := s1[0] - index := strings.LastIndex(s2, "/") // Returns byte location - - return s2[:index], s2[index:], s1[1] -} - -func GetImageString(url, image, version string) string { - return url + image + ":" + version -} - func WaitForPodsRunning(ctx context.Context, clientset *kubernetes.Clientset, namespace, labelselector string) error { podsClient := clientset.CoreV1().Pods(namespace) diff --git a/test/internal/kubernetes/utils_create.go b/test/internal/kubernetes/utils_create.go index bb5fc14e56..8137fb8d94 100644 --- a/test/internal/kubernetes/utils_create.go +++ b/test/internal/kubernetes/utils_create.go @@ -39,6 +39,7 @@ type cnsDetails struct { clusterRolePath string clusterRoleBindingPath string serviceAccountPath string + initContainerName string initContainerArgs []string volumes []corev1.Volume initContainerVolumeMounts []corev1.VolumeMount @@ -48,8 +49,8 @@ type cnsDetails struct { } const ( - envTestDropgz = "TEST_DROPGZ" - envCNIDropgzVersion = "CNI_DROPGZ_VERSION" + envAzureIPAMVersion = "AZURE_IPAM_VERSION" + envCNIVersion = "CNI_VERSION" envCNSVersion = "CNS_VERSION" envCNSImageRepo = "CNS_IMAGE_REPO" EnvInstallCNS = "INSTALL_CNS" @@ -216,10 +217,7 @@ func InstallIPMasqAgent(ctx context.Context, clientset *kubernetes.Clientset) er } func InstallCNSDaemonset(ctx context.Context, clientset *kubernetes.Clientset, logDir string) (func() error, error) { - cniDropgzVersion := os.Getenv(envCNIDropgzVersion) - cnsVersion := os.Getenv(envCNSVersion) - - cnsLinux, cnsLinuxDetails, err := loadCNSDaemonset(ctx, clientset, cnsVersion, cniDropgzVersion, corev1.Linux) + cnsLinux, cnsLinuxDetails, err := loadCNSDaemonset(ctx, clientset, corev1.Linux) if err != nil { return nil, errors.Wrap(err, "failed to load linux CNS daemonset") } @@ -231,7 +229,7 @@ func InstallCNSDaemonset(ctx context.Context, clientset *kubernetes.Clientset, l return nil, errors.Wrap(err, "failed to check if cluster has windows nodes") } if hasWinNodes { - cnsWindows, cnsWindowsDetails, err = loadCNSDaemonset(ctx, clientset, cnsVersion, cniDropgzVersion, corev1.Windows) + cnsWindows, cnsWindowsDetails, err = loadCNSDaemonset(ctx, clientset, corev1.Windows) if err != nil { return nil, errors.Wrap(err, "failed to load windows CNS daemonset") } @@ -252,8 +250,6 @@ func InstallCNSDaemonset(ctx context.Context, clientset *kubernetes.Clientset, l } func RestartCNSDaemonset(ctx context.Context, clientset *kubernetes.Clientset) error { - cniDropgzVersion := os.Getenv(envCNIDropgzVersion) - cnsVersion := os.Getenv(envCNSVersion) cnsScenarioMap, err := initCNSScenarioVars() if err != nil { return errors.Wrap(err, "failed to initialize cns scenario map") @@ -272,7 +268,7 @@ func RestartCNSDaemonset(ctx context.Context, clientset *kubernetes.Clientset) e restartErrors := []error{} for _, nodeOS := range oses { - cns, _, err := parseCNSDaemonset(cnsVersion, cniDropgzVersion, cnsScenarioMap, nodeOS) + cns, _, err := parseCNSDaemonset(cnsScenarioMap, nodeOS) if err != nil { restartErrors = append(restartErrors, err) } @@ -325,6 +321,9 @@ func initCNSScenarioVars() (map[CNSScenario]map[corev1.OSName]cnsDetails, error) cnsRoleBindingPath := cnsManifestFolder + "/rolebinding.yaml" cnsServiceAccountPath := cnsManifestFolder + "/serviceaccount.yaml" + initContainerNameCNI := "acnpublic.azurecr.io/azure-cni:" + os.Getenv(envCNIVersion) + initContainerNameIPAM := "acnpublic.azurecr.io/azure-ipam:" + os.Getenv(envAzureIPAMVersion) + // cns scenario map cnsScenarioMap := map[CNSScenario]map[corev1.OSName]cnsDetails{ EnvInstallAzureVnet: { @@ -337,10 +336,12 @@ func initCNSScenarioVars() (map[CNSScenario]map[corev1.OSName]cnsDetails, error) clusterRoleBindingPath: cnsClusterRoleBindingPath, serviceAccountPath: cnsServiceAccountPath, initContainerArgs: []string{ - "deploy", "azure-vnet", "-o", "/opt/cni/bin/azure-vnet", "azure-vnet-telemetry", - "-o", "/opt/cni/bin/azure-vnet-telemetry", "azure-vnet-ipam", "-o", "/opt/cni/bin/azure-vnet-ipam", + "deploy", + "azure-vnet", "-o", "/opt/cni/bin/azure-vnet", + "azure-vnet-telemetry", "-o", "/opt/cni/bin/azure-vnet-telemetry", "azure-swift.conflist", "-o", "/etc/cni/net.d/10-azure.conflist", }, + initContainerName: initContainerNameCNI, configMapPath: cnsSwiftConfigMapPath, installIPMasqAgent: false, }, @@ -355,8 +356,10 @@ func initCNSScenarioVars() (map[CNSScenario]map[corev1.OSName]cnsDetails, error) clusterRoleBindingPath: cnsClusterRoleBindingPath, serviceAccountPath: cnsServiceAccountPath, initContainerArgs: []string{ - "deploy", "azure-ipam", "-o", "/opt/cni/bin/azure-ipam", + "deploy", + "azure-ipam", "-o", "/opt/cni/bin/azure-ipam", }, + initContainerName: initContainerNameIPAM, configMapPath: cnsCiliumConfigMapPath, installIPMasqAgent: false, }, @@ -371,8 +374,10 @@ func initCNSScenarioVars() (map[CNSScenario]map[corev1.OSName]cnsDetails, error) clusterRoleBindingPath: cnsClusterRoleBindingPath, serviceAccountPath: cnsServiceAccountPath, initContainerArgs: []string{ - "deploy", "azure-ipam", "-o", "/opt/cni/bin/azure-ipam", + "deploy", + "azure-ipam", "-o", "/opt/cni/bin/azure-ipam", }, + initContainerName: initContainerNameIPAM, configMapPath: cnsOverlayConfigMapPath, installIPMasqAgent: true, }, @@ -387,8 +392,11 @@ func initCNSScenarioVars() (map[CNSScenario]map[corev1.OSName]cnsDetails, error) clusterRoleBindingPath: cnsClusterRoleBindingPath, serviceAccountPath: cnsServiceAccountPath, initContainerArgs: []string{ - "deploy", "azure-vnet", "-o", "/opt/cni/bin/azure-vnet", "azure-vnet-telemetry", "-o", "/opt/cni/bin/azure-vnet-telemetry", + "deploy", + "azure-vnet", "-o", "/opt/cni/bin/azure-vnet", + "azure-vnet-telemetry", "-o", "/opt/cni/bin/azure-vnet-telemetry", }, + initContainerName: initContainerNameCNI, volumes: volumesForAzureCNIOverlayLinux(), initContainerVolumeMounts: dropgzVolumeMountsForAzureCNIOverlayLinux(), containerVolumeMounts: cnsVolumeMountsForAzureCNIOverlayLinux(), @@ -404,8 +412,10 @@ func initCNSScenarioVars() (map[CNSScenario]map[corev1.OSName]cnsDetails, error) clusterRoleBindingPath: cnsClusterRoleBindingPath, serviceAccountPath: cnsServiceAccountPath, initContainerArgs: []string{ - "deploy", "azure-vnet.exe", "-o", "/k/azurecni/bin/azure-vnet.exe", + "deploy", + "azure-vnet", "-o", "/k/azurecni/bin/azure-vnet.exe", }, + initContainerName: initContainerNameCNI, volumes: volumesForAzureCNIOverlayWindows(), initContainerVolumeMounts: dropgzVolumeMountsForAzureCNIOverlayWindows(), containerVolumeMounts: cnsVolumeMountsForAzureCNIOverlayWindows(), @@ -423,10 +433,12 @@ func initCNSScenarioVars() (map[CNSScenario]map[corev1.OSName]cnsDetails, error) clusterRoleBindingPath: cnsClusterRoleBindingPath, serviceAccountPath: cnsServiceAccountPath, initContainerArgs: []string{ - "deploy", "azure-vnet", "-o", "/opt/cni/bin/azure-vnet", - "azure-vnet-telemetry", "-o", "/opt/cni/bin/azure-vnet-telemetry", "azure-vnet-ipam", "-o", - "/opt/cni/bin/azure-vnet-ipam", "azure-swift-overlay-dualstack.conflist", "-o", "/etc/cni/net.d/10-azure.conflist", + "deploy", + "azure-vnet", "-o", "/opt/cni/bin/azure-vnet", + "azure-vnet-telemetry", "-o", "/opt/cni/bin/azure-vnet-telemetry", + "azure-swift-overlay-dualstack.conflist", "-o", "/etc/cni/net.d/10-azure.conflist", }, + initContainerName: initContainerNameCNI, configMapPath: cnsSwiftConfigMapPath, installIPMasqAgent: true, }, @@ -439,8 +451,10 @@ func initCNSScenarioVars() (map[CNSScenario]map[corev1.OSName]cnsDetails, error) clusterRoleBindingPath: cnsClusterRoleBindingPath, serviceAccountPath: cnsServiceAccountPath, initContainerArgs: []string{ - "deploy", "azure-vnet.exe", "-o", "/k/azurecni/bin/azure-vnet.exe", + "deploy", + "azure-vnet", "-o", "/k/azurecni/bin/azure-vnet.exe", }, + initContainerName: initContainerNameCNI, volumes: volumesForAzureCNIOverlayWindows(), initContainerVolumeMounts: dropgzVolumeMountsForAzureCNIOverlayWindows(), containerVolumeMounts: cnsVolumeMountsForAzureCNIOverlayWindows(), @@ -453,12 +467,12 @@ func initCNSScenarioVars() (map[CNSScenario]map[corev1.OSName]cnsDetails, error) return cnsScenarioMap, nil } -func loadCNSDaemonset(ctx context.Context, clientset *kubernetes.Clientset, cnsVersion, cniDropgzVersion string, nodeOS corev1.OSName) (appsv1.DaemonSet, cnsDetails, error) { +func loadCNSDaemonset(ctx context.Context, clientset *kubernetes.Clientset, nodeOS corev1.OSName) (appsv1.DaemonSet, cnsDetails, error) { cnsScenarioMap, err := initCNSScenarioVars() if err != nil { return appsv1.DaemonSet{}, cnsDetails{}, errors.Wrap(err, "failed to initialize cns scenario map") } - cns, cnsScenarioDetails, err := setupCNSDaemonset(ctx, clientset, cnsVersion, cniDropgzVersion, cnsScenarioMap, nodeOS) + cns, cnsScenarioDetails, err := setupCNSDaemonset(ctx, clientset, cnsScenarioMap, nodeOS) if err != nil { return appsv1.DaemonSet{}, cnsDetails{}, errors.Wrap(err, "failed to setup cns daemonset") } @@ -468,14 +482,8 @@ func loadCNSDaemonset(ctx context.Context, clientset *kubernetes.Clientset, cnsV // setupCNSDaemonset installs the first CNSScenario encountered by env var // if no CNSScenario env var is set, returns an error -func setupCNSDaemonset( - ctx context.Context, - clientset *kubernetes.Clientset, - cnsVersion, cniDropgzVersion string, - cnsScenarioMap map[CNSScenario]map[corev1.OSName]cnsDetails, - nodeOS corev1.OSName, -) (appsv1.DaemonSet, cnsDetails, error) { - cns, cnsScenarioDetails, err := parseCNSDaemonset(cnsVersion, cniDropgzVersion, cnsScenarioMap, nodeOS) +func setupCNSDaemonset(ctx context.Context, clientset *kubernetes.Clientset, cnsScenarioMap map[CNSScenario]map[corev1.OSName]cnsDetails, nodeOS corev1.OSName) (appsv1.DaemonSet, cnsDetails, error) { //nolint:lll // ignore + cns, cnsScenarioDetails, err := parseCNSDaemonset(cnsScenarioMap, nodeOS) if err != nil { return appsv1.DaemonSet{}, cnsDetails{}, errors.Wrap(err, "failed to parse cns daemonset") } @@ -507,10 +515,8 @@ func setupCNSDaemonset( } // parseCNSDaemonset just parses the appropriate cns daemonset -func parseCNSDaemonset(cnsVersion, cniDropgzVersion string, - cnsScenarioMap map[CNSScenario]map[corev1.OSName]cnsDetails, - nodeOS corev1.OSName, -) (appsv1.DaemonSet, cnsDetails, error) { +func parseCNSDaemonset(cnsScenarioMap map[CNSScenario]map[corev1.OSName]cnsDetails, nodeOS corev1.OSName) (appsv1.DaemonSet, cnsDetails, error) { + cnsVersion := os.Getenv(envCNSVersion) for scenario := range cnsScenarioMap { if ok, err := strconv.ParseBool(os.Getenv(string(scenario))); err != nil || !ok { log.Printf("%s not set to 'true', skipping", scenario) @@ -525,17 +531,17 @@ func parseCNSDaemonset(cnsVersion, cniDropgzVersion string, } cns := MustParseDaemonSet(cnsScenarioDetails.daemonsetPath) - _, image, _ := ParseImageString(cns.Spec.Template.Spec.Containers[0].Image) + url, key := imageRepoURL[os.Getenv(string(envCNSImageRepo))] if !key { log.Printf("%s not set to expected value \"ACN\", \"MCR\". Default to %s", envCNSImageRepo, imageRepoURL["ACN"]) url = imageRepoURL["ACN"] } - cns.Spec.Template.Spec.Containers[0].Image = GetImageString(url, image, cnsVersion) + cns.Spec.Template.Spec.Containers[0].Image = path.Join(url, "azure-cns:") + cnsVersion log.Printf("Checking environment scenario") - cns = loadDropgzImage(cns, cniDropgzVersion) + cns.Spec.Template.Spec.InitContainers[0].Image = cnsScenarioDetails.initContainerName // override init container args cns.Spec.Template.Spec.InitContainers[0].Args = cnsScenarioDetails.initContainerArgs @@ -555,20 +561,6 @@ func parseCNSDaemonset(cnsVersion, cniDropgzVersion string, return appsv1.DaemonSet{}, cnsDetails{}, errors.Wrap(ErrNoCNSScenarioDefined, "no CNSSCenario env vars set to true, must explicitly set one to true") } -func loadDropgzImage(cns appsv1.DaemonSet, dropgzVersion string) appsv1.DaemonSet { - installFlag := os.Getenv(envTestDropgz) - if testDropgzScenario, err := strconv.ParseBool(installFlag); err == nil && testDropgzScenario { - log.Printf("Env %v set to true, deploy cniTest.Dockerfile", envTestDropgz) - url, initImage, _ := ParseImageString("acnpublic.azurecr.io/cni-dropgz-test:latest") - cns.Spec.Template.Spec.InitContainers[0].Image = GetImageString(url, initImage, dropgzVersion) - } else { - log.Printf("Env %v not set to true, deploying cni.Dockerfile", envTestDropgz) - url, initImage, _ := ParseImageString(cns.Spec.Template.Spec.InitContainers[0].Image) - cns.Spec.Template.Spec.InitContainers[0].Image = GetImageString(url, initImage, dropgzVersion) - } - return cns -} - func hostPathTypePtr(h corev1.HostPathType) *corev1.HostPathType { return &h }