@@ -54,20 +54,21 @@ periodics:
5454
5555 # Additional features are not in kind.yaml, but they can be added at the end.
5656 for feature in ${features[@]}; do echo " ${feature}: true"; done
57-
58- # Append ClusterConfiguration which causes etcd to use /tmp
59- # (https://github.com/kubernetes-sigs/kind/issues/845#issuecomment-1261248420).
60- # There's no kubeadmConfigPatches in any kind.yaml, so we can append at the end.
61- cat <<EOF
62- kubeadmConfigPatches:
63- - |
64- kind: ClusterConfiguration
65- etcd:
66- local:
67- dataDir: /tmp/etcd
68- EOF
6957 ) >/tmp/kind.yaml
58+
59+ # Add or extend kubeadmConfigPatches with a ClusterConfiguration which causes etcd to use /tmp
60+ # (https://github.com/kubernetes-sigs/kind/issues/845#issuecomment-1261248420).
61+ # kind.yaml may or may not have a `kubeadmConfigPatches`, so we have to be
62+ # careful.
63+ if ! grep -q '^kubeadmConfigPatches:$' /tmp/kind.yaml; then
64+ echo "kubeadmConfigPatches:" >>/tmp/kind.yaml
65+ fi
66+ sed -i -e '/^kubeadmConfigPatches:$/a\' -e ' - |\n kind: ClusterConfiguration\n etcd:\n local:\n dataDir: /tmp/etcd\n' /tmp/kind.yaml
67+
68+ mkdir -p "${ARTIFACTS}/kind"
69+ cp /tmp/kind.yaml "${ARTIFACTS}/kind"
7070 cat /tmp/kind.yaml
71+
7172 kind create cluster --retain --config /tmp/kind.yaml --image dra/node:latest
7273 atexit () {
7374 kind export logs "${ARTIFACTS}/kind"
@@ -140,20 +141,21 @@ periodics:
140141
141142 # Additional features are not in kind.yaml, but they can be added at the end.
142143 for feature in ${features[@]}; do echo " ${feature}: true"; done
143-
144- # Append ClusterConfiguration which causes etcd to use /tmp
145- # (https://github.com/kubernetes-sigs/kind/issues/845#issuecomment-1261248420).
146- # There's no kubeadmConfigPatches in any kind.yaml, so we can append at the end.
147- cat <<EOF
148- kubeadmConfigPatches:
149- - |
150- kind: ClusterConfiguration
151- etcd:
152- local:
153- dataDir: /tmp/etcd
154- EOF
155144 ) >/tmp/kind.yaml
145+
146+ # Add or extend kubeadmConfigPatches with a ClusterConfiguration which causes etcd to use /tmp
147+ # (https://github.com/kubernetes-sigs/kind/issues/845#issuecomment-1261248420).
148+ # kind.yaml may or may not have a `kubeadmConfigPatches`, so we have to be
149+ # careful.
150+ if ! grep -q '^kubeadmConfigPatches:$' /tmp/kind.yaml; then
151+ echo "kubeadmConfigPatches:" >>/tmp/kind.yaml
152+ fi
153+ sed -i -e '/^kubeadmConfigPatches:$/a\' -e ' - |\n kind: ClusterConfiguration\n etcd:\n local:\n dataDir: /tmp/etcd\n' /tmp/kind.yaml
154+
155+ mkdir -p "${ARTIFACTS}/kind"
156+ cp /tmp/kind.yaml "${ARTIFACTS}/kind"
156157 cat /tmp/kind.yaml
158+
157159 kind create cluster --retain --config /tmp/kind.yaml --image dra/node:latest
158160 atexit () {
159161 kind export logs "${ARTIFACTS}/kind"
@@ -227,20 +229,21 @@ periodics:
227229
228230 # Additional features are not in kind.yaml, but they can be added at the end.
229231 for feature in ${features[@]}; do echo " ${feature}: true"; done
230-
231- # Append ClusterConfiguration which causes etcd to use /tmp
232- # (https://github.com/kubernetes-sigs/kind/issues/845#issuecomment-1261248420).
233- # There's no kubeadmConfigPatches in any kind.yaml, so we can append at the end.
234- cat <<EOF
235- kubeadmConfigPatches:
236- - |
237- kind: ClusterConfiguration
238- etcd:
239- local:
240- dataDir: /tmp/etcd
241- EOF
242232 ) >/tmp/kind.yaml
233+
234+ # Add or extend kubeadmConfigPatches with a ClusterConfiguration which causes etcd to use /tmp
235+ # (https://github.com/kubernetes-sigs/kind/issues/845#issuecomment-1261248420).
236+ # kind.yaml may or may not have a `kubeadmConfigPatches`, so we have to be
237+ # careful.
238+ if ! grep -q '^kubeadmConfigPatches:$' /tmp/kind.yaml; then
239+ echo "kubeadmConfigPatches:" >>/tmp/kind.yaml
240+ fi
241+ sed -i -e '/^kubeadmConfigPatches:$/a\' -e ' - |\n kind: ClusterConfiguration\n etcd:\n local:\n dataDir: /tmp/etcd\n' /tmp/kind.yaml
242+
243+ mkdir -p "${ARTIFACTS}/kind"
244+ cp /tmp/kind.yaml "${ARTIFACTS}/kind"
243245 cat /tmp/kind.yaml
246+
244247 kind create cluster --retain --config /tmp/kind.yaml --image dra/node:latest
245248 atexit () {
246249 kind export logs "${ARTIFACTS}/kind"
@@ -344,20 +347,21 @@ periodics:
344347
345348 # Additional features are not in kind.yaml, but they can be added at the end.
346349 for feature in ${features[@]}; do echo " ${feature}: true"; done
347-
348- # Append ClusterConfiguration which causes etcd to use /tmp
349- # (https://github.com/kubernetes-sigs/kind/issues/845#issuecomment-1261248420).
350- # There's no kubeadmConfigPatches in any kind.yaml, so we can append at the end.
351- cat <<EOF
352- kubeadmConfigPatches:
353- - |
354- kind: ClusterConfiguration
355- etcd:
356- local:
357- dataDir: /tmp/etcd
358- EOF
359350 ) >/tmp/kind.yaml
351+
352+ # Add or extend kubeadmConfigPatches with a ClusterConfiguration which causes etcd to use /tmp
353+ # (https://github.com/kubernetes-sigs/kind/issues/845#issuecomment-1261248420).
354+ # kind.yaml may or may not have a `kubeadmConfigPatches`, so we have to be
355+ # careful.
356+ if ! grep -q '^kubeadmConfigPatches:$' /tmp/kind.yaml; then
357+ echo "kubeadmConfigPatches:" >>/tmp/kind.yaml
358+ fi
359+ sed -i -e '/^kubeadmConfigPatches:$/a\' -e ' - |\n kind: ClusterConfiguration\n etcd:\n local:\n dataDir: /tmp/etcd\n' /tmp/kind.yaml
360+
361+ mkdir -p "${ARTIFACTS}/kind"
362+ cp /tmp/kind.yaml "${ARTIFACTS}/kind"
360363 cat /tmp/kind.yaml
364+
361365 kind create cluster --retain --config /tmp/kind.yaml --image dra/node:latest
362366 atexit () {
363367 kind export logs "${ARTIFACTS}/kind"
@@ -461,20 +465,21 @@ periodics:
461465
462466 # Additional features are not in kind.yaml, but they can be added at the end.
463467 for feature in ${features[@]}; do echo " ${feature}: true"; done
464-
465- # Append ClusterConfiguration which causes etcd to use /tmp
466- # (https://github.com/kubernetes-sigs/kind/issues/845#issuecomment-1261248420).
467- # There's no kubeadmConfigPatches in any kind.yaml, so we can append at the end.
468- cat <<EOF
469- kubeadmConfigPatches:
470- - |
471- kind: ClusterConfiguration
472- etcd:
473- local:
474- dataDir: /tmp/etcd
475- EOF
476468 ) >/tmp/kind.yaml
469+
470+ # Add or extend kubeadmConfigPatches with a ClusterConfiguration which causes etcd to use /tmp
471+ # (https://github.com/kubernetes-sigs/kind/issues/845#issuecomment-1261248420).
472+ # kind.yaml may or may not have a `kubeadmConfigPatches`, so we have to be
473+ # careful.
474+ if ! grep -q '^kubeadmConfigPatches:$' /tmp/kind.yaml; then
475+ echo "kubeadmConfigPatches:" >>/tmp/kind.yaml
476+ fi
477+ sed -i -e '/^kubeadmConfigPatches:$/a\' -e ' - |\n kind: ClusterConfiguration\n etcd:\n local:\n dataDir: /tmp/etcd\n' /tmp/kind.yaml
478+
479+ mkdir -p "${ARTIFACTS}/kind"
480+ cp /tmp/kind.yaml "${ARTIFACTS}/kind"
477481 cat /tmp/kind.yaml
482+
478483 kind create cluster --retain --config /tmp/kind.yaml --image dra/node:latest
479484 atexit () {
480485 kind export logs "${ARTIFACTS}/kind"
0 commit comments