diff --git a/tks-cluster/remove-usercluster-wftpl.yaml b/tks-cluster/remove-usercluster-wftpl.yaml index 9944a036..f309c584 100644 --- a/tks-cluster/remove-usercluster-wftpl.yaml +++ b/tks-cluster/remove-usercluster-wftpl.yaml @@ -215,6 +215,13 @@ spec: - name: target_namespace value: "{{workflow.parameters.cluster_id}}" + - - name: deletePolicyCR + template: deletePolicyCR + arguments: + parameters: + - name: target_namespace + value: "{{workflow.parameters.cluster_id}}" + - - name: deleteArgoCDAppGroup templateRef: name: delete-apps @@ -386,3 +393,31 @@ spec: value: "{{inputs.parameters.target_namespace}}" - name: CLUSTER_NAME value: "{{workflow.parameters.cluster_id}}" + + - name: deletePolicyCR + inputs: + parameters: + - name: target_namespace + container: + name: delete-policy-cr + image: harbor.taco-cat.xyz/tks/tks-cluster-init:v1.0.0 + command: + - /bin/bash + - "-exc" + - | + cp /kube/value kubeconfig_adm + export KUBECONFIG=kubeconfig_adm + + kubectl delete tkspolicy -n ${TARGET_NAMESPACE} + kubectl get tkspolicy -n ${TARGET_NAMESPACE} -o json | \ + jq -c '.items[] | .metadata.finalizers = null | {apiVersion, kind, metadata, spec}' | kubectl apply -f + + kubectl delete tkspolicytemplate -n ${TARGET_NAMESPACE} + kubectl get tkspolicytemplate -n ${TARGET_NAMESPACE} -o json | \ + jq -c '.items[] | .metadata.finalizers = null | {apiVersion, kind, metadata, spec}' | kubectl apply -f + env: + - name: TARGET_NAMESPACE + value: "{{inputs.parameters.target_namespace}}" + volumeMounts: + - name: kubeconfig-adm + mountPath: "/kube"