From c444c24bc559fa820c290f5308a6b4bbb9d9c197 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabiano=20Fid=C3=AAncio?= Date: Fri, 31 Mar 2023 07:37:37 +0200 Subject: [PATCH] gha: aks: Add snippets to create / delete aks clusters MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Those will be shortly used as part of a newly added GitHub action for testing k8s tests on Azure. They've been created using the secrets we already have exposed as part of our GitHub, and they follow a similar way to authenticate to Azure / create an AKS cluster as done in the `/test-kata-deploy` action. Signed-off-by: Fabiano FidĂȘncio --- .github/workflows/create-aks.yaml | 32 +++++++++++++++++++++++++++++++ .github/workflows/delete-aks.yaml | 31 ++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 .github/workflows/create-aks.yaml create mode 100644 .github/workflows/delete-aks.yaml diff --git a/.github/workflows/create-aks.yaml b/.github/workflows/create-aks.yaml new file mode 100644 index 0000000000..b2b6c76e78 --- /dev/null +++ b/.github/workflows/create-aks.yaml @@ -0,0 +1,32 @@ +name: CI | Create AKS cluster +on: + workflow_call: + inputs: + name: + required: true + type: string + +jobs: + create-aks: + runs-on: ubuntu-latest + steps: + - name: Download Azure CLI + run: | + curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash + + - name: Log into the Azure account + run: | + az login \ + --service-principal \ + -u "${{ secrets.AZ_APPID }}" \ + -p "${{ secrets.AZ_PASSWORD }}" \ + --tenant "${{ secrets.AZ_TENANT_ID }}" + + - name: Create AKS cluster + run: | + az aks create \ + -g "kataCI" \ + -n "${{ inputs.name }}" \ + -s "Standard_D4s_v3" \ + --node-count 1 \ + --generate-ssh-keys diff --git a/.github/workflows/delete-aks.yaml b/.github/workflows/delete-aks.yaml new file mode 100644 index 0000000000..2c9e6d21a6 --- /dev/null +++ b/.github/workflows/delete-aks.yaml @@ -0,0 +1,31 @@ +name: CI | Delete AKS cluster +on: + workflow_call: + inputs: + name: + required: true + type: string + +jobs: + delete-aks: + runs-on: ubuntu-latest + steps: + - name: Download Azure CLI + run: | + curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash + + - name: Log into the Azure account + run: | + az login \ + --service-principal \ + -u "${{ secrets.AZ_APPID }}" \ + -p "${{ secrets.AZ_PASSWORD }}" \ + --tenant "${{ secrets.AZ_TENANT_ID }}" + + - name: Delete AKS cluster + run: | + az aks delete \ + -g "kataCI" \ + -n "${{ inputs.name }}" \ + --yes \ + --no-wait