Skip to content

Commit

Permalink
kubeadm: enable join dry-run e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SataQiu committed Oct 26, 2024
1 parent 5433725 commit 8994f1a
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,22 @@ tasks:
docker exec {{ .vars.clusterName }}-control-plane-1 kubeadm init --ignore-preflight-errors={{ .vars.kubeadmIgnorePreflightErrors }} --kubernetes-version={{ .vars.kubernetesVersion }} --dry-run=true --v={{ .vars.kubeadmVerbosity }} || exit 1
docker exec {{ .vars.clusterName }}-control-plane-1 kubeadm init --ignore-preflight-errors={{ .vars.kubeadmIgnorePreflightErrors }} --kubernetes-version={{ .vars.kubernetesVersion }} --upload-certs=true --dry-run=true --v={{ .vars.kubeadmVerbosity }} || exit 1
timeout: 5m
- name: join-dryrun-without-real-control-plane
description: |
Join the other nodes to the Kubernetes cluster in dryrun mode without a real control plane
cmd: /bin/bash
args:
- -c
- |
required_version="1.32" # join dry-run without real control plane is available since v1.32
current_version=$(echo "{{ .vars.kubernetesVersion }}" | grep -oP '\d+\.\d+')
if awk "BEGIN {exit !($current_version < $required_version)}"; then
echo "Join dry-run without real control plane is not available for Kubernetes version {{ .vars.kubernetesVersion }}. Skipping."
exit 0
fi
docker exec {{ .vars.clusterName }}-worker-1 bash -c "until crictl ps &> /dev/null; do echo 'Waiting for the container runtime to be running ...'; sleep 1; done"
docker exec {{ .vars.clusterName }}-worker-1 kubeadm join 192.168.0.101:6443 --token abcdef.abcdef0123456789 --discovery-token-ca-cert-hash sha256:3b793efefe27a19f93b0fbe6e637e9c41d0dde8a377d6ab1c0f656bf1136dd8a --ignore-preflight-errors={{ .vars.kubeadmIgnorePreflightErrors }} --dry-run=true --v={{ .vars.kubeadmVerbosity }} || exit 1
timeout: 5m
- name: init
description: |
Initializes the Kubernetes cluster with version "initVersion"
Expand All @@ -72,9 +88,9 @@ tasks:
- --loglevel=debug
- --kubeadm-verbosity={{ .vars.kubeadmVerbosity }}
timeout: 5m
- name: join-dryrun
- name: join-dryrun-against-real-control-plane
description: |
Join the other nodes to the Kubernetes cluster in dryrun mode
Join the other nodes to the Kubernetes cluster in dryrun mode against the real control plane
cmd: /bin/bash
args:
- -c
Expand Down
20 changes: 18 additions & 2 deletions kinder/ci/workflows/dryrun-tasks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,22 @@ tasks:
docker exec {{ .vars.clusterName }}-control-plane-1 kubeadm init --ignore-preflight-errors={{ .vars.kubeadmIgnorePreflightErrors }} --kubernetes-version={{ .vars.kubernetesVersion }} --dry-run=true --v={{ .vars.kubeadmVerbosity }} || exit 1
docker exec {{ .vars.clusterName }}-control-plane-1 kubeadm init --ignore-preflight-errors={{ .vars.kubeadmIgnorePreflightErrors }} --kubernetes-version={{ .vars.kubernetesVersion }} --upload-certs=true --dry-run=true --v={{ .vars.kubeadmVerbosity }} || exit 1
timeout: 5m
- name: join-dryrun-without-real-control-plane
description: |
Join the other nodes to the Kubernetes cluster in dryrun mode without a real control plane
cmd: /bin/bash
args:
- -c
- |
required_version="1.32" # join dry-run without real control plane is available since v1.32
current_version=$(echo "{{ .vars.kubernetesVersion }}" | grep -oP '\d+\.\d+')
if awk "BEGIN {exit !($current_version < $required_version)}"; then
echo "Join dry-run without real control plane is not available for Kubernetes version {{ .vars.kubernetesVersion }}. Skipping."
exit 0
fi
docker exec {{ .vars.clusterName }}-worker-1 bash -c "until crictl ps &> /dev/null; do echo 'Waiting for the container runtime to be running ...'; sleep 1; done"
docker exec {{ .vars.clusterName }}-worker-1 kubeadm join 192.168.0.101:6443 --token abcdef.abcdef0123456789 --discovery-token-ca-cert-hash sha256:3b793efefe27a19f93b0fbe6e637e9c41d0dde8a377d6ab1c0f656bf1136dd8a --ignore-preflight-errors={{ .vars.kubeadmIgnorePreflightErrors }} --dry-run=true --v={{ .vars.kubeadmVerbosity }} || exit 1
timeout: 5m
- name: init
description: |
Initializes the Kubernetes cluster with version "initVersion"
Expand All @@ -73,9 +89,9 @@ tasks:
- --loglevel=debug
- --kubeadm-verbosity={{ .vars.kubeadmVerbosity }}
timeout: 5m
- name: join-dryrun
- name: join-dryrun-against-real-control-plane
description: |
Join the other nodes to the Kubernetes cluster in dryrun mode
Join the other nodes to the Kubernetes cluster in dryrun mode against the real control plane
cmd: /bin/bash
args:
- -c
Expand Down

0 comments on commit 8994f1a

Please sign in to comment.