@@ -186,7 +186,7 @@ func ClusterClassRolloutSpec(ctx context.Context, inputGetter func() ClusterClas
186
186
},
187
187
WaitForMachineDeployments : input .E2EConfig .GetIntervals (specName , "wait-worker-nodes" ),
188
188
})
189
- By ("Modifying the MachinePool configuration via Cluster topology and wait for changes to be applied to the MachinePool (in-place)" )
189
+ By ("Modifying the MachinePool configuration via Cluster topology and wait for changes to be applied to the MachinePools (in-place)" )
190
190
modifyMachinePoolViaClusterAndWait (ctx , modifyMachinePoolViaClusterAndWaitInput {
191
191
ClusterProxy : input .BootstrapClusterProxy ,
192
192
Cluster : clusterResources .Cluster ,
@@ -203,7 +203,7 @@ func ClusterClassRolloutSpec(ctx context.Context, inputGetter func() ClusterClas
203
203
topology .NodeVolumeDetachTimeout = & metav1.Duration {Duration : time .Duration (rand .Intn (20 )) * time .Second } //nolint:gosec
204
204
topology .MinReadySeconds = pointer .Int32 (rand .Int31n (20 )) //nolint:gosec
205
205
},
206
- WaitForMachinePools : input .E2EConfig .GetIntervals (specName , "wait-worker -nodes" ),
206
+ WaitForMachinePools : input .E2EConfig .GetIntervals (specName , "wait-machine-pool -nodes" ),
207
207
})
208
208
By ("Verifying there are no unexpected rollouts through in-place rollout" )
209
209
Consistently (func (g Gomega ) {
@@ -242,7 +242,7 @@ func ClusterClassRolloutSpec(ctx context.Context, inputGetter func() ClusterClas
242
242
ModifyBootstrapConfigTemplateFields : map [string ]interface {}{
243
243
"spec.template.spec.verbosity" : int64 (4 ),
244
244
},
245
- WaitForMachinePools : input .E2EConfig .GetIntervals (specName , "wait-worker -nodes" ),
245
+ WaitForMachinePools : input .E2EConfig .GetIntervals (specName , "wait-machine-pool -nodes" ),
246
246
})
247
247
By ("Verifying all Machines are replaced through rollout" )
248
248
Eventually (func (g Gomega ) {
@@ -644,7 +644,7 @@ func assertMachinePools(g Gomega, clusterClassObjects clusterClassObjects, clust
644
644
g .Expect (
645
645
union (
646
646
machinePool .Annotations ,
647
- ). without ( g , clusterv1 . RevisionAnnotation ) ,
647
+ ),
648
648
).To (BeEquivalentTo (
649
649
union (
650
650
mpTopology .Metadata .Annotations ,
@@ -671,68 +671,52 @@ func assertMachinePools(g Gomega, clusterClassObjects clusterClassObjects, clust
671
671
),
672
672
))
673
673
674
- // MachinePool InfrastructureMachineTemplate.metadata
675
- ccInfrastructureMachineTemplate := clusterClassObjects .InfrastructureMachinePoolTemplateByMachinePoolClass [mpClass .Class ]
676
- ccInfrastructureMachineTemplateTemplateMetadata := mustMetadata (contract .InfrastructureMachineTemplate ().Template ().Metadata ().Get (ccInfrastructureMachineTemplate ))
677
- infrastructureMachineTemplate := clusterObjects .InfrastructureMachinePoolTemplateByMachinePool [machinePool .Name ]
678
- infrastructureMachineTemplateTemplateMetadata := mustMetadata (contract .InfrastructureMachineTemplate ().Template ().Metadata ().Get (infrastructureMachineTemplate ))
679
- g .Expect (infrastructureMachineTemplate .GetLabels ()).To (BeEquivalentTo (
674
+ // MachinePool InfrastructureMachinePool.metadata
675
+ ccInfrastructureMachinePoolTemplate := clusterClassObjects .InfrastructureMachinePoolTemplateByMachinePoolClass [mpClass .Class ]
676
+ ccInfrastructureMachinePoolTemplateTemplateMetadata := mustMetadata (contract .InfrastructureMachinePoolTemplate ().Template ().Metadata ().Get (ccInfrastructureMachinePoolTemplate ))
677
+ infrastructureMachinePool := clusterObjects .InfrastructureMachinePoolByMachinePool [machinePool .Name ]
678
+ g .Expect (infrastructureMachinePool .GetLabels ()).To (BeEquivalentTo (
680
679
union (
681
680
map [string ]string {
682
681
clusterv1 .ClusterNameLabel : cluster .Name ,
683
682
clusterv1 .ClusterTopologyOwnedLabel : "" ,
684
683
clusterv1 .ClusterTopologyMachinePoolNameLabel : mpTopology .Name ,
685
684
},
686
- ccInfrastructureMachineTemplate . GetLabels () ,
685
+ ccInfrastructureMachinePoolTemplateTemplateMetadata . Labels ,
687
686
),
688
687
))
689
- g .Expect (infrastructureMachineTemplate .GetAnnotations ()).To (BeEquivalentTo (
688
+ g .Expect (infrastructureMachinePool .GetAnnotations ()).To (BeEquivalentTo (
690
689
union (
691
690
map [string ]string {
692
691
clusterv1 .TemplateClonedFromGroupKindAnnotation : groupKind (mpClass .Template .Infrastructure .Ref ),
693
692
clusterv1 .TemplateClonedFromNameAnnotation : mpClass .Template .Infrastructure .Ref .Name ,
694
693
},
695
- ccInfrastructureMachineTemplate .GetAnnotations (),
696
- ).without (g , corev1 .LastAppliedConfigAnnotation ),
697
- ))
698
- // MachinePool InfrastructureMachineTemplate.spec.template.metadata
699
- g .Expect (infrastructureMachineTemplateTemplateMetadata .Labels ).To (BeEquivalentTo (
700
- ccInfrastructureMachineTemplateTemplateMetadata .Labels ,
701
- ))
702
- g .Expect (infrastructureMachineTemplateTemplateMetadata .Annotations ).To (BeEquivalentTo (
703
- ccInfrastructureMachineTemplateTemplateMetadata .Annotations ,
694
+ ccInfrastructureMachinePoolTemplateTemplateMetadata .Annotations ,
695
+ ),
704
696
))
705
697
706
- // MachinePool BootstrapConfigTemplate .metadata
698
+ // MachinePool BootstrapConfig .metadata
707
699
ccBootstrapConfigTemplate := clusterClassObjects .BootstrapConfigTemplateByMachinePoolClass [mpClass .Class ]
708
700
ccBootstrapConfigTemplateTemplateMetadata := mustMetadata (contract .BootstrapConfigTemplate ().Template ().Metadata ().Get (ccBootstrapConfigTemplate ))
709
- bootstrapConfigTemplate := clusterObjects .BootstrapConfigTemplateByMachinePool [machinePool .Name ]
710
- bootstrapConfigTemplateTemplateMetadata := mustMetadata (contract .BootstrapConfigTemplate ().Template ().Metadata ().Get (bootstrapConfigTemplate ))
711
- g .Expect (bootstrapConfigTemplate .GetLabels ()).To (BeEquivalentTo (
701
+ bootstrapConfig := clusterObjects .BootstrapConfigByMachinePool [machinePool .Name ]
702
+ g .Expect (bootstrapConfig .GetLabels ()).To (BeEquivalentTo (
712
703
union (
713
704
map [string ]string {
714
705
clusterv1 .ClusterNameLabel : cluster .Name ,
715
706
clusterv1 .ClusterTopologyOwnedLabel : "" ,
716
707
clusterv1 .ClusterTopologyMachinePoolNameLabel : mpTopology .Name ,
717
708
},
718
- ccBootstrapConfigTemplate . GetLabels () ,
709
+ ccBootstrapConfigTemplateTemplateMetadata . Labels ,
719
710
),
720
711
))
721
- g .Expect (bootstrapConfigTemplate .GetAnnotations ()).To (BeEquivalentTo (
712
+ g .Expect (bootstrapConfig .GetAnnotations ()).To (BeEquivalentTo (
722
713
union (
723
714
map [string ]string {
724
715
clusterv1 .TemplateClonedFromGroupKindAnnotation : groupKind (mpClass .Template .Bootstrap .Ref ),
725
716
clusterv1 .TemplateClonedFromNameAnnotation : mpClass .Template .Bootstrap .Ref .Name ,
726
717
},
727
- ccBootstrapConfigTemplate .GetAnnotations (),
728
- ).without (g , corev1 .LastAppliedConfigAnnotation ),
729
- ))
730
- // MachinePool BootstrapConfigTemplate.spec.template.metadata
731
- g .Expect (bootstrapConfigTemplateTemplateMetadata .Labels ).To (BeEquivalentTo (
732
- ccBootstrapConfigTemplateTemplateMetadata .Labels ,
733
- ))
734
- g .Expect (bootstrapConfigTemplateTemplateMetadata .Annotations ).To (BeEquivalentTo (
735
- ccBootstrapConfigTemplateTemplateMetadata .Annotations ,
718
+ ccBootstrapConfigTemplateTemplateMetadata .Annotations ,
719
+ ),
736
720
))
737
721
}
738
722
}
@@ -1040,6 +1024,8 @@ func getClusterClassObjects(ctx context.Context, g Gomega, clusterProxy framewor
1040
1024
res := clusterClassObjects {
1041
1025
InfrastructureMachineTemplateByMachineDeploymentClass : map [string ]* unstructured.Unstructured {},
1042
1026
BootstrapConfigTemplateByMachineDeploymentClass : map [string ]* unstructured.Unstructured {},
1027
+ InfrastructureMachinePoolTemplateByMachinePoolClass : map [string ]* unstructured.Unstructured {},
1028
+ BootstrapConfigTemplateByMachinePoolClass : map [string ]* unstructured.Unstructured {},
1043
1029
}
1044
1030
var err error
1045
1031
@@ -1062,6 +1048,16 @@ func getClusterClassObjects(ctx context.Context, g Gomega, clusterProxy framewor
1062
1048
res .BootstrapConfigTemplateByMachineDeploymentClass [mdClass .Class ] = bootstrapConfigTemplate
1063
1049
}
1064
1050
1051
+ for _ , mpClass := range clusterClass .Spec .Workers .MachinePools {
1052
+ infrastructureMachinePoolTemplate , err := external .Get (ctx , mgmtClient , mpClass .Template .Infrastructure .Ref , clusterClass .Namespace )
1053
+ g .Expect (err ).ToNot (HaveOccurred ())
1054
+ res .InfrastructureMachinePoolTemplateByMachinePoolClass [mpClass .Class ] = infrastructureMachinePoolTemplate
1055
+
1056
+ bootstrapConfigTemplate , err := external .Get (ctx , mgmtClient , mpClass .Template .Bootstrap .Ref , clusterClass .Namespace )
1057
+ g .Expect (err ).ToNot (HaveOccurred ())
1058
+ res .BootstrapConfigTemplateByMachinePoolClass [mpClass .Class ] = bootstrapConfigTemplate
1059
+ }
1060
+
1065
1061
return res
1066
1062
}
1067
1063
@@ -1082,8 +1078,8 @@ type clusterObjects struct {
1082
1078
InfrastructureMachineTemplateByMachineDeployment map [string ]* unstructured.Unstructured
1083
1079
BootstrapConfigTemplateByMachineDeployment map [string ]* unstructured.Unstructured
1084
1080
1085
- InfrastructureMachinePoolTemplateByMachinePool map [string ]* unstructured.Unstructured
1086
- BootstrapConfigTemplateByMachinePool map [string ]* unstructured.Unstructured
1081
+ InfrastructureMachinePoolByMachinePool map [string ]* unstructured.Unstructured
1082
+ BootstrapConfigByMachinePool map [string ]* unstructured.Unstructured
1087
1083
1088
1084
InfrastructureMachineByMachine map [string ]* unstructured.Unstructured
1089
1085
BootstrapConfigByMachine map [string ]* unstructured.Unstructured
@@ -1102,6 +1098,8 @@ func getClusterObjects(ctx context.Context, g Gomega, clusterProxy framework.Clu
1102
1098
InfrastructureMachineTemplateByMachineDeployment : map [string ]* unstructured.Unstructured {},
1103
1099
BootstrapConfigByMachine : map [string ]* unstructured.Unstructured {},
1104
1100
InfrastructureMachineByMachine : map [string ]* unstructured.Unstructured {},
1101
+ BootstrapConfigByMachinePool : map [string ]* unstructured.Unstructured {},
1102
+ InfrastructureMachinePoolByMachinePool : map [string ]* unstructured.Unstructured {},
1105
1103
}
1106
1104
var err error
1107
1105
@@ -1170,6 +1168,26 @@ func getClusterObjects(ctx context.Context, g Gomega, clusterProxy framework.Clu
1170
1168
}
1171
1169
}
1172
1170
1171
+ // MachinePools.
1172
+ for _ , mpTopology := range cluster .Spec .Topology .Workers .MachinePools {
1173
+ // Get MachinePool for the current MachinePoolTopology.
1174
+ mpList := & expv1.MachinePoolList {}
1175
+ g .Expect (mgmtClient .List (ctx , mpList , client .InNamespace (cluster .Namespace ), client.MatchingLabels {
1176
+ clusterv1 .ClusterTopologyMachinePoolNameLabel : mpTopology .Name ,
1177
+ })).To (Succeed ())
1178
+ g .Expect (mpList .Items ).To (HaveLen (1 ), fmt .Sprintf ("expected one MachinePool for topology %q, but got %d" , mpTopology .Name , len (mpList .Items )))
1179
+ mp := mpList .Items [0 ]
1180
+ res .MachinePools = append (res .MachinePools , & mp )
1181
+
1182
+ bootstrapConfig , err := external .Get (ctx , mgmtClient , mp .Spec .Template .Spec .Bootstrap .ConfigRef , cluster .Namespace )
1183
+ g .Expect (err ).ToNot (HaveOccurred ())
1184
+ res .BootstrapConfigByMachinePool [mp .Name ] = bootstrapConfig
1185
+
1186
+ infrastructureMachinePool , err := external .Get (ctx , mgmtClient , & mp .Spec .Template .Spec .InfrastructureRef , cluster .Namespace )
1187
+ g .Expect (err ).ToNot (HaveOccurred ())
1188
+ res .InfrastructureMachinePoolByMachinePool [mp .Name ] = infrastructureMachinePool
1189
+ }
1190
+
1173
1191
return res
1174
1192
}
1175
1193
0 commit comments