Skip to content

Commit

Permalink
Create ~/.kube as a directory before locking it.
Browse files Browse the repository at this point in the history
If the directory doesn't already exist, flock will create it as a file,
which breaks everything else.
  • Loading branch information
Arnavion committed Apr 16, 2024
1 parent 3920325 commit 8376ced
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ case "$2" in
rm -f "/tmp/kubeconfig-v$K8S_VERSION"
fi

mkdir -p ~/.kube
flock -x ~/.kube -c "'kind-$KIND_VERSION' export kubeconfig --name '$K8S_CLUSTER_NAME'"
;;

Expand All @@ -183,6 +184,7 @@ case "$2" in

docker image rm -f "kindest/node:v$K8S_VERSION"

mkdir -p ~/.kube
flock -x ~/.kube -c "kubectl config delete-context 'kind-$K8S_CLUSTER_NAME'" || :
flock -x ~/.kube -c "kubectl config delete-cluster 'kind-$K8S_CLUSTER_NAME'" || :
flock -x ~/.kube -c "kubectl config unset 'users.kind-$K8S_CLUSTER_NAME'" || :
Expand Down

0 comments on commit 8376ced

Please sign in to comment.