@@ -74,12 +74,16 @@ type ClusterctlUpgradeSpecInput struct {
74
74
// UpgradeClusterctlVariables can be used to set additional variables for clusterctl upgrade.
75
75
UpgradeClusterctlVariables map [string ]string
76
76
SkipCleanup bool
77
- ControlPlaneWaiters clusterctl.ControlPlaneWaiters
78
- PreInit func (managementClusterProxy framework.ClusterProxy )
79
- PreUpgrade func (managementClusterProxy framework.ClusterProxy )
80
- PostUpgrade func (managementClusterProxy framework.ClusterProxy )
81
- MgmtFlavor string
82
- WorkloadFlavor string
77
+ // PreWaitForCluster is a function that can be used as a hook to apply extra resources (that cannot be part of the template) in the generated namespace hosting the cluster
78
+ // This function is called after applying the cluster template and before waiting for the cluster resources.
79
+ PreWaitForCluster func (managementClusterProxy framework.ClusterProxy , workloadClusterNamespace string , workloadClusterName string )
80
+ ControlPlaneWaiters clusterctl.ControlPlaneWaiters
81
+ PreInit func (managementClusterProxy framework.ClusterProxy )
82
+ PreUpgrade func (managementClusterProxy framework.ClusterProxy )
83
+ PostUpgrade func (managementClusterProxy framework.ClusterProxy )
84
+ MgmtFlavor string
85
+ CNIManifestPath string
86
+ WorkloadFlavor string
83
87
}
84
88
85
89
// ClusterctlUpgradeSpec implements a test that verifies clusterctl upgrade of a management cluster.
@@ -193,6 +197,12 @@ func ClusterctlUpgradeSpec(ctx context.Context, inputGetter func() ClusterctlUpg
193
197
ControlPlaneMachineCount : pointer .Int64Ptr (1 ),
194
198
WorkerMachineCount : pointer .Int64Ptr (1 ),
195
199
},
200
+ PreWaitForCluster : func () {
201
+ if input .PreWaitForCluster != nil {
202
+ input .PreWaitForCluster (input .BootstrapClusterProxy , managementClusterNamespace .Name , managementClusterName )
203
+ }
204
+ },
205
+ CNIManifestPath : input .CNIManifestPath ,
196
206
ControlPlaneWaiters : input .ControlPlaneWaiters ,
197
207
WaitForClusterIntervals : input .E2EConfig .GetIntervals (specName , "wait-cluster" ),
198
208
WaitForControlPlaneIntervals : input .E2EConfig .GetIntervals (specName , "wait-control-plane" ),
@@ -290,6 +300,11 @@ func ClusterctlUpgradeSpec(ctx context.Context, inputGetter func() ClusterctlUpg
290
300
log .Logf ("Applying the cluster template yaml to the cluster" )
291
301
Expect (managementClusterProxy .Apply (ctx , workloadClusterTemplate )).To (Succeed ())
292
302
303
+ if input .PreWaitForCluster != nil {
304
+ By ("Running PreWaitForCluster steps against the management cluster" )
305
+ input .PreWaitForCluster (managementClusterProxy , testNamespace .Name , workLoadClusterName )
306
+ }
307
+
293
308
By ("Waiting for the machines to exists" )
294
309
Eventually (func () (int64 , error ) {
295
310
var n int64
0 commit comments