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