Skip to content

Commit

Permalink
fix the coredns preflight check for unsupported plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
rajansandeep committed Feb 26, 2020
1 parent 4e26c35 commit ca5d394
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cmd/kubeadm/app/phases/addons/dns/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ func migrateCoreDNSCorefile(client clientset.Interface, cm *v1.ConfigMap, corefi
}, metav1.UpdateOptions{}); err != nil {
return errors.Wrap(err, "unable to update the CoreDNS ConfigMap")
}
fmt.Println("[addons]: Migrating CoreDNS Corefile")
fmt.Println("[addons] Migrating CoreDNS Corefile")
changes, err := migration.Deprecated(currentInstalledCoreDNSVersion, kubeadmconstants.CoreDNSVersion, corefile)
if err != nil {
return errors.Wrap(err, "unable to get list of changes to the configuration.")
Expand Down
18 changes: 10 additions & 8 deletions cmd/kubeadm/app/phases/upgrade/preflight.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package upgrade

import (
"fmt"
"os"

"github.com/coredns/corefile-migration/migration"
Expand Down Expand Up @@ -80,20 +81,21 @@ func checkUnsupportedPlugins(client clientset.Interface) error {
if err != nil {
return err
}
unsupportedCoreDNS, err := migration.Unsupported(currentInstalledCoreDNSversion, kubeadmconstants.CoreDNSVersion, corefile)
unsupportedCoreDNS, err := migration.Unsupported(currentInstalledCoreDNSversion, currentInstalledCoreDNSversion, corefile)
if err != nil {
return err
}
if unsupportedCoreDNS != nil {
var UnsupportedPlugins, UnsupportedVersion string
var UnsupportedPlugins []string
for _, unsup := range unsupportedCoreDNS {
UnsupportedPlugins = unsup.Plugin
UnsupportedVersion = unsup.Version

}
if UnsupportedPlugins != "" || UnsupportedVersion != "" {
return errors.New("there are unsupported plugins in the CoreDNS Corefile")
UnsupportedPlugins = append(UnsupportedPlugins, unsup.ToString())
}
fmt.Println("[preflight] The corefile contains plugins that kubeadm/CoreDNS does not know how to migrate. " +
"Each plugin listed should be manually verified for compatibility with the newer version of CoreDNS. " +
"Once ready, the upgrade can be initiated by skipping the preflight check. During the upgrade, " +
"kubeadm will migrate the configuration while leaving the listed plugin configs untouched, " +
"but cannot guarantee that they will work with the newer version of CoreDNS.")
return errors.Errorf("CoreDNS cannot migrate the following plugins:\n%s", UnsupportedPlugins)
}
return nil
}
Expand Down

0 comments on commit ca5d394

Please sign in to comment.