Skip to content

Commit

Permalink
retain corefile when migration fails
Browse files Browse the repository at this point in the history
  • Loading branch information
rajansandeep committed Oct 29, 2019
1 parent badcd4a commit 7074f28
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion cmd/kubeadm/app/phases/addons/dns/dns.go
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion cmd/kubeadm/app/phases/upgrade/preflight.go
Expand Up @@ -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
}

0 comments on commit 7074f28

Please sign in to comment.