From 6a67bb6accfac0fe18b630bf4d125093df7ee7f4 Mon Sep 17 00:00:00 2001 From: Thomas Riegler Date: Sat, 15 Jun 2024 14:03:00 +0200 Subject: [PATCH 01/16] First version of install/uninstall/upgrade workflows --- .github/workflows/deploy-az.yml | 116 ++------------- .github/workflows/install-components-az.yml | 139 ++++++++++++++++++ .github/workflows/uninstall-components-az.yml | 82 +++++++++++ .github/workflows/upgrade-components-az.yml | 132 +++++++++++++++++ 4 files changed, 362 insertions(+), 107 deletions(-) create mode 100644 .github/workflows/install-components-az.yml create mode 100644 .github/workflows/uninstall-components-az.yml create mode 100644 .github/workflows/upgrade-components-az.yml diff --git a/.github/workflows/deploy-az.yml b/.github/workflows/deploy-az.yml index 146a975..5a9a253 100644 --- a/.github/workflows/deploy-az.yml +++ b/.github/workflows/deploy-az.yml @@ -8,11 +8,6 @@ on: required: false type: boolean -env: - REGISTRY: ghcr.io - NAMESPACE: austriandatalab - SUB_NAMESPACE: indiegamestream - LABEL: sha-350add069a4899d95e950578b37b43e2fd092fd2 jobs: deploy: runs-on: ubuntu-latest @@ -28,23 +23,15 @@ jobs: with: terraform_version: latest - - name: Install Helm - uses: azure/setup-helm@v4.2.0 - with: - version: 'latest' - id: install1 - - name: Install kubectl uses: azure/setup-kubectl@v3 with: version: 'latest' - id: install2 - + id: install1 - name: Login to Azure run: az login --service-principal -u ${{ secrets.CLIENT_ID }} -p ${{ secrets.CLIENT_SECRET }} --tenant ${{ secrets.AZURERM_TENANT_ID }} - - name: Terraform Apply working-directory: ./iac run: | @@ -56,111 +43,30 @@ jobs: terraform init terraform plan -out=tfplan.bin -input=false terraform apply -auto-approve "tfplan.bin" + - name: Apply tailscale operator working-directory: ./iac run: | - az aks command invoke -n ${{ secrets.AZURERM_AKS_CLUSTER_NAME }} -g rg-service-not2day --command "helm repo add tailscale https://pkgs.tailscale.com/helmcharts && helm repo update && helm upgrade --install tailscale-operator tailscale/tailscale-operator --set-string oauth.clientId=${{secrets.TAILSCALE_CLIENT_ID}} --set-string oauth.clientSecret=${{secrets.TAILSCALE_CLIENT_SECRET}} --set-string apiServerProxyConfig.mode=true --wait || true" + az aks command invoke -n ${{ secrets.AZURERM_AKS_CLUSTER_NAME }} -g rg-service-not2day --command "helm repo add tailscale https://pkgs.tailscale.com/helmcharts && helm repo update && helm upgrade --install tailscale-operator tailscale/tailscale-operator --namespace=tailscale --create-namespace --set-string oauth.clientId=${{secrets.TAILSCALE_CLIENT_ID}} --set-string oauth.clientSecret=${{secrets.TAILSCALE_CLIENT_SECRET}} --set-string apiServerProxyConfig.mode=true --wait" + - name: Connect to tailscale uses: tailscale/github-action@v2 with: oauth-client-id: ${{secrets.TAILSCALE_CLIENT_ID_2}} oauth-secret: ${{secrets.TAILSCALE_CLIENT_SECRET_2}} tags: tag:ci + - name: Configure kubernetes config run: tailscale configure kubeconfig tailscale-operator - name: Check working cluster - run: kubectl get pods -A - - - name: Install MySQL - working-directory: ./helm/mysql - run: | - helm repo add mysql-operator https://mysql.github.io/mysql-operator/ - helm repo update - helm install mysql-operator mysql-operator/mysql-operator --version "2.1.3" --wait \ - --create-namespace --namespace=mysql-operator || true - helm install mysql mysql-operator/mysql-innodbcluster --version "2.1.3" --wait \ - --create-namespace --namespace=mysql -f values.yaml \ - --set-string credentials.root.password=${{ secrets.MYSQL_ROOT_PASSWORD }} || true - - - name: Install Open Policy Gatekeeper - working-directory: ./scripts/opa - run: | - helm repo add gatekeeper https://open-policy-agent.github.io/gatekeeper/charts - helm repo update - helm install gatekeeper gatekeeper/gatekeeper --namespace gatekeeper-system --create-namespace --wait || true - kubectl apply -f loadbalancerclass_mutator.yaml - - - name: Install stunner - working-directory: ./scripts/localenv - run: make install_stunner || true - - - name: Install game operator manifests - working-directory: ./operator - run: make install - - - name: Deploy game operator - working-directory: ./operator - run: make deploy IMG=${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ env.SUB_NAMESPACE }}/operator:${{ env.LABEL }} - - # - name: Wait for MySQL to be ready - # run: | - # while true; do - # POD_STATUS=$(kubectl get pod mysql-0 -n mysql --no-headers -o custom-columns=":status.phase" 2>/dev/null); - # if [ "$POD_STATUS" ]; then - # echo "Pod mysql-0 has been created with status: $POD_STATUS"; - # break; - # else - # echo "Waiting for pod mysql-0 to be created..."; - # sleep 5; - # fi - # done - # kubectl wait --for=condition=Ready pod/mysql-0 -n mysql --timeout=120s - - # while true; do - # POD_STATUS=$(kubectl get pod -l app.kubernetes.io/component=router -n mysql --no-headers -o custom-columns=":status.phase" 2>/dev/null); \ - # if [ "$POD_STATUS" ]; then - # echo "MySQL router has been created with status: $POD_STATUS"; - # break; - # else - # echo "Waiting for MySQL router to be created..."; - # sleep 5; - # fi - # done - # kubectl wait --for=condition=ready pod -l app.kubernetes.io/component=router -n mysql --timeout=120s - - # - name: Install API - # working-directory: ./helm/api - # run: | - # helm install -f values.yaml \ - # --set-string env.mysqlRootPassword=${{ secrets.MYSQL_ROOT_PASSWORD }} \ - # --set-string env.azureTenantId=${{ secrets.AZURE_TENANT_ID }} - # --set-string env.azureClientId=${{ secrets.CLIENT_ID }} - # --set-string env.azureClientSecret=${{ secrets.CLIENT_SECRET }} - # --set-string env.azureStorageAccount=${{ secrets.AZURERM_STORAGE_ACCOUNT_NAME }} - # --set-string env.azureContainerName=${{ secrets.AZURERM_CONTAINER_NAME }} - # --set-string env.azureAksClusterName=${{ secrets.AZURERM_AKS_CLUSTER_NAME }} - # --set-string env.azurermSubscriptionId=${{ secrets.AZURERM_SUBSCRIPTION_ID }} - # --set-string env.azurermResourceGroupName=${{ secrets.AZURERM_RESOURCE_GROUP_NAME }} - # --set-string image.label=${{ env.LABEL }} \ - # api . - - # - name: Wait for external IP of API - # run: | - # until [ -n "$(kubectl get svc api -n api -o jsonpath='{.status.loadBalancer.ingress[0].ip}')" ]; do - # sleep 5 - # done - - # - name: Install frontend - # working-directory: ./helm/frontend - # run: | - # helm install -f values.yaml \ - # --set-string appConfig.apiUrl=http://$(kubectl get svc api -n api -o jsonpath='{.status.loadBalancer.ingress[0].ip}'):$(kubectl get svc api -n api -o jsonpath='{.spec.ports[0].port}') \ - # --set-string image.label=${{ env.LABEL }} \ - # frontend . + run: kubectl get pods -A - name: Logout of Azure run: az logout + + + purge: runs-on: ubuntu-latest if: ${{ github.event.inputs.purge == 'true' }} @@ -175,13 +81,9 @@ jobs: with: terraform_version: latest - - name: Login to Azure run: az login --service-principal -u ${{ secrets.CLIENT_ID }} -p ${{ secrets.CLIENT_SECRET }} --tenant ${{ secrets.AZURERM_TENANT_ID }} - - - - name: Terraform Apply working-directory: ./iac run: | diff --git a/.github/workflows/install-components-az.yml b/.github/workflows/install-components-az.yml new file mode 100644 index 0000000..14321c7 --- /dev/null +++ b/.github/workflows/install-components-az.yml @@ -0,0 +1,139 @@ +name: Install components to Azure + +on: + workflow_dispatch: + inputs: + component: + type: choice + description: Which component + required: true + options: + - frontend + - api + - api-mysql + - operator + - operator-stunner + - all + label: + type: string + description: Image label to use + +env: + REGISTRY: ghcr.io + NAMESPACE: austriandatalab + SUB_NAMESPACE: indiegamestream +jobs: + install: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: true + + - name: Install Helm + uses: azure/setup-helm@v4.2.0 + with: + version: 'latest' + id: install1 + + - name: Install kubectl + uses: azure/setup-kubectl@v3 + with: + version: 'latest' + id: install2 + + - name: Login to Azure + run: az login --service-principal -u ${{ secrets.CLIENT_ID }} -p ${{ secrets.CLIENT_SECRET }} --tenant ${{ secrets.AZURERM_TENANT_ID }} + + - name: Connect to tailscale + uses: tailscale/github-action@v2 + with: + oauth-client-id: ${{secrets.TAILSCALE_CLIENT_ID_2}} + oauth-secret: ${{secrets.TAILSCALE_CLIENT_SECRET_2}} + tags: tag:ci + + - name: Configure kubernetes config + run: tailscale configure kubeconfig tailscale-operator + + - name: Install MySQL + working-directory: ./helm/mysql + if: ${{ github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'mysql') }} + run: | + helm repo add mysql-operator https://mysql.github.io/mysql-operator/ + helm repo update + helm install mysql-operator mysql-operator/mysql-operator --version "2.1.3" --wait \ + --create-namespace --namespace=mysql-operator + helm install mysql mysql-operator/mysql-innodbcluster --version "2.1.3" --wait \ + --create-namespace --namespace=mysql -f values.yaml \ + --set-string credentials.root.password=${{ secrets.MYSQL_ROOT_PASSWORD }} + + - name: Install STUNner + working-directory: ./helm/stunner + if: ${{ github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'stunner') }} + run: | + helm repo add stunner https://l7mp.io/stunner + helm repo update + helm dependency . --skip-refresh + helm install stunner . --create-namespace --namespace=stunner + + - name: Install game operator manifests + working-directory: ./operator + if: ${{ github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'operator') }} + run: make install + + - name: Deploy game operator + working-directory: ./operator + if: ${{ github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'operator') }} + run: make deploy IMG=${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ env.SUB_NAMESPACE }}/operator:${{ github.event.inputs.label }} + + - name: Wait for MySQL to be ready + if: ${{ github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'api') }} + run: | + while true; do + POD_STATUS=$(kubectl get pod mysql-0 -n mysql --no-headers -o custom-columns=":status.phase" 2>/dev/null); + if [ "$POD_STATUS" ]; then + echo "Pod mysql-0 has been created with status: $POD_STATUS"; + break; + else + echo "Waiting for pod mysql-0 to be created..."; + sleep 5; + fi + done + kubectl wait --for=condition=Ready pod/mysql-0 -n mysql --timeout=120s + + while true; do + POD_STATUS=$(kubectl get pod -l app.kubernetes.io/component=router -n mysql --no-headers -o custom-columns=":status.phase" 2>/dev/null); \ + if [ "$POD_STATUS" ]; then + echo "MySQL router has been created with status: $POD_STATUS"; + break; + else + echo "Waiting for MySQL router to be created..."; + sleep 5; + fi + done + kubectl wait --for=condition=ready pod -l app.kubernetes.io/component=router -n mysql --timeout=120s + + - name: Install API + working-directory: ./helm/api + if: ${{ github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'api') }} + run: | + helm install -f values.yaml \ + --set-string image.label=${{ github.event.inputs.label }} \ + api . + + - name: Wait for external IP of API + if: ${{ github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'frontend') }} + run: | + until [ -n "$(kubectl get svc api -n api -o jsonpath='{.status.loadBalancer.ingress[0].ip}')" ]; do + sleep 5 + done + + - name: Install frontend + working-directory: ./helm/frontend + if: ${{ github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'frontend') }} + run: | + helm install -f values.yaml \ + --set-string appConfig.apiUrl=http://$(kubectl get svc api -n api -o jsonpath='{.status.loadBalancer.ingress[0].ip}'):$(kubectl get svc api -n api -o jsonpath='{.spec.ports[0].port}') \ + --set-string image.label=${{ github.event.inputs.label }} \ + frontend . \ No newline at end of file diff --git a/.github/workflows/uninstall-components-az.yml b/.github/workflows/uninstall-components-az.yml new file mode 100644 index 0000000..2f586f6 --- /dev/null +++ b/.github/workflows/uninstall-components-az.yml @@ -0,0 +1,82 @@ +name: Uninstall components from Azure + +on: + workflow_dispatch: + inputs: + component: + type: choice + description: Which component + required: true + options: + - frontend + - api + - api-mysql + - operator + - operator-stunner + - all + +jobs: + uninstall: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: true + + - name: Install Helm + uses: azure/setup-helm@v4.2.0 + with: + version: 'latest' + id: install1 + + - name: Install kubectl + uses: azure/setup-kubectl@v3 + with: + version: 'latest' + id: install2 + + - name: Login to Azure + run: az login --service-principal -u ${{ secrets.CLIENT_ID }} -p ${{ secrets.CLIENT_SECRET }} --tenant ${{ secrets.AZURERM_TENANT_ID }} + + - name: Connect to tailscale + uses: tailscale/github-action@v2 + with: + oauth-client-id: ${{secrets.TAILSCALE_CLIENT_ID_2}} + oauth-secret: ${{secrets.TAILSCALE_CLIENT_SECRET_2}} + tags: tag:ci + + - name: Configure kubernetes config + run: tailscale configure kubeconfig tailscale-operator + + - name: Uninstall MySQL + working-directory: ./helm/mysql + if: ${{ github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'mysql') }} + run: | + helm uninstall mysql -n mysql + helm uninstall mysql-operator -n mysql-operator + + - name: Uninstall STUNner + working-directory: ./helm/stunner + if: ${{ github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'stunner') }} + run: helm uninstall stunner -n stunner + + - name: Uninstall game operator manifests + working-directory: ./operator + if: ${{ github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'operator') }} + run: make uninstall + + - name: Undeploy game operator + working-directory: ./operator + if: ${{ github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'operator') }} + run: make undeploy + + - name: Uninstall API + working-directory: ./helm/api + if: ${{ github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'api') }} + run: helm uninstall api + + - name: Uninstall frontend + working-directory: ./helm/frontend + if: ${{ github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'frontend') }} + run: helm uninstall frontend \ No newline at end of file diff --git a/.github/workflows/upgrade-components-az.yml b/.github/workflows/upgrade-components-az.yml new file mode 100644 index 0000000..0298046 --- /dev/null +++ b/.github/workflows/upgrade-components-az.yml @@ -0,0 +1,132 @@ +# Assumes that the component was already installed to the cluster and we only want to update the image version +# MySQL and STUNner should already be installed when using this workflow +name: Upgrade components on Azure + +on: + workflow_dispatch: + inputs: + component: + type: choice + description: Which component + required: true + options: + - frontend + - api + - operator + - all + label: + type: string + description: Image label to use + +env: + REGISTRY: ghcr.io + NAMESPACE: austriandatalab + SUB_NAMESPACE: indiegamestream +jobs: + upgrade: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + submodules: true + + - name: Install Helm + uses: azure/setup-helm@v4.2.0 + with: + version: 'latest' + id: install1 + + - name: Install kubectl + uses: azure/setup-kubectl@v3 + with: + version: 'latest' + id: install2 + + - name: Login to Azure + run: az login --service-principal -u ${{ secrets.CLIENT_ID }} -p ${{ secrets.CLIENT_SECRET }} --tenant ${{ secrets.AZURERM_TENANT_ID }} + + - name: Connect to tailscale + uses: tailscale/github-action@v2 + with: + oauth-client-id: ${{secrets.TAILSCALE_CLIENT_ID_2}} + oauth-secret: ${{secrets.TAILSCALE_CLIENT_SECRET_2}} + tags: tag:ci + + - name: Configure kubernetes config + run: tailscale configure kubeconfig tailscale-operator + + - name: Install game operator manifests + working-directory: ./operator + if: ${{ github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'operator') }} + run: make install + + - name: Deploy game operator + working-directory: ./operator + if: ${{ github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'operator') }} + run: make deploy IMG=${{ env.REGISTRY }}/${{ env.NAMESPACE }}/${{ env.SUB_NAMESPACE }}/operator:${{ github.event.inputs.label }} + + - name: Undeploy game operator + working-directory: ./operator + if: ${{ github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'operator') }} + run: make undeploy + + - name: Wait for MySQL to be ready + if: ${{ github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'api') }} + run: | + while true; do + POD_STATUS=$(kubectl get pod mysql-0 -n mysql --no-headers -o custom-columns=":status.phase" 2>/dev/null); + if [ "$POD_STATUS" ]; then + echo "Pod mysql-0 has been created with status: $POD_STATUS"; + break; + else + echo "Waiting for pod mysql-0 to be created..."; + sleep 5; + fi + done + kubectl wait --for=condition=Ready pod/mysql-0 -n mysql --timeout=120s + + while true; do + POD_STATUS=$(kubectl get pod -l app.kubernetes.io/component=router -n mysql --no-headers -o custom-columns=":status.phase" 2>/dev/null); \ + if [ "$POD_STATUS" ]; then + echo "MySQL router has been created with status: $POD_STATUS"; + break; + else + echo "Waiting for MySQL router to be created..."; + sleep 5; + fi + done + kubectl wait --for=condition=ready pod -l app.kubernetes.io/component=router -n mysql --timeout=120s + + - name: Install API + working-directory: ./helm/api + if: ${{ github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'api') }} + run: | + helm upgrade -f values.yaml \ + --set-string env.mysqlRootPassword=${{ secrets.MYSQL_ROOT_PASSWORD }} \ + --set-string env.azureTenantId=${{ secrets.AZURE_TENANT_ID }} + --set-string env.azureClientId=${{ secrets.CLIENT_ID }} + --set-string env.azureClientSecret=${{ secrets.CLIENT_SECRET }} + --set-string env.azureStorageAccount=${{ secrets.AZURERM_STORAGE_ACCOUNT_NAME }} + --set-string env.azureContainerName=${{ secrets.AZURERM_CONTAINER_NAME }} + --set-string env.azureAksClusterName=${{ secrets.AZURERM_AKS_CLUSTER_NAME }} + --set-string env.azurermSubscriptionId=${{ secrets.AZURERM_SUBSCRIPTION_ID }} + --set-string env.azurermResourceGroupName=${{ secrets.AZURERM_RESOURCE_GROUP_NAME }} + --set-string image.label=${{ env.LABEL }} \ + api . + + - name: Wait for external IP of API + if: ${{ github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'frontend') }} + run: | + until [ -n "$(kubectl get svc api -n api -o jsonpath='{.status.loadBalancer.ingress[0].ip}')" ]; do + sleep 5 + done + + - name: Install frontend + working-directory: ./helm/frontend + if: ${{ github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'frontend') }} + run: | + helm install -f values.yaml \ + --set-string appConfig.apiUrl=http://$(kubectl get svc api -n api -o jsonpath='{.status.loadBalancer.ingress[0].ip}'):$(kubectl get svc api -n api -o jsonpath='{.spec.ports[0].port}') \ + --set-string image.label=${{ env.LABEL }} \ + frontend . \ No newline at end of file From c0fa61b3bd8eaecae12a712a10aea2e01e8a68d9 Mon Sep 17 00:00:00 2001 From: Thomas Riegler Date: Sat, 15 Jun 2024 14:31:01 +0200 Subject: [PATCH 02/16] Make GitHub understand --- .github/workflows/install-components-az.yml | 4 ++++ .github/workflows/uninstall-components-az.yml | 6 +++++- .github/workflows/upgrade-components-az.yml | 4 ++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/install-components-az.yml b/.github/workflows/install-components-az.yml index 14321c7..dd4c84b 100644 --- a/.github/workflows/install-components-az.yml +++ b/.github/workflows/install-components-az.yml @@ -1,6 +1,9 @@ name: Install components to Azure on: + push: + branches: + - feature/80-seperate-iac-install workflow_dispatch: inputs: component: @@ -25,6 +28,7 @@ env: jobs: install: runs-on: ubuntu-latest + if: ${{ github.event.name != 'push' }} steps: - name: Checkout repository uses: actions/checkout@v4 diff --git a/.github/workflows/uninstall-components-az.yml b/.github/workflows/uninstall-components-az.yml index 2f586f6..54a8b82 100644 --- a/.github/workflows/uninstall-components-az.yml +++ b/.github/workflows/uninstall-components-az.yml @@ -1,6 +1,9 @@ name: Uninstall components from Azure -on: +on: + push: + branches: + - feature/80-seperate-iac-install workflow_dispatch: inputs: component: @@ -18,6 +21,7 @@ on: jobs: uninstall: runs-on: ubuntu-latest + if: ${{ github.event.name != 'push' }} steps: - name: Checkout repository uses: actions/checkout@v4 diff --git a/.github/workflows/upgrade-components-az.yml b/.github/workflows/upgrade-components-az.yml index 0298046..4503265 100644 --- a/.github/workflows/upgrade-components-az.yml +++ b/.github/workflows/upgrade-components-az.yml @@ -3,6 +3,9 @@ name: Upgrade components on Azure on: + push: + branches: + - feature/80-seperate-iac-install workflow_dispatch: inputs: component: @@ -25,6 +28,7 @@ env: jobs: upgrade: runs-on: ubuntu-latest + if: ${{ github.event.name != 'push' }} steps: - name: Checkout repository uses: actions/checkout@v4 From bdebea80c6993208c5e0f301c55d91615faba0b3 Mon Sep 17 00:00:00 2001 From: Thomas Riegler Date: Sat, 15 Jun 2024 14:34:56 +0200 Subject: [PATCH 03/16] Removed push trigger --- .github/workflows/install-components-az.yml | 4 ---- .github/workflows/uninstall-components-az.yml | 4 ---- .github/workflows/upgrade-components-az.yml | 6 +----- 3 files changed, 1 insertion(+), 13 deletions(-) diff --git a/.github/workflows/install-components-az.yml b/.github/workflows/install-components-az.yml index dd4c84b..14321c7 100644 --- a/.github/workflows/install-components-az.yml +++ b/.github/workflows/install-components-az.yml @@ -1,9 +1,6 @@ name: Install components to Azure on: - push: - branches: - - feature/80-seperate-iac-install workflow_dispatch: inputs: component: @@ -28,7 +25,6 @@ env: jobs: install: runs-on: ubuntu-latest - if: ${{ github.event.name != 'push' }} steps: - name: Checkout repository uses: actions/checkout@v4 diff --git a/.github/workflows/uninstall-components-az.yml b/.github/workflows/uninstall-components-az.yml index 54a8b82..6240229 100644 --- a/.github/workflows/uninstall-components-az.yml +++ b/.github/workflows/uninstall-components-az.yml @@ -1,9 +1,6 @@ name: Uninstall components from Azure on: - push: - branches: - - feature/80-seperate-iac-install workflow_dispatch: inputs: component: @@ -21,7 +18,6 @@ on: jobs: uninstall: runs-on: ubuntu-latest - if: ${{ github.event.name != 'push' }} steps: - name: Checkout repository uses: actions/checkout@v4 diff --git a/.github/workflows/upgrade-components-az.yml b/.github/workflows/upgrade-components-az.yml index 4503265..c69df52 100644 --- a/.github/workflows/upgrade-components-az.yml +++ b/.github/workflows/upgrade-components-az.yml @@ -2,10 +2,7 @@ # MySQL and STUNner should already be installed when using this workflow name: Upgrade components on Azure -on: - push: - branches: - - feature/80-seperate-iac-install +on: workflow_dispatch: inputs: component: @@ -28,7 +25,6 @@ env: jobs: upgrade: runs-on: ubuntu-latest - if: ${{ github.event.name != 'push' }} steps: - name: Checkout repository uses: actions/checkout@v4 From 67de611e79982c2f2c6e3aec7dedacb9cab9ca6f Mon Sep 17 00:00:00 2001 From: Thomas Riegler Date: Sat, 15 Jun 2024 14:40:11 +0200 Subject: [PATCH 04/16] Always logout at the end of a workflow --- .github/workflows/deploy-az.yml | 1 + .github/workflows/install-components-az.yml | 6 +++++- .github/workflows/uninstall-components-az.yml | 6 +++++- .github/workflows/upgrade-components-az.yml | 6 +++++- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy-az.yml b/.github/workflows/deploy-az.yml index 5a9a253..689fcd3 100644 --- a/.github/workflows/deploy-az.yml +++ b/.github/workflows/deploy-az.yml @@ -99,4 +99,5 @@ jobs: terraform destroy -auto-approve || true - name: Logout of Azure + if: always() run: az logout \ No newline at end of file diff --git a/.github/workflows/install-components-az.yml b/.github/workflows/install-components-az.yml index 14321c7..9062a6f 100644 --- a/.github/workflows/install-components-az.yml +++ b/.github/workflows/install-components-az.yml @@ -136,4 +136,8 @@ jobs: helm install -f values.yaml \ --set-string appConfig.apiUrl=http://$(kubectl get svc api -n api -o jsonpath='{.status.loadBalancer.ingress[0].ip}'):$(kubectl get svc api -n api -o jsonpath='{.spec.ports[0].port}') \ --set-string image.label=${{ github.event.inputs.label }} \ - frontend . \ No newline at end of file + frontend . + + - name: Logout of Azure + if: always() + run: az logout \ No newline at end of file diff --git a/.github/workflows/uninstall-components-az.yml b/.github/workflows/uninstall-components-az.yml index 6240229..1a2b104 100644 --- a/.github/workflows/uninstall-components-az.yml +++ b/.github/workflows/uninstall-components-az.yml @@ -79,4 +79,8 @@ jobs: - name: Uninstall frontend working-directory: ./helm/frontend if: ${{ github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'frontend') }} - run: helm uninstall frontend \ No newline at end of file + run: helm uninstall frontend + + - name: Logout of Azure + if: always() + run: az logout \ No newline at end of file diff --git a/.github/workflows/upgrade-components-az.yml b/.github/workflows/upgrade-components-az.yml index c69df52..3ba4f0c 100644 --- a/.github/workflows/upgrade-components-az.yml +++ b/.github/workflows/upgrade-components-az.yml @@ -129,4 +129,8 @@ jobs: helm install -f values.yaml \ --set-string appConfig.apiUrl=http://$(kubectl get svc api -n api -o jsonpath='{.status.loadBalancer.ingress[0].ip}'):$(kubectl get svc api -n api -o jsonpath='{.spec.ports[0].port}') \ --set-string image.label=${{ env.LABEL }} \ - frontend . \ No newline at end of file + frontend . + + - name: Logout of Azure + if: always() + run: az logout \ No newline at end of file From 7115396701942b1f2b53de6a4e4ace545f692a74 Mon Sep 17 00:00:00 2001 From: Thomas Riegler Date: Sat, 15 Jun 2024 14:47:30 +0200 Subject: [PATCH 05/16] Made app config values required in frontend helm chart --- helm/frontend/templates/frontend-configmap.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/helm/frontend/templates/frontend-configmap.yaml b/helm/frontend/templates/frontend-configmap.yaml index 56f95b4..0113bde 100644 --- a/helm/frontend/templates/frontend-configmap.yaml +++ b/helm/frontend/templates/frontend-configmap.yaml @@ -1,3 +1,5 @@ +{{- required ".Values.appConfig.production is required!" .Values.appConfig.production -}} +{{- required ".Values.appConfig.apiUrl is required!" .Values.appConfig.apiUrl -}} apiVersion: v1 kind: ConfigMap metadata: From 429e2772f56a282e4f30bd1d92769ca62155fd95 Mon Sep 17 00:00:00 2001 From: Thomas Riegler Date: Sat, 15 Jun 2024 14:47:41 +0200 Subject: [PATCH 06/16] Fixes in workflow files --- .github/workflows/install-components-az.yml | 13 ++++++++++++- .github/workflows/uninstall-components-az.yml | 2 ++ .github/workflows/upgrade-components-az.yml | 4 ++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.github/workflows/install-components-az.yml b/.github/workflows/install-components-az.yml index 9062a6f..7aca4ee 100644 --- a/.github/workflows/install-components-az.yml +++ b/.github/workflows/install-components-az.yml @@ -13,6 +13,8 @@ on: - api-mysql - operator - operator-stunner + - stunner + - mysql - all label: type: string @@ -118,7 +120,16 @@ jobs: working-directory: ./helm/api if: ${{ github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'api') }} run: | - helm install -f values.yaml \ + helm upgrade -f values.yaml \ + --set-string env.mysqlRootPassword=${{ secrets.MYSQL_ROOT_PASSWORD }} \ + --set-string env.azureTenantId=${{ secrets.AZURE_TENANT_ID }} + --set-string env.azureClientId=${{ secrets.CLIENT_ID }} + --set-string env.azureClientSecret=${{ secrets.CLIENT_SECRET }} + --set-string env.azureStorageAccount=${{ secrets.AZURERM_STORAGE_ACCOUNT_NAME }} + --set-string env.azureContainerName=${{ secrets.AZURERM_CONTAINER_NAME }} + --set-string env.azureAksClusterName=${{ secrets.AZURERM_AKS_CLUSTER_NAME }} + --set-string env.azurermSubscriptionId=${{ secrets.AZURERM_SUBSCRIPTION_ID }} + --set-string env.azurermResourceGroupName=${{ secrets.AZURERM_RESOURCE_GROUP_NAME }} --set-string image.label=${{ github.event.inputs.label }} \ api . diff --git a/.github/workflows/uninstall-components-az.yml b/.github/workflows/uninstall-components-az.yml index 1a2b104..6391baf 100644 --- a/.github/workflows/uninstall-components-az.yml +++ b/.github/workflows/uninstall-components-az.yml @@ -13,6 +13,8 @@ on: - api-mysql - operator - operator-stunner + - stunner + - mysql - all jobs: diff --git a/.github/workflows/upgrade-components-az.yml b/.github/workflows/upgrade-components-az.yml index 3ba4f0c..335ec4f 100644 --- a/.github/workflows/upgrade-components-az.yml +++ b/.github/workflows/upgrade-components-az.yml @@ -112,7 +112,7 @@ jobs: --set-string env.azureAksClusterName=${{ secrets.AZURERM_AKS_CLUSTER_NAME }} --set-string env.azurermSubscriptionId=${{ secrets.AZURERM_SUBSCRIPTION_ID }} --set-string env.azurermResourceGroupName=${{ secrets.AZURERM_RESOURCE_GROUP_NAME }} - --set-string image.label=${{ env.LABEL }} \ + --set-string image.label=${{ github.event.inputs.label }} \ api . - name: Wait for external IP of API @@ -128,7 +128,7 @@ jobs: run: | helm install -f values.yaml \ --set-string appConfig.apiUrl=http://$(kubectl get svc api -n api -o jsonpath='{.status.loadBalancer.ingress[0].ip}'):$(kubectl get svc api -n api -o jsonpath='{.spec.ports[0].port}') \ - --set-string image.label=${{ env.LABEL }} \ + --set-string image.label=${{ github.event.inputs.label }} \ frontend . - name: Logout of Azure From b3c1a4f627846e09f097df3d4e5f5f6777ef51f2 Mon Sep 17 00:00:00 2001 From: Thomas Riegler Date: Sat, 15 Jun 2024 14:50:18 +0200 Subject: [PATCH 07/16] Fixes in workflow files --- .github/workflows/install-components-az.yml | 2 +- .github/workflows/upgrade-components-az.yml | 11 +---------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/.github/workflows/install-components-az.yml b/.github/workflows/install-components-az.yml index 7aca4ee..3874a35 100644 --- a/.github/workflows/install-components-az.yml +++ b/.github/workflows/install-components-az.yml @@ -120,7 +120,7 @@ jobs: working-directory: ./helm/api if: ${{ github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'api') }} run: | - helm upgrade -f values.yaml \ + helm install -f values.yaml \ --set-string env.mysqlRootPassword=${{ secrets.MYSQL_ROOT_PASSWORD }} \ --set-string env.azureTenantId=${{ secrets.AZURE_TENANT_ID }} --set-string env.azureClientId=${{ secrets.CLIENT_ID }} diff --git a/.github/workflows/upgrade-components-az.yml b/.github/workflows/upgrade-components-az.yml index 335ec4f..993a6ca 100644 --- a/.github/workflows/upgrade-components-az.yml +++ b/.github/workflows/upgrade-components-az.yml @@ -103,15 +103,6 @@ jobs: if: ${{ github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'api') }} run: | helm upgrade -f values.yaml \ - --set-string env.mysqlRootPassword=${{ secrets.MYSQL_ROOT_PASSWORD }} \ - --set-string env.azureTenantId=${{ secrets.AZURE_TENANT_ID }} - --set-string env.azureClientId=${{ secrets.CLIENT_ID }} - --set-string env.azureClientSecret=${{ secrets.CLIENT_SECRET }} - --set-string env.azureStorageAccount=${{ secrets.AZURERM_STORAGE_ACCOUNT_NAME }} - --set-string env.azureContainerName=${{ secrets.AZURERM_CONTAINER_NAME }} - --set-string env.azureAksClusterName=${{ secrets.AZURERM_AKS_CLUSTER_NAME }} - --set-string env.azurermSubscriptionId=${{ secrets.AZURERM_SUBSCRIPTION_ID }} - --set-string env.azurermResourceGroupName=${{ secrets.AZURERM_RESOURCE_GROUP_NAME }} --set-string image.label=${{ github.event.inputs.label }} \ api . @@ -126,7 +117,7 @@ jobs: working-directory: ./helm/frontend if: ${{ github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'frontend') }} run: | - helm install -f values.yaml \ + helm upgrade -f values.yaml \ --set-string appConfig.apiUrl=http://$(kubectl get svc api -n api -o jsonpath='{.status.loadBalancer.ingress[0].ip}'):$(kubectl get svc api -n api -o jsonpath='{.spec.ports[0].port}') \ --set-string image.label=${{ github.event.inputs.label }} \ frontend . From 0c3c3e107f107a298b2a9c52e8724288164c4a0e Mon Sep 17 00:00:00 2001 From: Thomas Riegler Date: Sat, 15 Jun 2024 14:52:08 +0200 Subject: [PATCH 08/16] Fixes in workflow files --- .github/workflows/install-components-az.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/install-components-az.yml b/.github/workflows/install-components-az.yml index 3874a35..39403d3 100644 --- a/.github/workflows/install-components-az.yml +++ b/.github/workflows/install-components-az.yml @@ -122,14 +122,14 @@ jobs: run: | helm install -f values.yaml \ --set-string env.mysqlRootPassword=${{ secrets.MYSQL_ROOT_PASSWORD }} \ - --set-string env.azureTenantId=${{ secrets.AZURE_TENANT_ID }} - --set-string env.azureClientId=${{ secrets.CLIENT_ID }} - --set-string env.azureClientSecret=${{ secrets.CLIENT_SECRET }} - --set-string env.azureStorageAccount=${{ secrets.AZURERM_STORAGE_ACCOUNT_NAME }} - --set-string env.azureContainerName=${{ secrets.AZURERM_CONTAINER_NAME }} - --set-string env.azureAksClusterName=${{ secrets.AZURERM_AKS_CLUSTER_NAME }} - --set-string env.azurermSubscriptionId=${{ secrets.AZURERM_SUBSCRIPTION_ID }} - --set-string env.azurermResourceGroupName=${{ secrets.AZURERM_RESOURCE_GROUP_NAME }} + --set-string env.azureTenantId=${{ secrets.AZURE_TENANT_ID }} \ + --set-string env.azureClientId=${{ secrets.CLIENT_ID }} \ + --set-string env.azureClientSecret=${{ secrets.CLIENT_SECRET }} \ + --set-string env.azureStorageAccount=${{ secrets.AZURERM_STORAGE_ACCOUNT_NAME }} \ + --set-string env.azureContainerName=${{ secrets.AZURERM_CONTAINER_NAME }} \ + --set-string env.azureAksClusterName=${{ secrets.AZURERM_AKS_CLUSTER_NAME }} \ + --set-string env.azurermSubscriptionId=${{ secrets.AZURERM_SUBSCRIPTION_ID }} \ + --set-string env.azurermResourceGroupName=${{ secrets.AZURERM_RESOURCE_GROUP_NAME }} \ --set-string image.label=${{ github.event.inputs.label }} \ api . From 1972e015f2ca01af0ecbe9234ff623bede28436c Mon Sep 17 00:00:00 2001 From: Thomas Riegler Date: Sat, 15 Jun 2024 15:17:06 +0200 Subject: [PATCH 09/16] Small fix --- .github/workflows/install-components-az.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/install-components-az.yml b/.github/workflows/install-components-az.yml index 39403d3..eae5120 100644 --- a/.github/workflows/install-components-az.yml +++ b/.github/workflows/install-components-az.yml @@ -122,7 +122,7 @@ jobs: run: | helm install -f values.yaml \ --set-string env.mysqlRootPassword=${{ secrets.MYSQL_ROOT_PASSWORD }} \ - --set-string env.azureTenantId=${{ secrets.AZURE_TENANT_ID }} \ + --set-string env.azureTenantId=${{ secrets.AZURERM_TENANT_ID }} \ --set-string env.azureClientId=${{ secrets.CLIENT_ID }} \ --set-string env.azureClientSecret=${{ secrets.CLIENT_SECRET }} \ --set-string env.azureStorageAccount=${{ secrets.AZURERM_STORAGE_ACCOUNT_NAME }} \ From 6efd09a51eb8c23b7267a9a86f2886e48367f5c2 Mon Sep 17 00:00:00 2001 From: Thomas Riegler Date: Sat, 15 Jun 2024 15:43:29 +0200 Subject: [PATCH 10/16] Install Grafana --- .github/workflows/install-components-az.yml | 10 ++++++++++ .github/workflows/uninstall-components-az.yml | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/.github/workflows/install-components-az.yml b/.github/workflows/install-components-az.yml index eae5120..a2a948a 100644 --- a/.github/workflows/install-components-az.yml +++ b/.github/workflows/install-components-az.yml @@ -15,6 +15,7 @@ on: - operator-stunner - stunner - mysql + - grafana - all label: type: string @@ -58,6 +59,15 @@ jobs: - name: Configure kubernetes config run: tailscale configure kubeconfig tailscale-operator + - name: Install Grafana + if: ${{ github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'grafana') }} + run: | + helm repo add grafana https://grafana.github.io/helm-charts + helm repo update + helm install --set-string service.loadBalancerClass=tailscale \ + --set-json 'service.annotations={"tailscale.com/hostname": "grafana"}' \ + grafana grafana/grafana --create-namespace --namespace monitoring + - name: Install MySQL working-directory: ./helm/mysql if: ${{ github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'mysql') }} diff --git a/.github/workflows/uninstall-components-az.yml b/.github/workflows/uninstall-components-az.yml index 6391baf..767c9ac 100644 --- a/.github/workflows/uninstall-components-az.yml +++ b/.github/workflows/uninstall-components-az.yml @@ -15,6 +15,7 @@ on: - operator-stunner - stunner - mysql + - grafana - all jobs: @@ -83,6 +84,10 @@ jobs: if: ${{ github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'frontend') }} run: helm uninstall frontend + - name: Uninstall Grafana + if: ${{ github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'grafana') }} + run: helm uninstall grafana -n monitoring + - name: Logout of Azure if: always() run: az logout \ No newline at end of file From 751bf3dbe47c9fa51542b2abd90e0e320061db44 Mon Sep 17 00:00:00 2001 From: Thomas Riegler Date: Sat, 15 Jun 2024 15:48:56 +0200 Subject: [PATCH 11/16] Added right service type --- .github/workflows/install-components-az.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/install-components-az.yml b/.github/workflows/install-components-az.yml index a2a948a..42c11b6 100644 --- a/.github/workflows/install-components-az.yml +++ b/.github/workflows/install-components-az.yml @@ -65,6 +65,7 @@ jobs: helm repo add grafana https://grafana.github.io/helm-charts helm repo update helm install --set-string service.loadBalancerClass=tailscale \ + --set service.type=LoadBalancer --set-json 'service.annotations={"tailscale.com/hostname": "grafana"}' \ grafana grafana/grafana --create-namespace --namespace monitoring From 417d40fc0ef50b2708926d5fc8fea735ae4383a3 Mon Sep 17 00:00:00 2001 From: Thomas Riegler Date: Sat, 15 Jun 2024 15:49:42 +0200 Subject: [PATCH 12/16] Typo --- .github/workflows/install-components-az.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/install-components-az.yml b/.github/workflows/install-components-az.yml index 42c11b6..3bdc45b 100644 --- a/.github/workflows/install-components-az.yml +++ b/.github/workflows/install-components-az.yml @@ -65,7 +65,7 @@ jobs: helm repo add grafana https://grafana.github.io/helm-charts helm repo update helm install --set-string service.loadBalancerClass=tailscale \ - --set service.type=LoadBalancer + --set service.type=LoadBalancer \ --set-json 'service.annotations={"tailscale.com/hostname": "grafana"}' \ grafana grafana/grafana --create-namespace --namespace monitoring From 00b0c6831499b654448dbcfd051a57247b2c49b5 Mon Sep 17 00:00:00 2001 From: Thomas Riegler Date: Sat, 15 Jun 2024 15:59:13 +0200 Subject: [PATCH 13/16] Changed Grafana admin password --- .github/workflows/install-components-az.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/install-components-az.yml b/.github/workflows/install-components-az.yml index 3bdc45b..3e3c639 100644 --- a/.github/workflows/install-components-az.yml +++ b/.github/workflows/install-components-az.yml @@ -66,6 +66,7 @@ jobs: helm repo update helm install --set-string service.loadBalancerClass=tailscale \ --set service.type=LoadBalancer \ + --set-string adminPassword=${{ secrets.GRAFANA_ADMIN_PASSWORD }} \ --set-json 'service.annotations={"tailscale.com/hostname": "grafana"}' \ grafana grafana/grafana --create-namespace --namespace monitoring From ec0218093b1692e987056aef8784b2403aa8146d Mon Sep 17 00:00:00 2001 From: Thomas Riegler Date: Sat, 15 Jun 2024 21:29:26 +0200 Subject: [PATCH 14/16] Changed secret name --- .github/workflows/install-components-az.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/install-components-az.yml b/.github/workflows/install-components-az.yml index 3e3c639..9c1e847 100644 --- a/.github/workflows/install-components-az.yml +++ b/.github/workflows/install-components-az.yml @@ -138,7 +138,7 @@ jobs: --set-string env.azureClientId=${{ secrets.CLIENT_ID }} \ --set-string env.azureClientSecret=${{ secrets.CLIENT_SECRET }} \ --set-string env.azureStorageAccount=${{ secrets.AZURERM_STORAGE_ACCOUNT_NAME }} \ - --set-string env.azureContainerName=${{ secrets.AZURERM_CONTAINER_NAME }} \ + --set-string env.azureContainerName=${{ secrets.AZURERM_GAME_CONTAINER_NAME }} \ --set-string env.azureAksClusterName=${{ secrets.AZURERM_AKS_CLUSTER_NAME }} \ --set-string env.azurermSubscriptionId=${{ secrets.AZURERM_SUBSCRIPTION_ID }} \ --set-string env.azurermResourceGroupName=${{ secrets.AZURERM_RESOURCE_GROUP_NAME }} \ From 8ded1a48e1836ffc031bfe9d0d200e588411ed65 Mon Sep 17 00:00:00 2001 From: Kai Date: Sun, 16 Jun 2024 00:22:06 +0200 Subject: [PATCH 15/16] read k8s config from environment --- api/cmd/main.go | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/api/cmd/main.go b/api/cmd/main.go index 42ab015..e9a9df1 100644 --- a/api/cmd/main.go +++ b/api/cmd/main.go @@ -21,6 +21,7 @@ import ( "net/http" "os" "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/client/config" ) func setupRouter(db *sql.DB, azClient *azblob.Client) *gin.Engine { @@ -112,19 +113,27 @@ func getKubeConfig() armcontainerservice.ManagedClustersClientListClusterUserCre } func k8sClient() client.Client { - kubeConfig := getKubeConfig() - if len(kubeConfig.Kubeconfigs) == 0 { - log.Fatalf("The kubeconfig request was successful but it's response body is empty") - } - if len(kubeConfig.Kubeconfigs) > 1 { - log.Println("WARNING: Multiple kube-config's have been found. The first one will be used.") - } + //Try to read k8s config directly from environment + restConfig, err := config.GetConfig() + if err != nil || restConfig == nil { + //If it fails, try to get it from azure + kubeConfig := getKubeConfig() + if len(kubeConfig.Kubeconfigs) == 0 { + log.Fatalf("The kubeconfig request was successful but it's response body is empty") + } + if len(kubeConfig.Kubeconfigs) > 1 { + log.Println("WARNING: Multiple kube-config's have been found. The first one will be used.") + } - clientConfig, err := clientcmd.NewClientConfigFromBytes(kubeConfig.Kubeconfigs[0].Value) - if err != nil { - log.Fatalf("failed to load kube config: %v", err) + clientConfig, err := clientcmd.NewClientConfigFromBytes(kubeConfig.Kubeconfigs[0].Value) + if err != nil { + log.Fatalf("failed to create client config: %v", err) + } + restConfig, err = clientConfig.ClientConfig() + if err != nil { + log.Fatalf("failed to load kube config: %v", err) + } } - restConfig, err := clientConfig.ClientConfig() k8sc, err := client.New( restConfig, From db2e4c7ba70abf1557b562a4a4ce6606108f13de Mon Sep 17 00:00:00 2001 From: Thomas Riegler Date: Sun, 16 Jun 2024 13:03:16 +0200 Subject: [PATCH 16/16] Small fix --- .github/workflows/uninstall-components-az.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/uninstall-components-az.yml b/.github/workflows/uninstall-components-az.yml index 767c9ac..c7d54c4 100644 --- a/.github/workflows/uninstall-components-az.yml +++ b/.github/workflows/uninstall-components-az.yml @@ -54,38 +54,38 @@ jobs: - name: Uninstall MySQL working-directory: ./helm/mysql - if: ${{ github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'mysql') }} + if: ${{ !cancelled() && (github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'mysql')) }} run: | helm uninstall mysql -n mysql helm uninstall mysql-operator -n mysql-operator - name: Uninstall STUNner working-directory: ./helm/stunner - if: ${{ github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'stunner') }} + if: ${{ !cancelled() && (github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'stunner')) }} run: helm uninstall stunner -n stunner - name: Uninstall game operator manifests working-directory: ./operator - if: ${{ github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'operator') }} + if: ${{ !cancelled() && (github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'operator')) }} run: make uninstall - name: Undeploy game operator working-directory: ./operator - if: ${{ github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'operator') }} + if: ${{ !cancelled() && (github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'operator')) }} run: make undeploy - name: Uninstall API working-directory: ./helm/api - if: ${{ github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'api') }} + if: ${{ !cancelled() && (github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'api')) }} run: helm uninstall api - name: Uninstall frontend working-directory: ./helm/frontend - if: ${{ github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'frontend') }} + if: ${{ !cancelled() && (github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'frontend')) }} run: helm uninstall frontend - name: Uninstall Grafana - if: ${{ github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'grafana') }} + if: ${{ !cancelled() && (github.event.inputs.component == 'all' || contains(github.event.inputs.component, 'grafana')) }} run: helm uninstall grafana -n monitoring - name: Logout of Azure