From 16a48ea896162363531d65244bff10cccc5c3f88 Mon Sep 17 00:00:00 2001 From: andres-spacemesh <106999199+andres-spacemesh@users.noreply.github.com> Date: Mon, 18 Nov 2024 10:23:52 -0800 Subject: [PATCH] Add nodepool lifecycle for systemtests - Automate creation and deletion of a GKE node pool for systemtests - Update nodeselector labels --- .github/workflows/systest.yml | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/.github/workflows/systest.yml b/.github/workflows/systest.yml index 234ce2247f..506375f95f 100644 --- a/.github/workflows/systest.yml +++ b/.github/workflows/systest.yml @@ -91,6 +91,28 @@ jobs: - name: Configure kubectl run: gcloud container clusters get-credentials ${{ secrets.CI_CLUSTER_NAME }} --region ${{ secrets.CI_REGION_NAME }} --project ${{ secrets.CI_GCP_PROJECT_ID }} + - name: Create Node Pool + run: | + + NODE_POOL_NAME="systemtest-${{ github.run_id }}" + + gcloud container node-pools create $NODE_POOL_NAME \ + --cluster ${{ secrets.CI_CLUSTER_NAME }} \ + --num-nodes 8 \ + --preemptible \ + --machine-type ${{ CI_NODE_MACHINE_TYPE }} \ + --disk-type pd-ssd \ + --disk-size 300GB \ + --image-type COS_CONTAINERD \ + --enable-autorepair \ + --no-enable-autoupgrade \ + --node-labels env=dev,cluster=${{ secrets.CI_CLUSTER_NAME }},pipeline-id=${{ github.run_id }} \ + --metadata disable-legacy-endpoints=true \ + --service-account ${{ secrets.CI_GKE_NODEPOOL_SA }} \ + --quiet + + echo "Node pool created: $NODE_POOL_NAME" + - name: Login to Docker Hub uses: docker/login-action@v3 with: @@ -138,7 +160,7 @@ jobs: env: test_id: systest-${{ steps.vars.outputs.sha_short }} storage: premium-rwo=10Gi - node_selector: cloud.google.com/gke-nodepool=systemtest + node_selector: pipeline-id=${{ github.run_id }} size: 20 bootstrap: 4m level: ${{ inputs.log_level }} @@ -151,6 +173,16 @@ jobs: env: test_id: systest-${{ steps.vars.outputs.sha_short }} run: make -C systest clean + + - name: Delete Node Pool + if: always() + run: | + NODE_POOL_NAME="systemtest-${{ github.run_id }}" + gcloud container node-pools delete $NODE_POOL_NAME \ + --cluster ${{ secrets.CI_CLUSTER_NAME }} \ + --location ${{ secrets.CI_REGION_NAME }} \ + --quiet + echo "Node pool deleted: $NODE_POOL_NAME" systest-status: if: always()