From b614e6aa9120b3643e3fc15c32457c61fe61528e Mon Sep 17 00:00:00 2001 From: Seungkyu Ahn Date: Thu, 7 Jul 2022 00:18:43 +0900 Subject: [PATCH] reduce cluster_id length --- templates/decapod-apps/service-mesh-wf.yaml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/templates/decapod-apps/service-mesh-wf.yaml b/templates/decapod-apps/service-mesh-wf.yaml index 248e44a..8ea7d07 100644 --- a/templates/decapod-apps/service-mesh-wf.yaml +++ b/templates/decapod-apps/service-mesh-wf.yaml @@ -193,9 +193,11 @@ spec: echo "[$date] $level $msg" } + CLUSTER_ID={{workflow.parameters.cluster_id}} kube_params="" - if [[ -n "{{workflow.parameters.cluster_id}}" ]]; then - kube_secret=$(kubectl get secret -n {{workflow.parameters.cluster_id}} {{workflow.parameters.cluster_id}}-kubeconfig -o jsonpath="{.data.value}" | base64 -d) + if [[ -n "${CLUSTER_ID}" ]]; then + CLUSTER_ID=$(echo "${CLUSTER_ID:0:8}") + kube_secret=$(kubectl get secret -n ${CLUSTER_ID} ${CLUSTER_ID}-kubeconfig -o jsonpath="{.data.value}" | base64 -d) echo -e "kube_secret:\n$kube_secret" | head -n 5 cat <<< "$kube_secret" > /etc/kubeconfig kube_params+="--kubeconfig=/etc/kubeconfig" @@ -252,9 +254,11 @@ spec: echo "[$date] $level $msg" } + CLUSTER_ID={{workflow.parameters.cluster_id}} kube_params="" - if [[ -n "{{workflow.parameters.cluster_id}}" ]]; then - kube_secret=$(kubectl get secret -n {{workflow.parameters.cluster_id}} {{workflow.parameters.cluster_id}}-kubeconfig -o jsonpath="{.data.value}" | base64 -d) + if [[ -n "${CLUSTER_ID}" ]]; then + CLUSTER_ID=$(echo "${CLUSTER_ID:0:8}") + kube_secret=$(kubectl get secret -n ${CLUSTER_ID} ${CLUSTER_ID}-kubeconfig -o jsonpath="{.data.value}" | base64 -d) echo -e "kube_secret:\n$kube_secret" | head -n 5 cat <<< "$kube_secret" > /etc/kubeconfig kube_params+="--kubeconfig=/etc/kubeconfig"