Merge pull request #97919 from neolit123/1.21-fix-coredns-migration-preflight

kubeadm: trim leading "v" when running CoreDNS migration preflight
This commit is contained in:
Kubernetes Prow Robot 2021-01-12 06:12:25 -08:00 committed by GitHub
commit bd947dfc65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -382,6 +382,7 @@ func isCoreDNSConfigMapMigrationRequired(corefile, currentInstalledCoreDNSVersio
if currentInstalledCoreDNSVersion == "" { if currentInstalledCoreDNSVersion == "" {
return isMigrationRequired, nil return isMigrationRequired, nil
} }
currentInstalledCoreDNSVersion = strings.TrimLeft(currentInstalledCoreDNSVersion, "v")
deprecated, err := migration.Deprecated(currentInstalledCoreDNSVersion, strings.TrimLeft(kubeadmconstants.CoreDNSVersion, "v"), corefile) deprecated, err := migration.Deprecated(currentInstalledCoreDNSVersion, strings.TrimLeft(kubeadmconstants.CoreDNSVersion, "v"), corefile)
if err != nil { if err != nil {
return isMigrationRequired, errors.Wrap(err, "unable to get list of changes to the configuration.") return isMigrationRequired, errors.Wrap(err, "unable to get list of changes to the configuration.")

View File

@ -90,6 +90,8 @@ func checkUnsupportedPlugins(client clientset.Interface) error {
if err != nil { if err != nil {
return err return err
} }
currentInstalledCoreDNSversion = strings.TrimLeft(currentInstalledCoreDNSversion, "v")
unsupportedCoreDNS, err := migration.Unsupported(currentInstalledCoreDNSversion, currentInstalledCoreDNSversion, corefile) unsupportedCoreDNS, err := migration.Unsupported(currentInstalledCoreDNSversion, currentInstalledCoreDNSversion, corefile)
if err != nil { if err != nil {
return err return err
@ -117,6 +119,7 @@ func checkMigration(client clientset.Interface) error {
return err return err
} }
currentInstalledCoreDNSversion = strings.TrimLeft(currentInstalledCoreDNSversion, "v")
_, err = migration.Migrate(currentInstalledCoreDNSversion, strings.TrimLeft(kubeadmconstants.CoreDNSVersion, "v"), corefile, false) _, err = migration.Migrate(currentInstalledCoreDNSversion, strings.TrimLeft(kubeadmconstants.CoreDNSVersion, "v"), corefile, false)
if err != nil { if err != nil {
return errors.Wrap(err, "CoreDNS will not be upgraded") return errors.Wrap(err, "CoreDNS will not be upgraded")