Skip to content

Commit

Permalink
Merge pull request #9494 from openshift-cherrypick-robot/cherry-pick-…
Browse files Browse the repository at this point in the history
…9483-to-release-4.17

[release-4.17] OCPBUGS-50967: PowerVS: destroy dhcp hack
  • Loading branch information
openshift-merge-bot[bot] authored Feb 20, 2025
2 parents 48ea126 + 38f38a6 commit 1c469dd
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
26 changes: 26 additions & 0 deletions pkg/destroy/powervs/dhcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,5 +235,31 @@ func (o *ClusterUninstaller) destroyDHCPNetworks() error {
o.Logger.Fatal("destroyDHCPNetworks: ExponentialBackoffWithContext (list) returns ", err)
}

// PowerVS hack:
// We were asked to query for the subnet still existing as a test for the DHCP network to be
// finally destroyed. Even though we can't list it anymore, it is still being destroyed. :(
backoff = wait.Backoff{
Duration: 15 * time.Second,
Factor: 1.1,
Cap: leftInContext(ctx),
Steps: math.MaxInt32}
err = wait.ExponentialBackoffWithContext(ctx, backoff, func(context.Context) (bool, error) {
secondPassList, err2 := o.listPowerSubnets()
if err2 != nil {
return false, err2
}
if len(secondPassList) == 0 {
// We finally don't see any remaining instances!
return true, nil
}
for _, item := range secondPassList {
o.Logger.Debugf("destroyDHCPNetworks: found %s in second pass", item.name)
}
return false, nil
})
if err != nil {
o.Logger.Fatal("destroyDHCPNetworks: ExponentialBackoffWithContext (list) returns ", err)
}

return nil
}
3 changes: 2 additions & 1 deletion pkg/destroy/powervs/powervs.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ func (o *ClusterUninstaller) destroyCluster() error {
}, {
{name: "DHCPs", execute: o.destroyDHCPNetworks},
}, {
{name: "Power Subnets", execute: o.destroyPowerSubnets},
{name: "Images", execute: o.destroyImages},
{name: "VPCs", execute: o.destroyVPCs},
}, {
Expand All @@ -255,6 +254,8 @@ func (o *ClusterUninstaller) destroyCluster() error {
}, {
{name: "DNS Records", execute: o.destroyDNSRecords},
{name: "DNS Resource Records", execute: o.destroyResourceRecords},
}, {
{name: "Power Subnets", execute: o.destroyPowerSubnets},
}, {
{name: "Service Instances", execute: o.destroyServiceInstances},
}}
Expand Down

0 comments on commit 1c469dd

Please sign in to comment.