File tree 2 files changed +23
-1
lines changed
controlplane/kubeadm/api/v1beta1 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -500,7 +500,11 @@ func (in *KubeadmControlPlane) validateCoreDNSVersion(prev *KubeadmControlPlane)
500
500
)
501
501
return allErrs
502
502
}
503
-
503
+ // If the versions are equal return here without error.
504
+ // This allows an upgrade where the version of CoreDNS in use is not supported by the migration tool.
505
+ if toVersion .Equals (fromVersion ) {
506
+ return allErrs
507
+ }
504
508
if err := migration .ValidUpMigration (fromVersion .String (), toVersion .String ()); err != nil {
505
509
allErrs = append (
506
510
allErrs ,
Original file line number Diff line number Diff line change @@ -484,6 +484,13 @@ func TestKubeadmControlPlaneValidateUpdate(t *testing.T) {
484
484
ImageTag : "v1.6.6_foobar.2" ,
485
485
},
486
486
}
487
+ validUnsupportedCoreDNSVersion := dns .DeepCopy ()
488
+ validUnsupportedCoreDNSVersion .Spec .KubeadmConfigSpec .ClusterConfiguration .DNS = bootstrapv1.DNS {
489
+ ImageMeta : bootstrapv1.ImageMeta {
490
+ ImageRepository : "gcr.io/capi-test" ,
491
+ ImageTag : "v99.99.99" ,
492
+ },
493
+ }
487
494
488
495
unsetCoreDNSToVersion := dns .DeepCopy ()
489
496
unsetCoreDNSToVersion .Spec .KubeadmConfigSpec .ClusterConfiguration .DNS = bootstrapv1.DNS {
@@ -744,6 +751,16 @@ func TestKubeadmControlPlaneValidateUpdate(t *testing.T) {
744
751
before : before ,
745
752
kcp : dnsBuildTag ,
746
753
},
754
+ {
755
+ name : "should succeed when using the same CoreDNS version" ,
756
+ before : dns ,
757
+ kcp : dns .DeepCopy (),
758
+ },
759
+ {
760
+ name : "should succeed when using the same CoreDNS version - not supported" ,
761
+ before : validUnsupportedCoreDNSVersion ,
762
+ kcp : validUnsupportedCoreDNSVersion ,
763
+ },
747
764
{
748
765
name : "should fail when using an invalid DNS build" ,
749
766
expectErr : true ,
@@ -756,6 +773,7 @@ func TestKubeadmControlPlaneValidateUpdate(t *testing.T) {
756
773
before : dns ,
757
774
kcp : dnsInvalidCoreDNSToVersion ,
758
775
},
776
+
759
777
{
760
778
name : "should fail when making a change to the cluster config's certificatesDir" ,
761
779
expectErr : true ,
You can’t perform that action at this time.
0 commit comments