mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-14 14:23:37 +00:00
Delete the federation namespace from fcp instead of individual objects
This commit is contained in:
parent
1a3a0713b2
commit
320548fdc4
@ -74,17 +74,16 @@ function cleanup-federation-api-objects {
|
|||||||
set +o errexit
|
set +o errexit
|
||||||
|
|
||||||
echo "Cleaning Federation control plane objects"
|
echo "Cleaning Federation control plane objects"
|
||||||
# Delete all resources with the federated-cluster label.
|
kube::log::status "Removing namespace \"${FEDERATION_NAMESPACE}\" from \"${FEDERATION_KUBE_CONTEXT}\""
|
||||||
$host_kubectl delete pods,svc,rc,deployment,secret -lapp=federated-cluster
|
# Try deleting until the namespace is completely gone.
|
||||||
|
while $host_kubectl --context="${FEDERATION_KUBE_CONTEXT}" delete namespace "${FEDERATION_NAMESPACE}" >/dev/null 2>&1; do
|
||||||
# Delete all PVs bound to PVCs in FEDERATION_NAMESPACE
|
# It is usually slower to remove a namespace because it involves
|
||||||
pvs=$($host_kubectl get pvc --namespace=${FEDERATION_NAMESPACE} -o jsonpath='{.items[*].spec.volumeName}')
|
# performing a cascading deletion of all the resources in the
|
||||||
while $host_kubectl delete pv ${pvs} >/dev/null 2>&1; do
|
# namespace. So we sleep a little longer than other resources
|
||||||
sleep 2
|
# before retrying
|
||||||
|
sleep 5
|
||||||
done
|
done
|
||||||
|
kube::log::status "Removed namespace \"${FEDERATION_NAMESPACE}\" from \"${FEDERATION_KUBE_CONTEXT}\""
|
||||||
# Delete all resources in FEDERATION_NAMESPACE.
|
|
||||||
$host_kubectl delete pvc,pods,svc,rc,deployment,secret --namespace=${FEDERATION_NAMESPACE} --all
|
|
||||||
|
|
||||||
# This is a big hammer. We get rid of federation-system namespace from
|
# This is a big hammer. We get rid of federation-system namespace from
|
||||||
# all the clusters
|
# all the clusters
|
||||||
|
Loading…
Reference in New Issue
Block a user