From 8d0ed4c3f8baea238ea2af30f80a616d98df9c32 Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Wed, 22 Mar 2023 09:58:53 +0100 Subject: [PATCH] create cluster config --- .woodpecker/e2e.yml | 39 +++++++++++++++++++-------------------- e2e/kind-cluster.yml | 17 +++++++++++++++++ 2 files changed, 36 insertions(+), 20 deletions(-) create mode 100644 e2e/kind-cluster.yml diff --git a/.woodpecker/e2e.yml b/.woodpecker/e2e.yml index 552f7a6..38f2a44 100644 --- a/.woodpecker/e2e.yml +++ b/.woodpecker/e2e.yml @@ -17,7 +17,7 @@ services: matrix: k8s: # from https://hub.docker.com/r/kindest/node/tags -# - v1.25.3 # renovate: kindest + # - v1.25.3 # renovate: kindest - v1.26.2 # renovate: kindest pipeline: @@ -29,15 +29,14 @@ pipeline: commands: - apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/community docker-cli kind - export KUBECONFIG=$${CI_WORKSPACE}/kube.config - - sleep 30s + - sleep 15s - docker info - kind create cluster --help - - kind create cluster --name chart-testing --image kindest/node:${k8s} --wait 60s + - kind create cluster --config e2e/kind.cluster.yml --image kindest/node:${k8s} --wait 1m - kind get clusters - docker ps - - docker network ls - - docker inspect chart-testing-control-plane - + #replace localhost or 0.0.0.0 in the kubeconfig file with "docker", in order to be able to reach the cluster through the docker service + - sed -i -E -e 's/localhost|0\.0\.0\.0/'docker'/g' $${KUBECONFIG} chart-testing: image: alpine:3.17.2 @@ -48,17 +47,17 @@ pipeline: - export KUBECONFIG=$${CI_WORKSPACE}/kube.config - kubectl get no -o wide - delete-cluster: - image: alpine:3.17.2 - pull: true - environment: - DOCKER_HOST: tcp://docker:2375 - commands: - - apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/community docker-cli kind - - export KUBECONFIG=$${CI_WORKSPACE}/kube.config - - kind delete cluster --name chart-testing - - docker ps - when: - status: - - success - - failure + # delete-cluster: + # image: alpine:3.17.2 + # pull: true + # environment: + # DOCKER_HOST: tcp://docker:2375 + # commands: + # - apk add --no-cache -X http://dl-cdn.alpinelinux.org/alpine/edge/community docker-cli kind + # - export KUBECONFIG=$${CI_WORKSPACE}/kube.config + # - kind delete cluster --name chart-testing + # - docker ps + # when: + # status: + # - success + # - failure diff --git a/e2e/kind-cluster.yml b/e2e/kind-cluster.yml new file mode 100644 index 0000000..3261f26 --- /dev/null +++ b/e2e/kind-cluster.yml @@ -0,0 +1,17 @@ +# based on https://github.com/kind-ci/examples/blob/master/drone/.drone.yml +apiVersion: kind.x-k8s.io/v1alpha4 +kind: Cluster +name: chart-testing +networking: + apiServerAddress: "0.0.0.0" + +nodes: +# add to the apiServer certSANs the name of the drone service in order to be able to reach the cluster through it +- role: control-plane + kubeadmConfigPatches: + - | + kind: ClusterConfiguration + apiServer: + certSANs: + - "docker" +- role: worker \ No newline at end of file