Skip to content

Commit

Permalink
fix kubeconfig and ns
Browse files Browse the repository at this point in the history
  • Loading branch information
robertchoi80 committed Mar 6, 2022
1 parent 0f6c0af commit dab69f8
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tks-cluster/remove-usercluster-wftpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ spec:
arguments:
parameters:
- name: target_namespace
value: "{{workflow.parameters.cluster_id}}"
value: "kube-system"

- - name: deleteAddonsApp
templateRef:
Expand Down Expand Up @@ -128,9 +128,15 @@ spec:
- /bin/bash
- '-c'
- |
kubectl get deployment -n ${TARGET_NAMESPACE} | grep calico-kube-controller
kube_secret=$(kubectl get secret -n {{workflow.parameters.cluster_id}} {{workflow.parameters.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"
kubectl $kube_params get deployment -n ${TARGET_NAMESPACE} | grep calico-kube-controller
if [[ $? =~ 0 ]]; then
kubectl delete deployment calico-kube-controllers -n ${TARGET_NAMESPACE}
kubectl $kube_params delete deployment calico-kube-controllers -n ${TARGET_NAMESPACE}
else
echo "Error: deployment 'calico-kube-controllers' was NOT found."
Expand Down

0 comments on commit dab69f8

Please sign in to comment.