@@ -100,6 +100,9 @@ type ClusterctlUpgradeSpecInput struct {
100100 // multiple infrastructure providers (ex: CAPD + in-memory) are installed on the cluster as clusterctl will not be
101101 // able to identify the default.
102102 InfrastructureProvider * string
103+ // Allows to inject a function to be run after test namespace is created.
104+ // If not specified, this is a no-op.
105+ PostNamespaceCreated func (managementClusterProxy framework.ClusterProxy , workloadClusterNamespace string )
103106 // 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
104107 // This function is called after applying the cluster template and before waiting for the cluster resources.
105108 PreWaitForCluster func (managementClusterProxy framework.ClusterProxy , workloadClusterNamespace string , workloadClusterName string )
@@ -214,7 +217,7 @@ func ClusterctlUpgradeSpec(ctx context.Context, inputGetter func() ClusterctlUpg
214217 Expect (os .MkdirAll (input .ArtifactFolder , 0750 )).To (Succeed (), "Invalid argument. input.ArtifactFolder can't be created for %s spec" , specName )
215218
216219 // Setup a Namespace where to host objects for this spec and create a watcher for the namespace events.
217- managementClusterNamespace , managementClusterCancelWatches = setupSpecNamespace (ctx , specName , input .BootstrapClusterProxy , input .ArtifactFolder )
220+ managementClusterNamespace , managementClusterCancelWatches = setupSpecNamespace (ctx , specName , input .BootstrapClusterProxy , input .ArtifactFolder , input . PostNamespaceCreated )
218221 managementClusterResources = new (clusterctl.ApplyClusterTemplateAndWaitResult )
219222 })
220223
@@ -346,6 +349,11 @@ func ClusterctlUpgradeSpec(ctx context.Context, inputGetter func() ClusterctlUpg
346349 LogFolder : filepath .Join (input .ArtifactFolder , "clusters" , "bootstrap" ),
347350 })
348351
352+ if input .PostNamespaceCreated != nil {
353+ log .Logf ("Calling postNamespaceCreated for namespace %s" , testNamespace .Name )
354+ input .PostNamespaceCreated (managementClusterProxy , testNamespace .Name )
355+ }
356+
349357 By ("Creating a test workload cluster" )
350358
351359 // NOTE: This workload cluster is used to check the old management cluster works fine.
0 commit comments