@@ -538,6 +538,57 @@ func TestMatchInitOrJoinConfiguration(t *testing.T) {
538
538
g .Expect (match ).To (BeTrue ())
539
539
g .Expect (diff ).To (BeEmpty ())
540
540
})
541
+ t .Run ("returns true if InitConfiguration is equal" , func (t * testing.T ) {
542
+ g := NewWithT (t )
543
+ kcp := & controlplanev1.KubeadmControlPlane {
544
+ Spec : controlplanev1.KubeadmControlPlaneSpec {
545
+ KubeadmConfigSpec : bootstrapv1.KubeadmConfigSpec {
546
+ ClusterConfiguration : & bootstrapv1.ClusterConfiguration {},
547
+ InitConfiguration : nil ,
548
+ JoinConfiguration : & bootstrapv1.JoinConfiguration {},
549
+ },
550
+ },
551
+ }
552
+ m := & clusterv1.Machine {
553
+ TypeMeta : metav1.TypeMeta {
554
+ Kind : "KubeadmConfig" ,
555
+ APIVersion : clusterv1 .GroupVersion .String (),
556
+ },
557
+ ObjectMeta : metav1.ObjectMeta {
558
+ Namespace : "default" ,
559
+ Name : "test" ,
560
+ },
561
+ Spec : clusterv1.MachineSpec {
562
+ Bootstrap : clusterv1.Bootstrap {
563
+ ConfigRef : & corev1.ObjectReference {
564
+ Kind : "KubeadmConfig" ,
565
+ Namespace : "default" ,
566
+ Name : "test" ,
567
+ APIVersion : bootstrapv1 .GroupVersion .String (),
568
+ },
569
+ },
570
+ },
571
+ }
572
+ machineConfigs := map [string ]* bootstrapv1.KubeadmConfig {
573
+ m .Name : {
574
+ TypeMeta : metav1.TypeMeta {
575
+ Kind : "KubeadmConfig" ,
576
+ APIVersion : bootstrapv1 .GroupVersion .String (),
577
+ },
578
+ ObjectMeta : metav1.ObjectMeta {
579
+ Namespace : "default" ,
580
+ Name : "test" ,
581
+ },
582
+ Spec : bootstrapv1.KubeadmConfigSpec {
583
+ InitConfiguration : & bootstrapv1.InitConfiguration {},
584
+ },
585
+ },
586
+ }
587
+ match , diff , err := matchInitOrJoinConfiguration (machineConfigs [m .Name ], kcp )
588
+ g .Expect (err ).ToNot (HaveOccurred ())
589
+ g .Expect (match ).To (BeTrue ())
590
+ g .Expect (diff ).To (BeEmpty ())
591
+ })
541
592
t .Run ("returns true if InitConfiguration is equal" , func (t * testing.T ) {
542
593
g := NewWithT (t )
543
594
kcp := & controlplanev1.KubeadmControlPlane {
0 commit comments