Refactor kubeconfig setup to use a temporary file and remove unnecessary directory creation

This commit is contained in:
2025-10-02 15:55:39 +08:00
parent 4b372f8208
commit fd9a266de0

View File

@@ -63,13 +63,10 @@ setup_kubeconfig() {
echo "Warning: KUBECONFIG_DATA not provided, using existing kubectl config"
return 0
fi
# Create .kube directory if it doesn't exist
mkdir -p $HOME/.kube
# Create temporary kubeconfig file from base64 encoded data
echo "Decoding kubeconfig..."
echo "$KUBECONFIG_DATA" | base64 -d > $HOME/.kube/config
echo "$KUBECONFIG_DATA" | base64 -d > /tmp/kubeconfig
# Set KUBECONFIG environment variable to use the temporary file
export KUBECONFIG=/tmp/kubeconfig