Skip to content

Commit

Permalink
Merge pull request #5986 from killianmuldoon/fix/kcp-coredns-check
Browse files Browse the repository at this point in the history
🐛  Allow KCP to Update when CoreDNS version doesn't change
  • Loading branch information
k8s-ci-robot authored Jan 27, 2022
2 parents c4b4c29 + d57f0f6 commit 72ef359
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,11 @@ func (in *KubeadmControlPlane) validateCoreDNSVersion(prev *KubeadmControlPlane)
)
return allErrs
}

// If the versions are equal return here without error.
// This allows an upgrade where the version of CoreDNS in use is not supported by the migration tool.
if toVersion.Equals(fromVersion) {
return allErrs
}
if err := migration.ValidUpMigration(fromVersion.String(), toVersion.String()); err != nil {
allErrs = append(
allErrs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,13 @@ func TestKubeadmControlPlaneValidateUpdate(t *testing.T) {
ImageTag: "v1.6.6_foobar.2",
},
}
validUnsupportedCoreDNSVersion := dns.DeepCopy()
validUnsupportedCoreDNSVersion.Spec.KubeadmConfigSpec.ClusterConfiguration.DNS = bootstrapv1.DNS{
ImageMeta: bootstrapv1.ImageMeta{
ImageRepository: "gcr.io/capi-test",
ImageTag: "v99.99.99",
},
}

unsetCoreDNSToVersion := dns.DeepCopy()
unsetCoreDNSToVersion.Spec.KubeadmConfigSpec.ClusterConfiguration.DNS = bootstrapv1.DNS{
Expand Down Expand Up @@ -744,6 +751,16 @@ func TestKubeadmControlPlaneValidateUpdate(t *testing.T) {
before: before,
kcp: dnsBuildTag,
},
{
name: "should succeed when using the same CoreDNS version",
before: dns,
kcp: dns.DeepCopy(),
},
{
name: "should succeed when using the same CoreDNS version - not supported",
before: validUnsupportedCoreDNSVersion,
kcp: validUnsupportedCoreDNSVersion,
},
{
name: "should fail when using an invalid DNS build",
expectErr: true,
Expand All @@ -756,6 +773,7 @@ func TestKubeadmControlPlaneValidateUpdate(t *testing.T) {
before: dns,
kcp: dnsInvalidCoreDNSToVersion,
},

{
name: "should fail when making a change to the cluster config's certificatesDir",
expectErr: true,
Expand Down

0 comments on commit 72ef359

Please sign in to comment.