File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
controlplane/kubeadm/api/v1beta1 Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -475,7 +475,11 @@ func (in *KubeadmControlPlane) validateCoreDNSVersion(prev *KubeadmControlPlane)
475475 )
476476 return allErrs
477477 }
478-
478+ // If the versions are equal return here without error.
479+ // This allows an upgrade where the version of CoreDNS in use is not supported by the migration tool.
480+ if toVersion .Equals (fromVersion ) {
481+ return allErrs
482+ }
479483 if err := migration .ValidUpMigration (fromVersion .String (), toVersion .String ()); err != nil {
480484 allErrs = append (
481485 allErrs ,
Original file line number Diff line number Diff line change @@ -447,6 +447,13 @@ func TestKubeadmControlPlaneValidateUpdate(t *testing.T) {
447447 ImageTag : "v1.6.6_foobar.2" ,
448448 },
449449 }
450+ validUnsupportedCoreDNSVersion := dns .DeepCopy ()
451+ validUnsupportedCoreDNSVersion .Spec .KubeadmConfigSpec .ClusterConfiguration .DNS = bootstrapv1.DNS {
452+ ImageMeta : bootstrapv1.ImageMeta {
453+ ImageRepository : "gcr.io/capi-test" ,
454+ ImageTag : "v99.99.99" ,
455+ },
456+ }
450457
451458 unsetCoreDNSToVersion := dns .DeepCopy ()
452459 unsetCoreDNSToVersion .Spec .KubeadmConfigSpec .ClusterConfiguration .DNS = bootstrapv1.DNS {
@@ -688,6 +695,16 @@ func TestKubeadmControlPlaneValidateUpdate(t *testing.T) {
688695 before : before ,
689696 kcp : dnsBuildTag ,
690697 },
698+ {
699+ name : "should succeed when using the same CoreDNS version" ,
700+ before : dns ,
701+ kcp : dns .DeepCopy (),
702+ },
703+ {
704+ name : "should succeed when using the same CoreDNS version - not supported" ,
705+ before : validUnsupportedCoreDNSVersion ,
706+ kcp : validUnsupportedCoreDNSVersion ,
707+ },
691708 {
692709 name : "should fail when using an invalid DNS build" ,
693710 expectErr : true ,
@@ -700,6 +717,7 @@ func TestKubeadmControlPlaneValidateUpdate(t *testing.T) {
700717 before : dns ,
701718 kcp : dnsInvalidCoreDNSToVersion ,
702719 },
720+
703721 {
704722 name : "should fail when making a change to the cluster config's certificatesDir" ,
705723 expectErr : true ,
You can’t perform that action at this time.
0 commit comments