@@ -36,6 +36,7 @@ import (
36
36
corev1 "k8s.io/api/core/v1"
37
37
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
38
38
apimachinerytypes "k8s.io/apimachinery/pkg/types"
39
+ utilrand "k8s.io/apimachinery/pkg/util/rand"
39
40
"k8s.io/utils/pointer"
40
41
clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4"
41
42
bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4"
@@ -153,26 +154,30 @@ var _ = Describe("e2e tests", func() {
153
154
{Description : "primary" },
154
155
}
155
156
157
+ testTag := utilrand .String (6 )
158
+ machineTags := []string {testTag }
159
+
156
160
// Note that as the bootstrap config does not have cloud.conf, the node will not be added to the cluster.
157
161
// We still expect the port for the machine to be created.
158
162
framework .CreateMachineDeployment (ctx , framework.CreateMachineDeploymentInput {
159
163
Creator : e2eCtx .Environment .BootstrapClusterProxy .GetClient (),
160
164
MachineDeployment : makeMachineDeployment (namespace .Name , md3Name , clusterName , "" , 1 ),
161
165
BootstrapConfigTemplate : makeJoinBootstrapConfigTemplate (namespace .Name , md3Name ),
162
- InfraMachineTemplate : makeOpenStackMachineTemplateWithPortOptions (namespace .Name , clusterName , md3Name , customPortOptions ),
166
+ InfraMachineTemplate : makeOpenStackMachineTemplateWithPortOptions (namespace .Name , clusterName , md3Name , customPortOptions , machineTags ),
163
167
})
164
168
165
169
shared .Byf ("Waiting for custom port to be created" )
166
170
var plist []ports.Port
167
171
var err error
168
172
Eventually (func () int {
169
- plist , err = shared .DumpOpenStackPorts (e2eCtx , ports.ListOpts {Description : "primary" })
173
+ plist , err = shared .DumpOpenStackPorts (e2eCtx , ports.ListOpts {Description : "primary" , Tags : testTag })
170
174
Expect (err ).To (BeNil ())
171
175
return len (plist )
172
176
}, e2eCtx .E2EConfig .GetIntervals (specName , "wait-worker-nodes" )... ).Should (Equal (1 ))
173
177
174
178
port := plist [0 ]
175
179
Expect (port .Description ).To (Equal ("primary" ))
180
+ Expect (port .Tags ).To (ContainElement (testTag ))
176
181
})
177
182
It ("It should be creatable and deletable" , func () {
178
183
shared .Byf ("Creating a cluster" )
@@ -465,7 +470,7 @@ func makeOpenStackMachineTemplate(namespace, clusterName, name string, subnetID
465
470
}
466
471
}
467
472
468
- func makeOpenStackMachineTemplateWithPortOptions (namespace , clusterName , name string , portOpts * []infrav1.PortOpts ) * infrav1.OpenStackMachineTemplate {
473
+ func makeOpenStackMachineTemplateWithPortOptions (namespace , clusterName , name string , portOpts * []infrav1.PortOpts , machineTags [] string ) * infrav1.OpenStackMachineTemplate {
469
474
return & infrav1.OpenStackMachineTemplate {
470
475
ObjectMeta : metav1.ObjectMeta {
471
476
Name : name ,
@@ -483,6 +488,7 @@ func makeOpenStackMachineTemplateWithPortOptions(namespace, clusterName, name st
483
488
Name : fmt .Sprintf ("%s-cloud-config" , clusterName ),
484
489
},
485
490
Ports : * portOpts ,
491
+ Tags : machineTags ,
486
492
},
487
493
},
488
494
},
0 commit comments