Skip to content

Commit

Permalink
Replace GKE with microk8 (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub Błaszczyk authored and aeneasr committed Jul 30, 2019
1 parent 8ce86e7 commit d8f9b12
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 18 deletions.
40 changes: 29 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,37 @@ jobs:
- run: helm lint ./helm/charts/example-idp/

test:
docker:
- image: google/cloud-sdk
working_directory: /go/src/github.com/ory/k8s
machine:
image: ubuntu-1604:201903-01
docker_layer_caching: true
steps:
- checkout
- run: |
echo $GCLOUD_SERVICE_KEY | base64 -d | gcloud auth activate-service-account --key-file=-
- run: |
eval "$KUBECTL_COMMAND"
- run: kubectl get pods
- run: curl -L https://git.io/get_helm.sh | bash
- run: |
helm init --service-account $TILLER_SERVICE_ACCOUNT --tiller-namespace $TILLER_NAMESPACE
- run:
name: "Install microk8s & kubectl"
command: |
sudo apt-get update
sudo apt-get -y install snapd
sudo snap install microk8s --classic
sudo snap install kubectl --classic
snap info microk8s
- run:
name: "System setup"
command: |
echo 'export PATH=/snap/bin:$PATH' >> $BASH_ENV
source $BASH_ENV
sudo iptables -P FORWARD ACCEPT
- run:
name: "Start microk8s"
command: |
microk8s.start
microk8s.status
microk8s.enable dns
kubectl get all --all-namespaces
- run:
name: "Install Helm"
command: |
curl -L https://git.io/get_helm.sh | bash
helm init --service-account default --wait
- run: .circleci/helm-test.sh oathkeeper
- run: .circleci/helm-test.sh hydra

Expand Down
14 changes: 7 additions & 7 deletions .circleci/helm-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
set -Eeuxo pipefail
cd "$( dirname "${BASH_SOURCE[0]}" )/.."

release=$(echo cci-$(date +%s)-$1-${CIRCLE_SHA1}| cut -c 1-50)
release=$(echo cci-$(date +%s)-$1-${CIRCLE_SHA1}| cut -c 1-20)

function cleanup {
helm del --tiller-namespace ${TILLER_NAMESPACE} --purge ${release} || true
helm del --purge ${release} || true
}
trap cleanup EXIT

helm install --tiller-namespace ${TILLER_NAMESPACE} --namespace ${TILLER_NAMESPACE} -f .circleci/values/$1.yaml -n ${release} ./helm/charts/$1
helm install -f .circleci/values/$1.yaml -n ${release} ./helm/charts/$1 --wait

n=0
until [[ $n -ge 5 ]]; do
helm test --timeout 90 --cleanup --tiller-namespace ${TILLER_NAMESPACE} ${release} && exit 0 # substitute your command here
kubectl delete pods/${release}-test-connection --namespace ${TILLER_NAMESPACE}
helm test --timeout 90 --cleanup ${release} && exit 0 # substitute your command here
kubectl delete pod ${release}-test-connection
n=$[$n+1]
sleep 5
sleep 10
done

exit 1
exit 1

0 comments on commit d8f9b12

Please sign in to comment.