forked from kubernetes-retired/multi-tenancy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow finalizers to be removed when deleting CRDs
See kubernetes-retired#824. When the CRDs are being deleted, we need to continue reconciling the CRs until they're gone in order to ensure that any finalizers on the CRs are removed. Tested: new test script usually fails without this fix, but reliably passes with it. Observed the new log messages working as expected while running the script. For subnamespace anchors, tried removing the CRD-checking code entirely and verified that hack/test-delete-anchor-crd.sh failed, and then replaced it with the current code (the shared isDeletingCRD function) and verified that it passed again.
- Loading branch information
1 parent
efa6555
commit 7a4d3cb
Showing
7 changed files
with
127 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
# see https://github.com/kubernetes-sigs/multi-tenancy/issues/824 | ||
|
||
echo "THIS TEST WILL DELETE CRITICAL PARTS OF HNC. DO NOT RUN UNLESS YOU KNOW WHAT YOU'RE DOING" | ||
echo "You have five seconds to turn back!" | ||
sleep 5 | ||
|
||
|
||
echo "-------------------------------------------------------" | ||
echo "Cleaning up from the last run. This may cause errors" | ||
|
||
p=delete-hc-anchor-crd-parent | ||
c=delete-hc-anchor-crd-child | ||
|
||
kubectl hns set -a $p | ||
sleep 1 | ||
kubectl delete ns $p | ||
|
||
# Fail on any error from here on in. | ||
set -e | ||
|
||
echo "-------------------------------------------------------" | ||
echo "Creating parent and child" | ||
|
||
p=delete-hc-anchor-crd-parent | ||
c=delete-hc-anchor-crd-child | ||
|
||
kubectl create ns $p | ||
kubectl hns create $c -n $p | ||
|
||
echo "-------------------------------------------------------" | ||
echo "Delete the HC CRD, then wait 1s, then delete the anchor CRD. HNC IS NOW IN A BAD STATE AND MUST BE REINSTALLED" | ||
|
||
kubectl delete crd hierarchyconfigurations.hnc.x-k8s.io & | ||
sleep 1 | ||
kubectl delete crd subnamespaceanchors.hnc.x-k8s.io & | ||
kubectl delete crd hncconfigurations.hnc.x-k8s.io & | ||
|
||
echo "-------------------------------------------------------" | ||
echo "Sleeping for 10s to give HNC the chance to fully delete everything (5s wasn't enough)" | ||
|
||
sleep 10 | ||
|
||
echo "-------------------------------------------------------" | ||
echo "Verify that the HNC CRDs are gone (if nothing's printed, then they are)" | ||
|
||
kubectl get crd | grep hnc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters