[x-port] [9.1] 🐛 Use controller owner refs to identify CnsRegisterVolumes owned by a VM - #1905
Open
aruneshpa wants to merge 1 commit into
Conversation
…umes owned by a VM (vmware-tanzu#1806) Currently, we use "created-by" label on the CRV resource to identify the resources that was created to register the classic disks of a VM as PVC -- what we call unmanaged disk registration. This has a flaw. Because Kubernetes restricts the length of the value of the label to 63 whereas the object names can be up to 254 characters long. This means, classic disks of any VM that has name exceeding 63 characters can never complete registration thereby blocking a lot of day-2 workflows on the disk (e.g., expanding the disk). This change fixes this bug by changing the lookup to use ownerRef on the CRV that is set by the controller. Since the CRV can't be edited by the developer user, it's safe to assume that no one can remove the OwnerRef from the CRV. While here, also fix a bug where we would silently adopt an existing CRV by name if one existed (from a prior VM). We now delete those and re-create new ones for the current VM. This will have a consequence of the FCD being deleted if the CRV mapped a disk, but I would argue that explicitly deleting and re-creating it is the correct contract here.
Contributor
Minimum allowed line rate is |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do, and why is it needed?
This is an x-port of #1806 from main branch to the release branch.
Currently, we use "created-by" label on the CRV resource to identify the resources that was created to register the classic disks of a VM as PVC -- what we call unmanaged disk registration.
This has a flaw. Because Kubernetes restricts the length of the value of the label to 63 whereas the object names can be up to 254 characters long. This means, classic disks of any VM that has name exceeding 63 characters can never complete registration thereby blocking a lot of day-2 workflows on the disk (e.g., expanding the disk).
This change fixes this bug by changing the lookup to use ownerRef on the CRV that is set by the controller. Since the CRV can't be edited by the developer user, it's safe to assume that no one can remove the OwnerRef from the CRV.
While here, also fix a bug where we would silently adopt an existing CRV by name if one existed (from a prior VM). We now delete those and re-create new ones for the current VM. This will have a consequence of the FCD being deleted if the CRV mapped a disk, but I would argue that explicitly deleting and re-creating it is the correct contract here.
Please add a release note if necessary: