@@ -23,6 +23,7 @@ import (
2323 "k8s.io/utils/ptr"
2424
2525 clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
26+ kubeadmvbootstrap1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1beta1"
2627 "sigs.k8s.io/cluster-api/test/framework"
2728 "sigs.k8s.io/cluster-api/test/framework/clusterctl"
2829
@@ -78,7 +79,7 @@ func (e2e *E2ECluster) Variables() map[string]string {
7879 vars ["METAL_API_HMAC_AUTH_TYPE" ] = e2e .E2EContext .envOrVar ("METAL_API_HMAC_AUTH_TYPE" )
7980
8081 vars ["NAMESPACE" ] = e2e .NamespaceName
81- vars ["METAL_PROJECT_ID" ] = e2e .E2EContext .Environment .project
82+ vars ["METAL_PROJECT_ID" ] = e2e .E2EContext .Environment .projectID
8283 vars ["METAL_PARTITION" ] = e2e .E2EContext .Environment .partition
8384 vars ["METAL_NODE_NETWORK_ID" ] = * e2e .Refs .NodeNetwork .ID
8485 vars ["FIREWALL_MACHINE_SIZE" ] = e2e .FirewallSize
@@ -103,7 +104,8 @@ func (e2e *E2ECluster) SetupNamespace(ctx context.Context) *corev1.Namespace {
103104 Name : e2e .NamespaceName ,
104105 IgnoreAlreadyExists : true ,
105106 Labels : map [string ]string {
106- "e2e-test" : e2e .SpecName ,
107+ "e2e-test" : e2e .SpecName ,
108+ e2eMetalStackProjectIDLabel : e2e .E2EContext .Environment .projectID ,
107109 },
108110 })
109111 e2e .Refs .Namespace = ns
@@ -142,11 +144,12 @@ func (e2e *E2ECluster) setupNodeNetwork(ctx context.Context) {
142144
143145 nar := & metalmodels.V1NetworkAllocateRequest {
144146 Partitionid : e2e .E2EContext .Environment .partition ,
145- Projectid : e2e .E2EContext .Environment .project ,
147+ Projectid : e2e .E2EContext .Environment .projectID ,
146148 Name : e2e .ClusterName + "-node" ,
147149 Description : fmt .Sprintf ("Node network for %s" , e2e .ClusterName ),
148150 Labels : map [string ]string {
149- "e2e-test" : e2e .SpecName ,
151+ "e2e-test" : e2e .SpecName ,
152+ capmsv1alpha1 .TagInfraClusterResource : e2e .NamespaceName + "." + e2e .ClusterName ,
150153 },
151154 }
152155 net , err := e2e .E2EContext .Environment .Metal .Network ().AllocateNetwork (metalnetwork .NewAllocateNetworkParamsWithContext (ctx ).WithBody (nar ), nil )
@@ -174,11 +177,11 @@ func (e2e *E2ECluster) setupFirewall(ctx context.Context) {
174177 Hostname : e2e .ClusterName + "-fw" ,
175178 Description : "Firewall for " + e2e .ClusterName ,
176179 Partitionid : & e2e .E2EContext .Environment .partition ,
177- Projectid : & e2e .E2EContext .Environment .project ,
180+ Projectid : & e2e .E2EContext .Environment .projectID ,
178181 Sizeid : & e2e .FirewallSize ,
179182 Imageid : & e2e .FirewallImage ,
180183 Tags : []string {
181- fmt .Sprintf ("%s=%s" , capmsv1alpha1 .TagInfraClusterResource , e2e .ClusterName ),
184+ fmt .Sprintf ("%s=%s.%s " , capmsv1alpha1 .TagInfraClusterResource , e2e . NamespaceName , e2e .ClusterName ),
182185 fmt .Sprintf ("%s=%s" , "e2e-test" , e2e .SpecName ),
183186 },
184187 Networks : []* metalmodels.V1MachineAllocationNetwork {
@@ -239,6 +242,8 @@ func (e2e *E2ECluster) setupFirewall(ctx context.Context) {
239242 e2e .Refs .Firewall = fw .Payload
240243 return nil
241244 }, e2e .E2EContext .E2EConfig .GetIntervals ("metal-stack" , "wait-firewall-allocate" )... ).ShouldNot (HaveOccurred (), "firewall not available" )
245+
246+ GinkgoWriter .Printf ("Firewall allocated with ID: %s\n " , * e2e .Refs .Firewall .ID )
242247}
243248
244249func (e2e * E2ECluster ) teardownFirewall (ctx context.Context ) {
@@ -260,11 +265,11 @@ func (e2e *E2ECluster) setupControlPlaneIP(ctx context.Context) {
260265 By ("Setup Control Plane IP" )
261266
262267 ipr := & metalmodels.V1IPAllocateRequest {
263- Projectid : & e2e .E2EContext .Environment .project ,
268+ Projectid : & e2e .E2EContext .Environment .projectID ,
264269 Name : e2e .ClusterName + "-cp-ip" ,
265270 Description : "Control plane IP for " + e2e .ClusterName ,
266271 Tags : []string {
267- fmt .Sprintf ("%s=%s" , capmsv1alpha1 .TagInfraClusterResource , e2e .ClusterName ),
272+ fmt .Sprintf ("%s=%s.%s " , capmsv1alpha1 .TagInfraClusterResource , e2e . NamespaceName , e2e .ClusterName ),
268273 fmt .Sprintf ("%s=%s" , "e2e-test" , e2e .SpecName ),
269274 },
270275 Networkid : ptr .To (e2e .E2EContext .Environment .publicNetwork ),
@@ -345,6 +350,40 @@ func (e2e *E2ECluster) teardownCluster(ctx context.Context) {
345350 }, e2e .E2EContext .E2EConfig .GetIntervals ("default" , "wait-delete-cluster" )... )
346351}
347352
353+ func (ec * E2ECluster ) Dump (ctx context.Context ) {
354+ framework .DumpResourcesForCluster (ctx , framework.DumpResourcesForClusterInput {
355+ Lister : ec .E2EContext .Environment .Bootstrap .GetClient (),
356+ LogPath : path .Join (ec .E2EContext .Environment .artifactsPath , "clusters" , ec .Refs .Cluster .Namespace + "_" + ec .Refs .Cluster .Name ),
357+ Cluster : ec .Refs .Cluster ,
358+ Resources : []framework.DumpNamespaceAndGVK {
359+ {
360+ GVK : clusterv1 .GroupVersion .WithKind ("Cluster" ),
361+ Namespace : ec .Refs .Cluster .Namespace ,
362+ },
363+ {
364+ GVK : capmsv1alpha1 .GroupVersion .WithKind ("MetalStackCluster" ),
365+ Namespace : ec .Refs .Cluster .Namespace ,
366+ },
367+ {
368+ GVK : kubeadmvbootstrap1 .GroupVersion .WithKind ("KubeadmConfig" ),
369+ Namespace : ec .Refs .Cluster .Namespace ,
370+ },
371+ {
372+ GVK : clusterv1 .GroupVersion .WithKind ("MachineDeployment" ),
373+ Namespace : ec .Refs .Cluster .Namespace ,
374+ },
375+ {
376+ GVK : clusterv1 .GroupVersion .WithKind ("Machine" ),
377+ Namespace : ec .Refs .Cluster .Namespace ,
378+ },
379+ {
380+ GVK : capmsv1alpha1 .GroupVersion .WithKind ("MetalStackMachine" ),
381+ Namespace : ec .Refs .Cluster .Namespace ,
382+ },
383+ },
384+ })
385+ }
386+
348387// deleteClusterAndWait deletes a cluster object and waits for it to be gone.
349388// TODO: remove once cluster expectation has been fixed in framework
350389func deleteClusterAndWait (ctx context.Context , input framework.DeleteClusterAndWaitInput , intervals ... any ) {
0 commit comments