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

Commit

Permalink
Azure workflow (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
pbochynski authored Dec 11, 2020
1 parent 810dd38 commit 5e706ff
Show file tree
Hide file tree
Showing 2 changed files with 151 additions and 0 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/app-connector-e2e-gardener-azure.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Tests on Azure

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,helm-broker,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: 40
steps:
- uses: actions/checkout@v2
# - name: Setup tmate session
# uses: mxschmitt/action-tmate@v3
- name: Create cluster, install helm
timeout-minutes: 15
env:
GARDEN_KUBECONFIG: ${{ secrets.GARDEN_KUBECONFIG }}
SHOOT_NAME: ${{ github.event.inputs.shoot }}
run: |
./create-cluster-gardener-azure.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: 15
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: 10
run: |
./app-connector-example.sh
- 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
78 changes: 78 additions & 0 deletions create-cluster-gardener-azure.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#!/bin/bash

echo $GARDEN_KUBECONFIG | base64 --decode > ./garden-kubeconfig.yaml
export SHOOT_NAME=${SHOOT_NAME:-az$(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: azure
controlPlaneConfig:
apiVersion: azure.provider.extensions.gardener.cloud/v1alpha1
kind: ControlPlaneConfig
infrastructureConfig:
apiVersion: azure.provider.extensions.gardener.cloud/v1alpha1
kind: InfrastructureConfig
networks:
vnet:
cidr: 10.250.0.0/16
workers: 10.250.0.0/16
zoned: true
workers:
- name: worker-azure
machine:
type: Standard_D4_v3
image:
name: gardenlinux
version: 184.0.0
maximum: 1
minimum: 1
maxSurge: 1
maxUnavailable: 0
volume:
type: Standard_LRS
size: 50Gi
zones:
- '3'
systemComponents:
allow: true
networking:
type: calico
pods: 100.96.0.0/11
nodes: 10.250.0.0/16
services: 100.64.0.0/13
cloudProfileName: az
region: northeurope
secretBindingName: azure-pb
kubernetes:
version: 1.18.12
purpose: evaluation
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 5e706ff

Please sign in to comment.