mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-12 20:57:20 +00:00
Merge pull request #27332 from nikhiljindal/awsSecrets
Automatic merge from submit-queue federation: Creating kubeconfig files to be used for creating secrets for clusters on aws and gke Extension of https://github.com/kubernetes/kubernetes/pull/26914 which created the kubeconfig files for gce clusters. This PR extends it to AWS, vagrant and GKE. The change for AWS and vagrant is exactly same as GCE. For GKE, since `gcloud create clusters` creates kubeconfig, we are just copying the generated kubeconfig to the desired location cc @kubernetes/sig-cluster-federation @colhom @roberthbailey for GKE
This commit is contained in:
@@ -152,6 +152,19 @@ function clear-kubeconfig() {
|
||||
echo "Cleared config for ${CONTEXT} from ${KUBECONFIG}"
|
||||
}
|
||||
|
||||
# Creates a kubeconfig file with the credentials for only the current-context
|
||||
# cluster. This is used by federation to create secrets in test setup.
|
||||
function create-kubeconfig-for-federation() {
|
||||
if [[ "${FEDERATION:-}" == "true" ]]; then
|
||||
echo "creating kubeconfig for federation secret"
|
||||
local kubectl="${KUBE_ROOT}/cluster/kubectl.sh"
|
||||
local cc=$("${kubectl}" config view -o jsonpath='{.current-context}')
|
||||
KUBECONFIG_DIR=$(dirname ${KUBECONFIG:-$DEFAULT_KUBECONFIG})
|
||||
KUBECONFIG_PATH="${KUBECONFIG_DIR}/federation/kubernetes-apiserver/${cc}"
|
||||
mkdir -p "${KUBECONFIG_PATH}"
|
||||
"${kubectl}" config view --minify --flatten > "${KUBECONFIG_PATH}/kubeconfig"
|
||||
fi
|
||||
}
|
||||
|
||||
function tear_down_alive_resources() {
|
||||
local kubectl="${KUBE_ROOT}/cluster/kubectl.sh"
|
||||
|
Reference in New Issue
Block a user