Skip to content

Commit

Permalink
Add PreCleanupManagementCluster hook to clusterctl_upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
mboukhalfa committed Oct 10, 2022
1 parent adb6819 commit 296072f
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions test/e2e/clusterctl_upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,12 @@ type ClusterctlUpgradeSpecInput struct {
PreInit func(managementClusterProxy framework.ClusterProxy)
PreUpgrade func(managementClusterProxy framework.ClusterProxy)
PostUpgrade func(managementClusterProxy framework.ClusterProxy)
MgmtFlavor string
CNIManifestPath string
WorkloadFlavor string
// PreCleanupManagementCluster hook can be used for extra steps that might be required from providers, for example, remove conflicting service (such as DHCP) running on
// the target management cluster and run it on bootstrap (before the latter resumes LCM) if both clusters share the same LAN
PreCleanupManagementCluster func(managementClusterProxy framework.ClusterProxy)
MgmtFlavor string
CNIManifestPath string
WorkloadFlavor string
}

// ClusterctlUpgradeSpec implements a test that verifies clusterctl upgrade of a management cluster.
Expand Down Expand Up @@ -467,6 +470,10 @@ func ClusterctlUpgradeSpec(ctx context.Context, inputGetter func() ClusterctlUpg
testCancelWatches()
}

if input.PreCleanupManagementCluster != nil {
By("Running Pre-CleanManagement steps against the management cluster")
input.PreCleanupManagementCluster(managementClusterProxy)
}
// Dumps all the resources in the spec namespace, then cleanups the cluster object and the spec namespace itself.
dumpSpecResourcesAndCleanup(ctx, specName, input.BootstrapClusterProxy, input.ArtifactFolder, managementClusterNamespace, managementClusterCancelWatches, managementClusterResources.Cluster, input.E2EConfig.GetIntervals, input.SkipCleanup)
})
Expand Down

0 comments on commit 296072f

Please sign in to comment.