retain corefile when migration fails

This commit is contained in:
Sandeep Rajan 2019-10-29 11:01:25 -04:00
parent badcd4af3f
commit 7074f28dd2
2 changed files with 7 additions and 2 deletions

View File

@ -238,7 +238,12 @@ func createCoreDNSAddon(deploymentBytes, serviceBytes, configBytes []byte, clien
}
if IsCoreDNSConfigMapMigrationRequired(corefile) {
if err := migrateCoreDNSCorefile(client, coreDNSConfigMap, corefile, currentInstalledCoreDNSVersion); err != nil {
return err
// Errors in Corefile Migration is verified during preflight checks. This part will be executed when a user has chosen
// to ignore preflight check errors.
klog.Warningf("the CoreDNS Configuration was not migrated: %v. The existing CoreDNS Corefile configuration has been retained.", err)
if err := apiclient.CreateOrRetainConfigMap(client, coreDNSConfigMap, kubeadmconstants.CoreDNSConfigMap); err != nil {
return err
}
}
} else {
if err := apiclient.CreateOrUpdateConfigMap(client, coreDNSConfigMap); err != nil {

View File

@ -108,7 +108,7 @@ func checkMigration(client clientset.Interface) error {
_, err = migration.Migrate(currentInstalledCoreDNSversion, kubeadmconstants.CoreDNSVersion, corefile, false)
if err != nil {
return err
return errors.Wrap(err, "the CoreDNS configuration will not be migrated, and may be incompatible with the upgraded version of CoreDNS")
}
return nil
}