Merge pull request #88482 from rajansandeep/fixunsupported

[kubeadm]: Fix the CoreDNS preflight check for unsupported plugins
This commit is contained in:
Kubernetes Prow Robot
2020-02-26 19:39:33 -08:00
committed by GitHub
2 changed files with 11 additions and 9 deletions

View File

@@ -17,6 +17,7 @@ limitations under the License.
package upgrade
import (
"fmt"
"os"
"github.com/coredns/corefile-migration/migration"
@@ -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
}