Skip to content

Commit

Permalink
Handle zones that are being deleted (#663)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
zyiyi11 authored Aug 22, 2024
1 parent 40a809b commit a5f64e4
Show file tree
Hide file tree
Showing 6 changed files with 280 additions and 184 deletions.
4 changes: 4 additions & 0 deletions pkg/providers/vsphere/placement/zone_placement.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,10 @@ func getPlacementCandidates(
zones = append(zones, zone)
}
for _, zone := range zones {
// Filter out the zone that is to be deleted, so we don't have it as a candidate when doing placement.
if zonePlacement && !zone.DeletionTimestamp.IsZero() {
continue
}
rpMoIDs := zone.Spec.ManagedVMs.PoolMoIDs
if childRPName != "" {
childRPMoIDs := lookupChildRPs(vmCtx, vcClient, rpMoIDs, zone.Name, childRPName)
Expand Down
Loading

0 comments on commit a5f64e4

Please sign in to comment.