create cluster config

This commit is contained in:
Michael Kriese 2023-03-22 09:58:53 +01:00
parent 054ed49110
commit 8d0ed4c3f8
No known key found for this signature in database
GPG key ID: B83F553A0724D44E
2 changed files with 36 additions and 20 deletions

View file

@ -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

17
e2e/kind-cluster.yml Normal file
View file

@ -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