Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌱 Handle zones that are being deleted under WCP_Workload_Domain_Isolation #663

Merged
merged 1 commit into from
Aug 22, 2024

Conversation

zyiyi11
Copy link
Contributor

@zyiyi11 zyiyi11 commented Aug 9, 2024

What does this PR do, and why is it needed?
This patch handles Zones that are being deleted. We don't want to allow new VMs to be created in zones that are being deleted.

  • If VM deployment specifies a zone that is being deleted by SSO user, validation webhook will reject the creation.
  • If VM deployment specifies a zone that is being deleted by admin, validation webhook will allow the creation.
  • If VM deployment specifies a valid zone at create time, zone got deletionTimestamp later, still place it in the zone.
  • For placement, filter out the to be deleted zones so we don't have it as a candidate.

Which issue(s) is/are addressed by this PR? (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):

Fixes # N/A

Are there any special notes for your reviewer:
Testing done:

  1. Bind 2 workload zones to supervisor, zone-2 and zone-3.
  2. Deploy VM with specified zone name places VM on expected zones.
  3. Deploy 5 VMs with unspecified zone name, 4 landed on zone-2 and 1 landed on zone-3
  4. After zone-2 deletion initiated
  • Made sure zone-2 has deletionTimestamp but not deleted yet with workloads still on.
  • VM deployment with specified topology.kubernetes.io/zone: zone-2 is rejected.
Error from server (metadata.labels[topology.kubernetes.io/zone]: Invalid value: "zone-2": cannot use zone that is being deleted): error when creating "vm1.yaml": admission webhook "default.validating.virtualmachine.v1alpha3.vmoperator.vmware.com" denied the request: metadata.labels[topology.kubernetes.io/zone]: Invalid value: "zone-2": cannot use zone that is being deleted
  • Deploy 5 VMs with unspecified zone name, all allocated to the remaining zone-3 as expected.

Please add a release note if necessary:

Zone Placement will ignore Zones that are being deleted under WCP_Workload_Domain_Isolation

@github-actions github-actions bot added the size/L Denotes a PR that changes 100-499 lines. label Aug 9, 2024
@zyiyi11 zyiyi11 force-pushed the topic/zyiyi/handle-deleted-zone branch from 7684d5f to e303080 Compare August 13, 2024 20:06
@github-actions github-actions bot added size/M Denotes a PR that changes 30-99 lines. and removed size/L Denotes a PR that changes 100-499 lines. labels Aug 13, 2024
@zyiyi11 zyiyi11 force-pushed the topic/zyiyi/handle-deleted-zone branch 3 times, most recently from 6e68ca3 to 0d4f9e8 Compare August 19, 2024 18:52
@zyiyi11 zyiyi11 force-pushed the topic/zyiyi/handle-deleted-zone branch 2 times, most recently from 1a24190 to 371f863 Compare August 19, 2024 23:15
@zyiyi11 zyiyi11 force-pushed the topic/zyiyi/handle-deleted-zone branch from 371f863 to 2c91617 Compare August 21, 2024 18:44
@github-actions github-actions bot added size/L Denotes a PR that changes 100-499 lines. and removed size/M Denotes a PR that changes 30-99 lines. labels Aug 21, 2024
Copy link

Code Coverage

Package Line Rate Health
github.com/vmware-tanzu/vm-operator/controllers/contentlibrary/clustercontentlibraryitem 81%
github.com/vmware-tanzu/vm-operator/controllers/contentlibrary/contentlibraryitem 85%
github.com/vmware-tanzu/vm-operator/controllers/contentlibrary/utils 97%
github.com/vmware-tanzu/vm-operator/controllers/infra/capability 86%
github.com/vmware-tanzu/vm-operator/controllers/infra/configmap 71%
github.com/vmware-tanzu/vm-operator/controllers/infra/node 77%
github.com/vmware-tanzu/vm-operator/controllers/infra/secret 77%
github.com/vmware-tanzu/vm-operator/controllers/storagepolicyquota 97%
github.com/vmware-tanzu/vm-operator/controllers/util/encoding 73%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachine/storagepolicyusage 99%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachine/virtualmachine 87%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachine/volume 86%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachineclass 75%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachinepublishrequest 81%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachinereplicaset 68%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachineservice 83%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachineservice/providers 92%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachinesetresourcepolicy 80%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachinewebconsolerequest/v1alpha1 72%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachinewebconsolerequest/v1alpha1/conditions 88%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachinewebconsolerequest/v1alpha1/patch 78%
github.com/vmware-tanzu/vm-operator/controllers/virtualmachinewebconsolerequest/v1alpha2 73%
github.com/vmware-tanzu/vm-operator/pkg/builder 95%
github.com/vmware-tanzu/vm-operator/pkg/conditions 88%
github.com/vmware-tanzu/vm-operator/pkg/config 100%
github.com/vmware-tanzu/vm-operator/pkg/config/env 100%
github.com/vmware-tanzu/vm-operator/pkg/context/operation 100%
github.com/vmware-tanzu/vm-operator/pkg/patch 78%
github.com/vmware-tanzu/vm-operator/pkg/prober 91%
github.com/vmware-tanzu/vm-operator/pkg/prober/probe 90%
github.com/vmware-tanzu/vm-operator/pkg/prober/worker 77%
github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere 75%
github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/client 80%
github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/clustermodules 71%
github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/config 72%
github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/contentlibrary 74%
github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/credentials 100%
github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/network 80%
github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/placement 77%
github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/session 73%
github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/sysprep 100%
github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/vcenter 82%
github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/virtualmachine 77%
github.com/vmware-tanzu/vm-operator/pkg/providers/vsphere/vmlifecycle 67%
github.com/vmware-tanzu/vm-operator/pkg/record 78%
github.com/vmware-tanzu/vm-operator/pkg/topology 91%
github.com/vmware-tanzu/vm-operator/pkg/util 87%
github.com/vmware-tanzu/vm-operator/pkg/util/annotations 0%
github.com/vmware-tanzu/vm-operator/pkg/util/cloudinit 89%
github.com/vmware-tanzu/vm-operator/pkg/util/cloudinit/validate 91%
github.com/vmware-tanzu/vm-operator/pkg/util/image 100%
github.com/vmware-tanzu/vm-operator/pkg/util/kube 80%
github.com/vmware-tanzu/vm-operator/pkg/util/kube/cource 100%
github.com/vmware-tanzu/vm-operator/pkg/util/kube/spq 100%
github.com/vmware-tanzu/vm-operator/pkg/util/ptr 100%
github.com/vmware-tanzu/vm-operator/pkg/util/resize 97%
github.com/vmware-tanzu/vm-operator/pkg/util/vmopv1 91%
github.com/vmware-tanzu/vm-operator/pkg/util/vsphere/client 68%
github.com/vmware-tanzu/vm-operator/pkg/util/vsphere/vm 86%
github.com/vmware-tanzu/vm-operator/pkg/webconsolevalidation 100%
github.com/vmware-tanzu/vm-operator/webhooks/common 100%
github.com/vmware-tanzu/vm-operator/webhooks/persistentvolumeclaim/validation 95%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachine/mutation 87%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachine/validation 95%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachineclass/mutation 62%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachineclass/validation 89%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachinepublishrequest/validation 92%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachinereplicaset/validation 90%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachineservice/mutation 67%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachineservice/validation 92%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachinesetresourcepolicy/validation 89%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachinewebconsolerequest/v1alpha1/validation 92%
github.com/vmware-tanzu/vm-operator/webhooks/virtualmachinewebconsolerequest/v1alpha2/validation 92%
Summary 82% (9182 / 11170)

Minimum allowed line rate is 79%

@zyiyi11 zyiyi11 merged commit a5f64e4 into vmware-tanzu:main Aug 22, 2024
11 checks passed
zyiyi11 added a commit to zyiyi11/vm-operator that referenced this pull request Aug 22, 2024
This patch handles Zones that are being deleted. We don't want to allow new VMs to be created in zones that are being deleted.
- If VM deployment specifies a zone that is being deleted by SSO user, validation webhook will reject the creation.
- If VM deployment specifies a zone that is being deleted by admin, validation webhook will allow the creation.
- If VM deployment specifies a valid zone at create time, zone got deletionTimestamp later, still place it in the zone.
- For placement, filter out the to be deleted zones so we don't have it as a candidate.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-not-required size/L Denotes a PR that changes 100-499 lines.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants