Skip to content
This repository was archived by the owner on Aug 6, 2021. It is now read-only.

Commit

Permalink
Gardener - AWS workflow (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
pbochynski authored Dec 28, 2020
1 parent d46bbc6 commit fb40f68
Show file tree
Hide file tree
Showing 2 changed files with 153 additions and 0 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/app-connector-e2e-gardener-aws.yml
Original file line number Diff line number Diff line change
@@ -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
76 changes: 76 additions & 0 deletions create-cluster-gardener-aws.sh
Original file line number Diff line number Diff line change
@@ -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 <<EOF | kubectl --kubeconfig ./garden-kubeconfig.yaml apply -f -
kind: Shoot
apiVersion: core.gardener.cloud/v1beta1
metadata:
name: $SHOOT_NAME
spec:
provider:
type: aws
infrastructureConfig:
apiVersion: aws.provider.extensions.gardener.cloud/v1alpha1
kind: InfrastructureConfig
networks:
vpc:
cidr: 10.250.0.0/16
zones:
- name: eu-central-1b
workers: 10.250.0.0/19
public: 10.250.32.0/20
internal: 10.250.48.0/20
controlPlaneConfig:
apiVersion: aws.provider.extensions.gardener.cloud/v1alpha1
kind: ControlPlaneConfig
workers:
- name: worker-mk12q
minimum: 1
maximum: 1
maxSurge: 1
machine:
type: m5.xlarge
image:
name: gardenlinux
version: 184.0.0
zones:
- eu-central-1b
volume:
type: gp2
size: 50Gi
networking:
type: calico
nodes: 10.250.0.0/16
cloudProfileName: aws
secretBindingName: trial-secretbinding-aws
region: eu-central-1
purpose: evaluation
kubernetes:
version: 1.18.12
addons:
kubernetesDashboard:
enabled: false
nginxIngress:
enabled: false
maintenance:
timeWindow:
begin: 220000+0000
end: 230000+0000
autoUpdate:
kubernetesVersion: true
machineImageVersion: true
hibernation:
schedules: []
EOF

STATUS="False"
while [[ $STATUS != "True" ]]; do
STATUS=$(kubectl --kubeconfig ./garden-kubeconfig.yaml get shoot $SHOOT_NAME -ojson | jq -r '.status.conditions[] | select(.type=="EveryNodeReady") | .status')
echo "Waiting for shoot $SHOOT_NAME nodes to be ready: $(kubectl --kubeconfig ./garden-kubeconfig.yaml get shoot $SHOOT_NAME -ojsonpath='{.status.lastOperation.description}')"
sleep 5
done

kubectl --kubeconfig ./garden-kubeconfig.yaml get secret $SHOOT_NAME.kubeconfig -ojsonpath='{.data.kubeconfig}' | base64 --decode > ~/.kube/config
chmod 600 ~/.kube/config

0 comments on commit fb40f68

Please sign in to comment.