From 9381dfa0f670ba70ca6ae38ef0dab1f74c21c8c2 Mon Sep 17 00:00:00 2001 From: Antonio Costa Date: Thu, 18 Apr 2024 12:28:15 +0200 Subject: [PATCH] fix kubeconfig permission --- kind/kind.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/kind/kind.sh b/kind/kind.sh index 41c54589..6974cf87 100755 --- a/kind/kind.sh +++ b/kind/kind.sh @@ -567,12 +567,12 @@ EOF kind_get_clusters=$(${KIND_COMMAND} get clusters | { grep "${CLUSTER_NAME}" || test $? = 1; }) if [ ! "${kind_get_clusters}" == "" ]; then note "1" "Cluster already exists..." - if [ "$USE_EXISTING_CLUSTER" == "y" ]; then - note "1" "...using existing cluster. Exporting cluster kubeconfig..." - note "5" "CMD: kind export kubeconfig -n ${CLUSTER_NAME}" - ${KIND_COMMAND} export kubeconfig -n ${CLUSTER_NAME} - succeeded "1" "...done!" - else + if [ ! "$USE_EXISTING_CLUSTER" == "y" ]; then + # note "1" "...using existing cluster. Exporting cluster kubeconfig..." + # note "5" "CMD: kind export kubeconfig -n ${CLUSTER_NAME}" + # ${KIND_COMMAND} export kubeconfig -n ${CLUSTER_NAME} + # succeeded "1" "...done!" + # else error "Cluster already exists. Either use the existing cluster (--use-existing-cluster) or delete the cluster (--delete-kind-cluster)." exit 1 fi @@ -619,6 +619,10 @@ EOF note_start_task "2" "Export kubeconfig..." ${KIND_EXPORT_KC_CMD} succeeded "2" "Export kubeconfig..." + if [ ${KUBECONFIG_GEN} == "y" ] && [ "${ROOTLESS_CONTAINERS}" == 'n' ]; then + chown $(whoami):$(whoami) ${KUBECONFIG_TGT} + # chmod 640 ${KUBECONFIG_TGT} + fi set +e note_start_task "2" "Connect the container registry to the kind network..." ${CRI_COMMAND} network connect "kind" ${REGISTRY_NAME}