Skip to content

Commit

Permalink
Merge pull request #376 from openinfradev/release
Browse files Browse the repository at this point in the history
240604 release to develop ( back merge )
  • Loading branch information
ktkfree authored Jun 4, 2024
2 parents 7c24ae8 + 699f13b commit 0e9c500
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions tks-cluster/remove-usercluster-wftpl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,13 @@ spec:
- name: app_name
value: "{{workflow.parameters.app_prefix}}-argo-rollouts"

- - name: deletePolicyCR
template: deletePolicyCR
arguments:
parameters:
- name: target_namespace
value: "{{workflow.parameters.cluster_id}}"

- - name: deletePolicyResourcesApp
templateRef:
name: delete-apps
Expand Down Expand Up @@ -386,3 +393,45 @@ 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
- '-c'
- |
cp /kube/value kubeconfig_adm
export KUBECONFIG=kubeconfig_adm
POLICIES=$(kubectl get tkspolicy -n ${TARGET_NAMESPACE} --ignore-not-found=true | grep -v NAME)
if [ -n "$POLICIES" ]; then
kubectl get tkspolicy -n ${TARGET_NAMESPACE} -o name | sed -e 's/.*\///g' | xargs -I {} kubectl delete tkspolicy {} -n ${TARGET_NAMESPACE} --wait=false
sleep 10
REMAINS=$(kubectl get tkspolicy -n ${TARGET_NAMESPACE} --ignore-not-found=true | grep -v NAME)
if [ -n "$REMAINS" ]; then
kubectl get tkspolicy -n ${TARGET_NAMESPACE} -o name | sed -e 's/.*\///g' | xargs -I {} kubectl get tkspolicy {} -n ${TARGET_NAMESPACE} -ojson | jq '.metadata.finalizers = null' | kubectl apply -f -
fi
fi
POLICY_TEMPLATES=$(kubectl get tkspolicytemplates -n ${TARGET_NAMESPACE} --ignore-not-found=true | grep -v NAME)
if [ -n "$POLICY_TEMPLATES" ]; then
kubectl get tkspolicytemplates -n ${TARGET_NAMESPACE} -o name | sed -e 's/.*\///g' | xargs -I {} kubectl delete tkspolicytemplates {} -n ${TARGET_NAMESPACE} --wait=false
sleep 10
REMAINS=$(kubectl get tkspolicytemplates -n ${TARGET_NAMESPACE} --ignore-not-found=true | grep -v NAME)
if [ -n "$REMAINS" ]; then
kubectl get tkspolicytemplates -n ${TARGET_NAMESPACE} -o name | sed -e 's/.*\///g' | xargs -I {} kubectl get tkspolicytemplates {} -n ${TARGET_NAMESPACE} -ojson | jq '.metadata.finalizers = null' | kubectl apply -f -
fi
fi
env:
- name: TARGET_NAMESPACE
value: "{{inputs.parameters.target_namespace}}"
volumeMounts:
- name: kubeconfig-adm
mountPath: "/kube"

0 comments on commit 0e9c500

Please sign in to comment.