From dad47a86ca6adf434ef16fec01cfae29168f602a Mon Sep 17 00:00:00 2001 From: Jugwan Eom Date: Mon, 4 Apr 2022 07:11:18 +0000 Subject: [PATCH 1/2] create-usercluster: use default namespace explictly --- tks-cluster/create-usercluster-wftpl.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tks-cluster/create-usercluster-wftpl.yaml b/tks-cluster/create-usercluster-wftpl.yaml index c8f980af..08681a2e 100644 --- a/tks-cluster/create-usercluster-wftpl.yaml +++ b/tks-cluster/create-usercluster-wftpl.yaml @@ -188,7 +188,7 @@ spec: - | cp /kube/value kubeconfig - CLUSTER=$(kubectl --kubeconfig kubeconfig get cl -ojsonpath='{.items[0].metadata.name}') + CLUSTER=$(kubectl --kubeconfig kubeconfig get cl -ojsonpath='{.items[0].metadata.name}' -n default) ADMIN_USER=${CLUSTER}-admin TOKEN=$(kubectl --kubeconfig kubeconfig get secrets -n {{workflow.parameters.cluster_id}} "$(kubectl --kubeconfig kubeconfig get sa cluster-autoscaler -n {{workflow.parameters.cluster_id}} -o=jsonpath={.secrets[0].name})" -o=jsonpath={.data.token} | base64 -d) kubectl --kubeconfig kubeconfig config set-credentials cluster-autoscaler --token=$TOKEN From 940225cb4feee9aec6724ebdc15ee3c41a49468f Mon Sep 17 00:00:00 2001 From: Jugwan Eom Date: Mon, 4 Apr 2022 07:12:19 +0000 Subject: [PATCH 2/2] create-usercluster: make exit when error occurs --- tks-cluster/create-usercluster-wftpl.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tks-cluster/create-usercluster-wftpl.yaml b/tks-cluster/create-usercluster-wftpl.yaml index 08681a2e..2b5f9913 100644 --- a/tks-cluster/create-usercluster-wftpl.yaml +++ b/tks-cluster/create-usercluster-wftpl.yaml @@ -184,7 +184,7 @@ spec: image: 'portainer/kubectl-shell:latest-v1.21.1-amd64' command: - /bin/bash - - '-cx' + - '-exc' - | cp /kube/value kubeconfig @@ -212,7 +212,7 @@ spec: image: 'portainer/kubectl-shell:latest-v1.21.1-amd64' command: - /bin/bash - - '-cx' + - '-exc' - | KUBECONFIG=$(kubectl get secret -n {{workflow.parameters.cluster_id}} {{workflow.parameters.cluster_id}}-kubeconfig -o jsonpath="{.data.value}" | base64 -d) echo -e "kubeconfig:\n$KUBECONFIG" | head -n 5