mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 04:06:03 +00:00
Merge pull request #88482 from rajansandeep/fixunsupported
[kubeadm]: Fix the CoreDNS preflight check for unsupported plugins
This commit is contained in:
commit
e61a878e6d
@ -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.")
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user