Skip to content
This repository was archived by the owner on Jun 26, 2023. It is now read-only.

Don't delete subns if anchor has conflict #1150

Merged

Conversation

adrianludwin
Copy link
Contributor

See issue #1149. This affects the ability to turn a subnamespace into a
full namespace. If you remove the subnamespaceOf annotation, move the
namespace to a new parent, and then clean up the anchor, everything's
ok. But if you delete the anchor before moving the namespace, the
namespace gets deleted, which is clearly wrong.

This change is the minimal safe change needed to fix this in v0.5. In
v0.6, we should restructure these functions to be more heavily based on
the explicit state of the anchor, not the implied state.

Tested: new e2e test fails (hangs, actually) without this change and
passes with it. All e2e tests pass on GKE 1.17.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 25, 2020
@adrianludwin adrianludwin added this to the hnc-v0.5.3 milestone Sep 25, 2020
@adrianludwin
Copy link
Contributor Author

/assign @yiqigao217
/assign @rjbez17

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Sep 25, 2020
@rjbez17
Copy link

rjbez17 commented Sep 25, 2020

Wouldn't hurt to create issues and link them in the TODOs but otherwise lgtm.

/lgtm
/approve
/hold

feel free to remove hold if you don't plan to link issues.

@k8s-ci-robot k8s-ci-robot added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm Indicates that a PR is ready to be merged. labels Sep 25, 2020
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: adrianludwin, 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 [adrianludwin,rjbez17]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

See issue kubernetes-retired#1149. This affects the ability to turn a subnamespace into a
full namespace. If you remove the subnamespaceOf annotation, move the
namespace to a new parent, and *then* clean up the anchor, everything's
ok. But if you delete the anchor _before_ moving the namespace, the
namespace gets deleted, which is clearly wrong.

This change is the minimal safe change needed to fix this in v0.5. In
v0.6, we should restructure these functions to be more heavily based on
the explicit state of the anchor, not the implied state.

Tested: new e2e test fails (hangs, actually) without this change and
passes with it. All e2e tests pass on GKE 1.17.
@k8s-ci-robot k8s-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Sep 25, 2020
@adrianludwin
Copy link
Contributor Author

The change was just to fix the format of a log message

Copy link
Contributor

@yiqigao217 yiqigao217 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm just 2 small questions.

The other question is that: Will this change in any case (for conflict or missing) prevent a should-delete subns from being deleted?

@adrianludwin
Copy link
Contributor Author

The other question is that: Will this change in any case (for conflict or missing) prevent a should-delete subns from being deleted?

The "conflict" case is a change - that's the bug I'm trying to fix. The "missing" case shouldn't be a change - we've just verified that the namespace is truly missing, so there's nothing to delete.

adrianludwin added a commit to adrianludwin/multi-tenancy that referenced this pull request Sep 25, 2020
This change fixes todos in the cherrypick for kubernetes-retired#1150 (see issue kubernetes-retired#1149).
It simplifies and restructures a lot of the logic to make it easier to
follow while looking at less data (e.g. a lot more focus on
anchor.Status.State).

Tested: all e2e tests pass on GKE 1.17.
@yiqigao217
Copy link
Contributor

The other question is that: Will this change in any case (for conflict or missing) prevent a should-delete subns from being deleted?

The "conflict" case is a change - that's the bug I'm trying to fix. The "missing" case shouldn't be a change - we've just verified that the namespace is truly missing, so there's nothing to delete.

Discussed offline, I was confused with allowing user to delete anchors when it has conflict to resolve issues. This PR is only for deleting sub-"namespace".

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Sep 25, 2020
adrianludwin added a commit to adrianludwin/multi-tenancy that referenced this pull request Sep 25, 2020
This change fixes todos in the cherrypick for kubernetes-retired#1150 (see issue kubernetes-retired#1149).
It simplifies and restructures a lot of the logic to make it easier to
follow while looking at less data (e.g. a lot more focus on
anchor.Status.State).

Tested: all e2e tests pass on GKE 1.17.
@adrianludwin
Copy link
Contributor Author

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Sep 25, 2020
@k8s-ci-robot k8s-ci-robot merged commit 4b8e7a2 into kubernetes-retired:hnc-v0.5 Sep 25, 2020
adrianludwin added a commit to adrianludwin/multi-tenancy that referenced this pull request Sep 30, 2020
This change fixes todos in the cherrypick for kubernetes-retired#1150 (see issue kubernetes-retired#1149).
It simplifies and restructures a lot of the logic to make it easier to
follow while looking at less data (e.g. a lot more focus on
anchor.Status.State). It also adds a lots more documentation.

Tested: all e2e tests pass on GKE 1.18 when combined with fixes to the
e2e tests (PRs kubernetes-retired#1160, kubernetes-retired#1162, kubernetes-retired#1163 and kubernetes-retired#1164).
adrianludwin added a commit to adrianludwin/multi-tenancy that referenced this pull request Sep 30, 2020
This change fixes todos in the cherrypick for kubernetes-retired#1150 (see issue kubernetes-retired#1149).
It simplifies and restructures a lot of the logic to make it easier to
follow while looking at less data (e.g. a lot more focus on
anchor.Status.State). It also adds a lots more documentation.

Tested: all e2e tests pass on GKE 1.18 when combined with fixes to the
e2e tests (PRs kubernetes-retired#1160, kubernetes-retired#1162, kubernetes-retired#1163 and kubernetes-retired#1164).
@adrianludwin adrianludwin deleted the subns-conflict branch October 5, 2020 15:33
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants