@@ -21,7 +21,7 @@ import (
21
21
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
22
22
clusterctlv1 "sigs.k8s.io/cluster-api/cmd/clusterctl/api/v1alpha3"
23
23
capie2e "sigs.k8s.io/cluster-api/test/e2e"
24
- "sigs.k8s.io/cluster-api/test/framework"
24
+ capie2eframework "sigs.k8s.io/cluster-api/test/framework"
25
25
"sigs.k8s.io/cluster-api/test/framework/bootstrap"
26
26
"sigs.k8s.io/cluster-api/test/framework/clusterctl"
27
27
"sigs.k8s.io/cluster-api/util"
@@ -32,7 +32,7 @@ import (
32
32
type SelfHostedSpecInput struct {
33
33
E2EConfig * clusterctl.E2EConfig
34
34
ClusterctlConfigPath string
35
- BootstrapClusterProxy framework .ClusterProxy
35
+ BootstrapClusterProxy capie2eframework .ClusterProxy
36
36
ArtifactFolder string
37
37
SkipCleanup bool
38
38
ControlPlaneWaiters clusterctl.ControlPlaneWaiters
@@ -67,7 +67,7 @@ type SelfHostedSpecInput struct {
67
67
WorkerMachineCount * int64
68
68
69
69
// PostClusterMoved is a function that is called after the cluster is moved to self-hosted.
70
- PostClusterMoved func (proxy framework .ClusterProxy , cluster * clusterv1.Cluster )
70
+ PostClusterMoved func (proxy capie2eframework .ClusterProxy , cluster * clusterv1.Cluster )
71
71
}
72
72
73
73
// SelfHostedSpec implements a test that verifies Cluster API creating a cluster, pivoting to a self-hosted cluster.
@@ -79,7 +79,7 @@ func SelfHostedSpec(ctx context.Context, inputGetter func() SelfHostedSpecInput)
79
79
cancelWatches context.CancelFunc
80
80
clusterResources * clusterctl.ApplyClusterTemplateAndWaitResult
81
81
82
- selfHostedClusterProxy framework .ClusterProxy
82
+ selfHostedClusterProxy capie2eframework .ClusterProxy
83
83
selfHostedNamespace * corev1.Namespace
84
84
selfHostedCancelWatches context.CancelFunc
85
85
selfHostedCluster * clusterv1.Cluster
@@ -212,13 +212,13 @@ func SelfHostedSpec(ctx context.Context, inputGetter func() SelfHostedSpecInput)
212
212
ctx ,
213
213
cluster .Namespace ,
214
214
cluster .Name ,
215
- framework .WithMachineLogCollector (input .BootstrapClusterProxy .GetLogCollector ()),
215
+ capie2eframework .WithMachineLogCollector (input .BootstrapClusterProxy .GetLogCollector ()),
216
216
)
217
217
218
218
capie2e .Byf ("Creating a namespace for hosting the %s test spec" , specName )
219
- selfHostedNamespace , selfHostedCancelWatches = framework .CreateNamespaceAndWatchEvents (
219
+ selfHostedNamespace , selfHostedCancelWatches = capie2eframework .CreateNamespaceAndWatchEvents (
220
220
ctx ,
221
- framework .CreateNamespaceAndWatchEventsInput {
221
+ capie2eframework .CreateNamespaceAndWatchEventsInput {
222
222
Creator : selfHostedClusterProxy .GetClient (),
223
223
ClientSet : selfHostedClusterProxy .GetClientSet (),
224
224
Name : namespace .Name ,
@@ -234,12 +234,29 @@ func SelfHostedSpec(ctx context.Context, inputGetter func() SelfHostedSpecInput)
234
234
clusterctl .InitManagementClusterAndWatchControllerLogs (
235
235
watchesCtx ,
236
236
clusterctl.InitManagementClusterAndWatchControllerLogsInput {
237
- ClusterProxy : selfHostedClusterProxy ,
238
- ClusterctlConfigPath : input .ClusterctlConfigPath ,
239
- InfrastructureProviders : input .E2EConfig .InfrastructureProviders (),
240
- IPAMProviders : input .E2EConfig .IPAMProviders (),
241
- RuntimeExtensionProviders : input .E2EConfig .RuntimeExtensionProviders (),
242
- AddonProviders : input .E2EConfig .AddonProviders (),
237
+ ClusterProxy : selfHostedClusterProxy ,
238
+ ClusterctlConfigPath : input .ClusterctlConfigPath ,
239
+ CoreProvider : input .E2EConfig .GetProviderLatestVersionsByContract (
240
+ "*" ,
241
+ CoreProvider (input .E2EConfig ),
242
+ )[0 ],
243
+ BootstrapProviders : input .E2EConfig .GetProviderLatestVersionsByContract (
244
+ "*" ,
245
+ BootstrapProviders (input .E2EConfig )... ,
246
+ ),
247
+ ControlPlaneProviders : input .E2EConfig .GetProviderLatestVersionsByContract (
248
+ "*" ,
249
+ ControlPlaneProviders (input .E2EConfig )... ,
250
+ ),
251
+ InfrastructureProviders : input .E2EConfig .GetProviderLatestVersionsByContract (
252
+ "*" ,
253
+ input .E2EConfig .InfrastructureProviders ()... ),
254
+ AddonProviders : input .E2EConfig .GetProviderLatestVersionsByContract (
255
+ "*" ,
256
+ input .E2EConfig .AddonProviders ()... ),
257
+ RuntimeExtensionProviders : input .E2EConfig .GetProviderLatestVersionsByContract (
258
+ "*" ,
259
+ input .E2EConfig .RuntimeExtensionProviders ()... ),
243
260
LogFolder : filepath .Join (
244
261
input .ArtifactFolder ,
245
262
"clusters" ,
@@ -274,9 +291,9 @@ func SelfHostedSpec(ctx context.Context, inputGetter func() SelfHostedSpecInput)
274
291
})
275
292
276
293
By ("Waiting for the cluster to be reconciled after moving to self hosted" )
277
- selfHostedCluster = framework .DiscoveryAndWaitForCluster (
294
+ selfHostedCluster = capie2eframework .DiscoveryAndWaitForCluster (
278
295
ctx ,
279
- framework .DiscoveryAndWaitForClusterInput {
296
+ capie2eframework .DiscoveryAndWaitForClusterInput {
280
297
Getter : selfHostedClusterProxy .GetClient (),
281
298
Namespace : selfHostedNamespace .Name ,
282
299
Name : cluster .Name ,
@@ -335,9 +352,9 @@ func SelfHostedSpec(ctx context.Context, inputGetter func() SelfHostedSpecInput)
335
352
})
336
353
337
354
By ("Waiting for the cluster to be reconciled after moving back to bootstrap" )
338
- clusterResources .Cluster = framework .DiscoveryAndWaitForCluster (
355
+ clusterResources .Cluster = capie2eframework .DiscoveryAndWaitForCluster (
339
356
ctx ,
340
- framework .DiscoveryAndWaitForClusterInput {
357
+ capie2eframework .DiscoveryAndWaitForClusterInput {
341
358
Getter : input .BootstrapClusterProxy .GetClient (),
342
359
Namespace : namespace .Name ,
343
360
Name : clusterResources .Cluster .Name ,
@@ -377,13 +394,13 @@ func hasProvider(ctx context.Context, c client.Client, providerName string) bool
377
394
func setupSpecNamespace (
378
395
ctx context.Context ,
379
396
specName string ,
380
- clusterProxy framework .ClusterProxy ,
397
+ clusterProxy capie2eframework .ClusterProxy ,
381
398
artifactFolder string ,
382
399
) (* corev1.Namespace , context.CancelFunc ) {
383
400
capie2e .Byf ("Creating a namespace for hosting the %q test spec" , specName )
384
- namespace , cancelWatches := framework .CreateNamespaceAndWatchEvents (
401
+ namespace , cancelWatches := capie2eframework .CreateNamespaceAndWatchEvents (
385
402
ctx ,
386
- framework .CreateNamespaceAndWatchEventsInput {
403
+ capie2eframework .CreateNamespaceAndWatchEventsInput {
387
404
Creator : clusterProxy .GetClient (),
388
405
ClientSet : clusterProxy .GetClientSet (),
389
406
Name : fmt .Sprintf ("%s-%s" , specName , util .RandomString (6 )),
@@ -397,7 +414,7 @@ func setupSpecNamespace(
397
414
// dumpAllResources dumps all the resources in the spec namespace and the workload cluster.
398
415
func dumpAllResources (
399
416
ctx context.Context ,
400
- clusterProxy framework .ClusterProxy ,
417
+ clusterProxy capie2eframework .ClusterProxy ,
401
418
artifactFolder string ,
402
419
namespace * corev1.Namespace ,
403
420
cluster * clusterv1.Cluster ,
@@ -415,7 +432,7 @@ func dumpAllResources(
415
432
capie2e .Byf ("Dumping all the Cluster API resources in the %q namespace" , namespace .Name )
416
433
417
434
// Dump all Cluster API related resources to artifacts.
418
- framework .DumpAllResources (ctx , framework .DumpAllResourcesInput {
435
+ capie2eframework .DumpAllResources (ctx , capie2eframework .DumpAllResourcesInput {
419
436
Lister : clusterProxy .GetClient (),
420
437
Namespace : namespace .Name ,
421
438
LogPath : filepath .Join (artifactFolder , "clusters" , clusterProxy .GetName (), "resources" ),
@@ -424,12 +441,12 @@ func dumpAllResources(
424
441
// If the cluster still exists, dump pods and nodes of the workload cluster.
425
442
if err := clusterProxy .GetClient ().Get (ctx , client .ObjectKeyFromObject (cluster ), & clusterv1.Cluster {}); err == nil {
426
443
capie2e .Byf ("Dumping Pods and Nodes of Cluster %s" , klog .KObj (cluster ))
427
- framework .DumpResourcesForCluster (ctx , framework .DumpResourcesForClusterInput {
444
+ capie2eframework .DumpResourcesForCluster (ctx , capie2eframework .DumpResourcesForClusterInput {
428
445
Lister : clusterProxy .GetWorkloadCluster (ctx , cluster .Namespace , cluster .Name ).
429
446
GetClient (),
430
447
Cluster : cluster ,
431
448
LogPath : filepath .Join (artifactFolder , "clusters" , cluster .Name , "resources" ),
432
- Resources : []framework .DumpNamespaceAndGVK {
449
+ Resources : []capie2eframework .DumpNamespaceAndGVK {
433
450
{
434
451
GVK : schema.GroupVersionKind {
435
452
Version : corev1 .SchemeGroupVersion .Version ,
@@ -451,7 +468,7 @@ func dumpAllResources(
451
468
func dumpSpecResourcesAndCleanup (
452
469
ctx context.Context ,
453
470
specName string ,
454
- clusterProxy framework .ClusterProxy ,
471
+ clusterProxy capie2eframework .ClusterProxy ,
455
472
artifactFolder string ,
456
473
namespace * corev1.Namespace ,
457
474
cancelWatches context.CancelFunc ,
@@ -467,13 +484,16 @@ func dumpSpecResourcesAndCleanup(
467
484
// While https://github.com/kubernetes-sigs/cluster-api/issues/2955 is addressed in future iterations, there is a
468
485
// chance that cluster variable is not set even if the cluster exists, so we are calling DeleteAllClustersAndWait
469
486
// instead of DeleteClusterAndWait
470
- framework .DeleteAllClustersAndWait (ctx , framework.DeleteAllClustersAndWaitInput {
471
- Client : clusterProxy .GetClient (),
472
- Namespace : namespace .Name ,
473
- }, intervalsGetter (specName , "wait-delete-cluster" )... )
487
+ capie2eframework .DeleteAllClustersAndWait (
488
+ ctx ,
489
+ capie2eframework.DeleteAllClustersAndWaitInput {
490
+ Client : clusterProxy .GetClient (),
491
+ Namespace : namespace .Name ,
492
+ },
493
+ intervalsGetter (specName , "wait-delete-cluster" )... )
474
494
475
495
capie2e .Byf ("Deleting namespace used for hosting the %q test spec" , specName )
476
- framework .DeleteNamespace (ctx , framework .DeleteNamespaceInput {
496
+ capie2eframework .DeleteNamespace (ctx , capie2eframework .DeleteNamespaceInput {
477
497
Deleter : clusterProxy .GetClient (),
478
498
Name : namespace .Name ,
479
499
})
0 commit comments