From b1ee8c8b82da0fb3ee61e98b00b0fef1add71c7b Mon Sep 17 00:00:00 2001 From: Paco Xu Date: Sat, 25 Feb 2023 21:53:28 +0800 Subject: [PATCH] kubeadm: no need to check if target coredns version is not changed --- cmd/kubeadm/app/phases/addons/dns/dns.go | 6 +++++- cmd/kubeadm/app/phases/upgrade/preflight.go | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/cmd/kubeadm/app/phases/addons/dns/dns.go b/cmd/kubeadm/app/phases/addons/dns/dns.go index 3677dbb5b76..474944a4882 100644 --- a/cmd/kubeadm/app/phases/addons/dns/dns.go +++ b/cmd/kubeadm/app/phases/addons/dns/dns.go @@ -285,7 +285,11 @@ func isCoreDNSConfigMapMigrationRequired(corefile, currentInstalledCoreDNSVersio return isMigrationRequired, nil } currentInstalledCoreDNSVersion = strings.TrimLeft(currentInstalledCoreDNSVersion, "v") - deprecated, err := migration.Deprecated(currentInstalledCoreDNSVersion, strings.TrimLeft(kubeadmconstants.CoreDNSVersion, "v"), corefile) + targetCoreDNSVersion := strings.TrimLeft(kubeadmconstants.CoreDNSVersion, "v") + if currentInstalledCoreDNSVersion == targetCoreDNSVersion { + return isMigrationRequired, nil + } + deprecated, err := migration.Deprecated(currentInstalledCoreDNSVersion, targetCoreDNSVersion, corefile) if err != nil { return isMigrationRequired, errors.Wrap(err, "unable to get list of changes to the configuration.") } diff --git a/cmd/kubeadm/app/phases/upgrade/preflight.go b/cmd/kubeadm/app/phases/upgrade/preflight.go index bb5ea0949a7..6ecb6683aa3 100644 --- a/cmd/kubeadm/app/phases/upgrade/preflight.go +++ b/cmd/kubeadm/app/phases/upgrade/preflight.go @@ -81,7 +81,11 @@ func checkUnsupportedPlugins(client clientset.Interface) error { } currentInstalledCoreDNSversion = strings.TrimLeft(currentInstalledCoreDNSversion, "v") - unsupportedCoreDNS, err := migration.Unsupported(currentInstalledCoreDNSversion, currentInstalledCoreDNSversion, corefile) + targetCoreDNSVersion := strings.TrimLeft(kubeadmconstants.CoreDNSVersion, "v") + if currentInstalledCoreDNSversion == targetCoreDNSVersion { + return nil + } + unsupportedCoreDNS, err := migration.Unsupported(currentInstalledCoreDNSversion, targetCoreDNSVersion, corefile) if err != nil { return err }