@@ -145,6 +145,46 @@ var _ = Describe("Dataplane NodeSet Test", func() {
145145 })
146146 })
147147
148+ When ("A Dataplane nodeset is created and no ctlplane network in networks" , func () {
149+ BeforeEach (func () {
150+ DeferCleanup (th .DeleteInstance ,
151+ CreateNetConfig (dataplaneNetConfigName , DefaultNetConfigSpec ()))
152+
153+ DeferCleanup (th .DeleteInstance ,
154+ CreateDataplaneNodeSet (dataplaneNodeSetName ,
155+ DefaultDataPlaneNoNodeSetSpec (false )))
156+ })
157+
158+ It ("Should fail to set NodeSetIPReservationReadyCondition true when ctlplane is not in the networks" , func () {
159+ Eventually (func (g Gomega ) {
160+ instance := GetDataplaneNodeSet (dataplaneNodeSetName )
161+ instance .Spec .NodeTemplate .Networks [1 ].Name = "notctlplane"
162+ g .Expect (th .K8sClient .Update (th .Ctx , instance )).Should (Succeed ())
163+ th .ExpectCondition (
164+ dataplaneNodeSetName ,
165+ ConditionGetterFunc (DataplaneConditionGetter ),
166+ condition .ReadyCondition ,
167+ corev1 .ConditionFalse ,
168+ )
169+ th .ExpectCondition (
170+ dataplaneNodeSetName ,
171+ ConditionGetterFunc (DataplaneConditionGetter ),
172+ condition .InputReadyCondition ,
173+ corev1 .ConditionUnknown ,
174+ )
175+ th .ExpectCondition (
176+ dataplaneNodeSetName ,
177+ ConditionGetterFunc (DataplaneConditionGetter ),
178+ dataplanev1 .NodeSetIPReservationReadyCondition ,
179+ corev1 .ConditionFalse ,
180+ )
181+ conditions := DataplaneConditionGetter (dataplaneNodeSetName )
182+ message := & conditions .Get (dataplanev1 .NodeSetIPReservationReadyCondition ).Message
183+ g .Expect (* message ).Should (ContainSubstring ("ctlplane network should be defined for node" ))
184+ }, timeout , interval ).Should (Succeed ())
185+ })
186+ })
187+
148188 When ("A Dataplane nodeset is created and no dnsmasq" , func () {
149189 BeforeEach (func () {
150190 DeferCleanup (th .DeleteInstance ,
@@ -292,10 +332,15 @@ var _ = Describe("Dataplane NodeSet Test", func() {
292332 AnsibleVars : nil ,
293333 },
294334 ExtraMounts : nil ,
295- Networks : []infrav1.IPSetNetwork {{
296- Name : "ctlplane" ,
297- SubnetName : "subnet1" ,
298- },
335+ Networks : []infrav1.IPSetNetwork {
336+ {
337+ Name : "networkinternal" ,
338+ SubnetName : "subnet1" ,
339+ },
340+ {
341+ Name : "ctlplane" ,
342+ SubnetName : "subnet1" ,
343+ },
299344 },
300345 },
301346 Env : nil ,
@@ -418,10 +463,15 @@ var _ = Describe("Dataplane NodeSet Test", func() {
418463 },
419464 NodeTemplate : dataplanev1.NodeTemplate {
420465 AnsibleSSHPrivateKeySecret : "dataplane-ansible-ssh-private-key-secret" ,
421- Networks : []infrav1.IPSetNetwork {{
422- Name : "ctlplane" ,
423- SubnetName : "subnet1" ,
424- },
466+ Networks : []infrav1.IPSetNetwork {
467+ {
468+ Name : "networkinternal" ,
469+ SubnetName : "subnet1" ,
470+ },
471+ {
472+ Name : "ctlplane" ,
473+ SubnetName : "subnet1" ,
474+ },
425475 },
426476 ManagementNetwork : "ctlplane" ,
427477 Ansible : dataplanev1.AnsibleOpts {
@@ -724,10 +774,15 @@ var _ = Describe("Dataplane NodeSet Test", func() {
724774 DeferCleanup (th .DeleteInstance , CreateNetConfig (dataplaneNetConfigName , DefaultNetConfigSpec ()))
725775 nodeOverrideSpec := dataplanev1.NodeSection {
726776 HostName : dataplaneNodeName .Name ,
727- Networks : []infrav1.IPSetNetwork {{
728- Name : "ctlplane" ,
729- SubnetName : "subnet1" ,
730- },
777+ Networks : []infrav1.IPSetNetwork {
778+ {
779+ Name : "networkinternal" ,
780+ SubnetName : "subnet1" ,
781+ },
782+ {
783+ Name : "ctlplane" ,
784+ SubnetName : "subnet1" ,
785+ },
731786 },
732787 Ansible : dataplanev1.AnsibleOpts {
733788 AnsibleUser : "test-user" ,
@@ -860,10 +915,15 @@ var _ = Describe("Dataplane NodeSet Test", func() {
860915 },
861916 NodeTemplate : dataplanev1.NodeTemplate {
862917 AnsibleSSHPrivateKeySecret : "dataplane-ansible-ssh-private-key-secret" ,
863- Networks : []infrav1.IPSetNetwork {{
864- Name : "ctlplane" ,
865- SubnetName : "subnet1" ,
866- },
918+ Networks : []infrav1.IPSetNetwork {
919+ {
920+ Name : "networkinternal" ,
921+ SubnetName : "subnet1" ,
922+ },
923+ {
924+ Name : "ctlplane" ,
925+ SubnetName : "subnet1" ,
926+ },
867927 },
868928 ManagementNetwork : "ctlplane" ,
869929 Ansible : dataplanev1.AnsibleOpts {
@@ -1164,10 +1224,15 @@ var _ = Describe("Dataplane NodeSet Test", func() {
11641224 DeferCleanup (th .DeleteInstance , CreateDNSMasq (dnsMasqName , DefaultDNSMasqSpec ()))
11651225 nodeOverrideSpec := dataplanev1.NodeSection {
11661226 HostName : dataplaneNodeName .Name ,
1167- Networks : []infrav1.IPSetNetwork {{
1168- Name : "ctlplane" ,
1169- SubnetName : "subnet1" ,
1170- },
1227+ Networks : []infrav1.IPSetNetwork {
1228+ {
1229+ Name : "networkinternal" ,
1230+ SubnetName : "subnet1" ,
1231+ },
1232+ {
1233+ Name : "ctlplane" ,
1234+ SubnetName : "subnet1" ,
1235+ },
11711236 },
11721237 Ansible : dataplanev1.AnsibleOpts {
11731238 AnsibleUser : "test-user" ,
0 commit comments