Skip to content

Commit b4c10e3

Browse files
authored
Merge pull request #38 from sthaha/fix-kind-script
fix: kind pre-install and cleanup
2 parents 9cec9e2 + 5bebff7 commit b4c10e3

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

providers/kind/kind.sh

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,9 @@ declare -r KIND_CONFIG_YAML="$KIND_DIR/kind.yml"
3636
declare -r KIND_REGISTRY_YAML="$KIND_DIR/local-registry.yml"
3737
declare -r KIND_KUBECONFIG="$KIND_DIR/kubeconfig"
3838

39-
preinstall_check() {
40-
run command -v kind || run command -v kubectl || \
41-
{
42-
info "See details here: https://github.com/sustainable-computing-io/local-dev-cluster/blob/main/README.md#prerequisites" && \
39+
kind_preinstall_check() {
40+
command -v kind || command -v kubectl || {
41+
info "See details here: https://github.com/sustainable-computing-io/local-dev-cluster/blob/main/README.md#prerequisites"
4342
die "Please make sure kind and kubectl have been installed before test"
4443
}
4544
}
@@ -127,7 +126,7 @@ kind_up() {
127126
info "Starting KIND cluster $KIND_CLUSTER_NAME"
128127
mkdir -p "$KIND_DIR"
129128

130-
preinstall_check
129+
kind_preinstall_check
131130
_prepare_config
132131
_setup_kind
133132
wait_for_cluster_ready
@@ -146,8 +145,13 @@ kind_down() {
146145
run kind delete cluster --name="${KIND_CLUSTER_NAME}" || true
147146

148147
run $CTR_CMD rm -v -f "${KIND_REGISTRY_NAME}"
149-
rm -f "$KIND_CONFIG_YAML" "$KIND_REGISTRY_YAML"
150-
find "${KIND_DIR}" -maxdepth 1 -name '.*' -delete
148+
149+
info "Removing all generated files"
150+
run rm -f \
151+
"$KIND_CONFIG_YAML" \
152+
"$KIND_REGISTRY_YAML" \
153+
"$KIND_KUBECONFIG"
154+
151155
ok "kind cluster deleted successfully"
152156
}
153157

0 commit comments

Comments
 (0)