Closed mochizuki875 closed 1 year ago
/assign @adrianludwin
Thanks for spotting this! I agree that we need to change the code, but I think we also need to change the text as well.
IIRC, the behaviour of HNC changed at some point - we used to only block namespace deletion if the namespace had subnamespaces (i.e. anchors) beneath it, but not if it only had full namespaces as children. At some point, we decided this was bad behaviour, so started blocking deletion of namespaces with any children, even the ones that wouldn't be deleted (as in this case), just to make it easier to understand.
So to make this update, we should:
staging
won't be removed, we still block service-4
from being deleted by default. This is both to be consistent with how subnamespaces are treated, and also because deleting service-4
will delete any propagated objects inside staging
. So you still need to set --allowCascadingDeletion
.service-4
has been deleted, we need to run kubectl get namespace staging
to show that staging
(a full child namespace) wasn't deleted along with its parent service-4
, unlike in the previous example when dev
(a subnamespace) was deleted along with its parent service-1
.@adrianludwin Hi, thanks for your feedback! I've fixed it and related explanation about subnamespace. How about that?
/lgtm
/approve
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: mochizuki875, rjbez17
The full list of commands accepted by this bot can be found here.
The pull request process is described here
What type of PR is this?:
/kind bug /kind documentation
What this PR does / why we need it:
In Subnamespaces deep dive section of Quickstart Document, it will fail to delete
subnamespaceanchors/service-4
because it will not be set cascading deletion explicitly set(--allowCascadingDeletion
). So I've fixed this in this PR.https://github.com/kubernetes-sigs/hierarchical-namespaces/blob/564b4a968ca2091f27cf0eb51d0cd99190e57db5/docs/user-guide/quickstart.md?plain=1#L678-L690
Tested:
Unit and E2E tests has passed. In E2E tests,
--allowCascadingDeletion
has already been set tosubnamespaceanchors/service-4
so it will sucess.https://github.com/kubernetes-sigs/hierarchical-namespaces/blob/564b4a968ca2091f27cf0eb51d0cd99190e57db5/test/e2e/quickstart_test.go#L280-L287