Skip to content

Commit d9ac3ec

Browse files
authored
Merge pull request #7373 from Nordix/Add-Pre-cluster-cleaning-hook/mohammed
🌱 Add PreCleanupManagementCluster hook to clusterctl upgrade test
2 parents 824a1aa + 976c6ce commit d9ac3ec

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

test/e2e/clusterctl_upgrade.go

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,12 @@ type ClusterctlUpgradeSpecInput struct {
8181
PreInit func(managementClusterProxy framework.ClusterProxy)
8282
PreUpgrade func(managementClusterProxy framework.ClusterProxy)
8383
PostUpgrade func(managementClusterProxy framework.ClusterProxy)
84-
MgmtFlavor string
85-
CNIManifestPath string
86-
WorkloadFlavor string
84+
// PreCleanupManagementCluster hook can be used for extra steps that might be required from providers, for example, remove conflicting service (such as DHCP) running on
85+
// the target management cluster and run it on bootstrap (before the latter resumes LCM) if both clusters share the same LAN
86+
PreCleanupManagementCluster func(managementClusterProxy framework.ClusterProxy)
87+
MgmtFlavor string
88+
CNIManifestPath string
89+
WorkloadFlavor string
8790
}
8891

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

473+
if input.PreCleanupManagementCluster != nil {
474+
By("Running PreCleanupManagementCluster steps against the management cluster")
475+
input.PreCleanupManagementCluster(managementClusterProxy)
476+
}
470477
// Dumps all the resources in the spec namespace, then cleanups the cluster object and the spec namespace itself.
471478
dumpSpecResourcesAndCleanup(ctx, specName, input.BootstrapClusterProxy, input.ArtifactFolder, managementClusterNamespace, managementClusterCancelWatches, managementClusterResources.Cluster, input.E2EConfig.GetIntervals, input.SkipCleanup)
472479
})

0 commit comments

Comments
 (0)