From fb40f68f6f486ffda0e5f66c1f5ecf7107f2313c Mon Sep 17 00:00:00 2001
From: Piotr
Date: Mon, 28 Dec 2020 08:44:07 +0100
Subject: [PATCH] Gardener - AWS workflow (#58)
---
.../app-connector-e2e-gardener-aws.yml | 77 +++++++++++++++++++
create-cluster-gardener-aws.sh | 76 ++++++++++++++++++
2 files changed, 153 insertions(+)
create mode 100644 .github/workflows/app-connector-e2e-gardener-aws.yml
create mode 100755 create-cluster-gardener-aws.sh
diff --git a/.github/workflows/app-connector-e2e-gardener-aws.yml b/.github/workflows/app-connector-e2e-gardener-aws.yml
new file mode 100644
index 0000000..231790a
--- /dev/null
+++ b/.github/workflows/app-connector-e2e-gardener-aws.yml
@@ -0,0 +1,77 @@
+name: Tests on Gardener
+
+on:
+ workflow_dispatch:
+ inputs:
+ repository:
+ description: 'Repository'
+ required: true
+ default: 'kyma-project/kyma'
+ branch:
+ description: 'Branch'
+ required: true
+ default: 'master'
+ shoot:
+ description: 'Shoot cluster name'
+ required: true
+ default: 'ci'
+ skip:
+ description: 'Skip modules'
+ required: false
+ default: 'monitoring,tracing,kiali,logging,console,cluster-users,dex'
+ keep:
+ description: 'Keep cluster alive'
+ required: true
+ default: true
+ schedule:
+ - cron: '0 * * * *' # every hour
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ timeout-minutes: 30
+ steps:
+ - uses: actions/checkout@v2
+ # - name: Setup tmate session
+ # uses: mxschmitt/action-tmate@v3
+ - name: Create cluster, install helm
+ timeout-minutes: 10
+ env:
+ GARDEN_KUBECONFIG: ${{ secrets.GARDEN_KUBECONFIG_AWS }}
+ SHOOT_NAME: ${{ github.event.inputs.shoot }}
+ run: |
+ ./create-cluster-gardener.sh
+ while [[ $(kubectl get nodes -o 'jsonpath={..status.conditions[?(@.type=="Ready")].status}') != "True" ]]; do echo "Waiting for cluster nodes to be ready"; sleep 2; done
+ - name: Install Istio
+ timeout-minutes: 5
+ run: |
+ ./install-istio.sh -f config-istio.yaml
+ - name: Install Kyma
+ timeout-minutes: 10
+ env:
+ SKIP_MODULES: monitoring,tracing,kiali,logging,console,cluster-users,dex
+ run: |
+ SKIP=${{ github.event.inputs.skip }}
+ export SKIP_MODULES=${SKIP:-$SKIP_MODULES}
+ ./download-kyma-charts.sh ${{ github.event.inputs.repository }} ${{ github.event.inputs.branch }}
+ ./install-kyma-gardener.sh
+ - name: Run End To End Test
+ timeout-minutes: 8
+ run: |
+ cd fast-integration
+ npm install
+ npm test
+ - name: Uninstall Kyma
+ if: ${{ always() }}
+ run: |
+ KEEP=${{ github.event.inputs.keep }}
+ if [[ $KEEP == "true" ]]; then
+ echo "Keeping cluster alive"
+ exit 0
+ fi
+ echo "Deleting cluster ..."
+ ./uninstall-kyma.sh
+ export SHOOT_NAME=$(kubectl get cm shoot-info -n kube-system -ojsonpath='{.data.shootName}')
+ kubectl --kubeconfig ./garden-kubeconfig.yaml annotate shoot $SHOOT_NAME confirmation.gardener.cloud/deletion=true
+ kubectl --kubeconfig ./garden-kubeconfig.yaml delete shoot $SHOOT_NAME --force=true --wait=false
+
diff --git a/create-cluster-gardener-aws.sh b/create-cluster-gardener-aws.sh
new file mode 100755
index 0000000..b2f1bfb
--- /dev/null
+++ b/create-cluster-gardener-aws.sh
@@ -0,0 +1,76 @@
+#!/bin/bash
+
+echo $GARDEN_KUBECONFIG | base64 --decode > ./garden-kubeconfig.yaml
+export SHOOT_NAME=${SHOOT_NAME:-c$(date +"%d%H%M%S")}
+
+cat < ~/.kube/config
+chmod 600 ~/.kube/config
\ No newline at end of file