@@ -53,7 +53,7 @@ func DefaultBaremetalSetSpec(name types.NamespacedName, withProvInterface bool)
5353 spec := map [string ]any {
5454 "baremetalHosts" : map [string ]any {
5555 "compute-0" : map [string ]any {
56- "ctlPlaneIP" : "10.0.0.1" ,
56+ "ctlPlaneIP" : "10.0.0.1/24 " ,
5757 },
5858 },
5959 "bmhLabelSelector" : map [string ]string {"app" : "openstack" },
@@ -78,10 +78,10 @@ func TwoNodeBaremetalSetSpec(namespace string) map[string]any {
7878 spec := map [string ]any {
7979 "baremetalHosts" : map [string ]any {
8080 "compute-0" : map [string ]any {
81- "ctlPlaneIP" : "10.0.0.1" ,
81+ "ctlPlaneIP" : "10.0.0.1/24 " ,
8282 },
8383 "compute-1" : map [string ]any {
84- "ctlPlaneIP" : "10.0.0.1 " ,
84+ "ctlPlaneIP" : "10.0.0.2/24 " ,
8585 },
8686 },
8787 "bmhLabelSelector" : map [string ]string {"app" : "openstack" },
@@ -96,11 +96,11 @@ func TwoNodeBaremetalSetSpecWithNodeLabel(namespace string) map[string]any {
9696 spec := map [string ]any {
9797 "baremetalHosts" : map [string ]any {
9898 "compute-0" : map [string ]any {
99- "ctlPlaneIP" : "10.0.0.1" ,
99+ "ctlPlaneIP" : "10.0.0.1/24 " ,
100100 "bmhLabelSelector" : map [string ]string {"nodeName" : "compute-0" },
101101 },
102102 "compute-1" : map [string ]any {
103- "ctlPlaneIP" : "10.0.0.1 " ,
103+ "ctlPlaneIP" : "10.0.0.2/24 " ,
104104 "bmhLabelSelector" : map [string ]string {"nodeName" : "compute-1" },
105105 },
106106 },
@@ -116,11 +116,11 @@ func TwoNodeBaremetalSetSpecWithWrongNodeLabel(namespace string) map[string]any
116116 spec := map [string ]any {
117117 "baremetalHosts" : map [string ]any {
118118 "compute-0" : map [string ]any {
119- "ctlPlaneIP" : "10.0.0.1" ,
119+ "ctlPlaneIP" : "10.0.0.1/24 " ,
120120 "bmhLabelSelector" : map [string ]string {"nodeName" : "compute-0" },
121121 },
122122 "compute-1" : map [string ]any {
123- "ctlPlaneIP" : "10.0.0.1 " ,
123+ "ctlPlaneIP" : "10.0.0.2/24 " ,
124124 "bmhLabelSelector" : map [string ]string {"nodeName" : "compute-2" },
125125 },
126126 },
@@ -136,15 +136,15 @@ func MultiNodeBaremetalSetSpecWithSameNodeLabel(namespace string) map[string]any
136136 spec := map [string ]any {
137137 "baremetalHosts" : map [string ]any {
138138 "compute-0" : map [string ]any {
139- "ctlPlaneIP" : "10.0.0.1" ,
139+ "ctlPlaneIP" : "10.0.0.1/24 " ,
140140 "bmhLabelSelector" : map [string ]string {"nodeType" : "compute" },
141141 },
142142 "compute-1" : map [string ]any {
143- "ctlPlaneIP" : "10.0.0.2" ,
143+ "ctlPlaneIP" : "10.0.0.2/24 " ,
144144 "bmhLabelSelector" : map [string ]string {"nodeType" : "compute" },
145145 },
146146 "compute-2" : map [string ]any {
147- "ctlPlaneIP" : "10.0.0.3" ,
147+ "ctlPlaneIP" : "10.0.0.3/24 " ,
148148 "bmhLabelSelector" : map [string ]string {"nodeType" : "compute" },
149149 },
150150 },
@@ -160,15 +160,15 @@ func MultiNodeBaremetalSetSpecWithOverlappingNodeLabels(namespace string) map[st
160160 spec := map [string ]any {
161161 "baremetalHosts" : map [string ]any {
162162 "compute-0" : map [string ]any {
163- "ctlPlaneIP" : "10.0.0.1" ,
163+ "ctlPlaneIP" : "10.0.0.1/24 " ,
164164 "bmhLabelSelector" : map [string ]string {"nodeType" : "compute" , "dummyLabel" : "dummy" },
165165 },
166166 "compute-1" : map [string ]any {
167- "ctlPlaneIP" : "10.0.0.2" ,
167+ "ctlPlaneIP" : "10.0.0.2/24 " ,
168168 "bmhLabelSelector" : map [string ]string {"nodeType" : "compute" , "nodeName" : "compute-1" },
169169 },
170170 "compute-2" : map [string ]any {
171- "ctlPlaneIP" : "10.0.0.3" ,
171+ "ctlPlaneIP" : "10.0.0.3/24 " ,
172172 "bmhLabelSelector" : map [string ]string {"nodeType" : "compute" , "dummyLabel" : "dummy" },
173173 },
174174 },
@@ -283,7 +283,21 @@ func CreateSSHSecret(name types.NamespacedName) *corev1.Secret {
283283 )
284284}
285285
286- // Get ProvisionServer
286+ // Create ProvisionServer
287+ func CreateProvisionServer (name types.NamespacedName , spec map [string ]any ) * unstructured.Unstructured {
288+ raw := map [string ]interface {}{
289+ "apiVersion" : "baremetal.openstack.org/v1beta1" ,
290+ "kind" : "OpenStackProvisionServer" ,
291+ "metadata" : map [string ]interface {}{
292+ "name" : name .Name ,
293+ "namespace" : name .Namespace ,
294+ },
295+ "spec" : spec ,
296+ }
297+ return th .CreateUnstructured (raw )
298+ }
299+
300+ // Get ProvisionServer (for baremetalset-created provision servers with appended name)
287301func GetProvisionServer (name types.NamespacedName ) * baremetalv1.OpenStackProvisionServer {
288302 instance := & baremetalv1.OpenStackProvisionServer {}
289303 name .Name = strings .Join ([]string {name .Name , "provisionserver" }, "-" )
@@ -293,3 +307,19 @@ func GetProvisionServer(name types.NamespacedName) *baremetalv1.OpenStackProvisi
293307 }, timeout , interval ).Should (Succeed ())
294308 return instance
295309}
310+
311+ // Get ProvisionServer directly (without name transformation)
312+ func GetProvisionServerDirect (name types.NamespacedName ) * baremetalv1.OpenStackProvisionServer {
313+ instance := & baremetalv1.OpenStackProvisionServer {}
314+ Eventually (func (g Gomega ) error {
315+ g .Expect (k8sClient .Get (ctx , name , instance )).Should (Succeed ())
316+ return nil
317+ }, timeout , interval ).Should (Succeed ())
318+ return instance
319+ }
320+
321+ // ProvisionServerConditionGetter
322+ func ProvisionServerConditionGetter (name types.NamespacedName ) condition.Conditions {
323+ instance := GetProvisionServerDirect (name )
324+ return instance .Status .Conditions
325+ }
0 commit comments