kubernetes-sigs / hierarchical-namespaces

Home of the Hierarchical Namespace Controller (HNC). Adds hierarchical policies and delegated creation to Kubernetes namespaces for improved in-cluster multitenancy.
Apache License 2.0
619 stars 105 forks source link

Fix Quickstart Document about allowCascadingDeletion #302

Closed mochizuki875 closed 1 year ago

mochizuki875 commented 1 year ago

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 to subnamespaceanchors/service-4 so it will sucess.

https://github.com/kubernetes-sigs/hierarchical-namespaces/blob/564b4a968ca2091f27cf0eb51d0cd99190e57db5/test/e2e/quickstart_test.go#L280-L287

mochizuki875 commented 1 year ago

/assign @adrianludwin

adrianludwin commented 1 year ago

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:

mochizuki875 commented 1 year ago

@adrianludwin Hi, thanks for your feedback! I've fixed it and related explanation about subnamespace. How about that?

rjbez17 commented 1 year ago

/lgtm

rjbez17 commented 1 year ago

/approve

k8s-ci-robot commented 1 year ago

[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

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/kubernetes-sigs/hierarchical-namespaces/blob/master/OWNERS)~~ [rjbez17] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment