kubeadm: add system verification check(including kernel version check) for upgrade

This commit is contained in:
Paco Xu 2024-12-26 11:48:05 +08:00
parent 35f584187a
commit 2c305d71f0
3 changed files with 15 additions and 0 deletions

View File

@ -72,6 +72,9 @@ func runPreflight(c workflow.RunData) error {
if err := preflight.RunRootCheckOnly(ignorePreflightErrors); err != nil {
return err
}
if err := preflight.RunUpgradeChecks(ignorePreflightErrors); err != nil {
return err
}
// Run CoreDNS migration check.
if err := upgrade.RunCoreDNSMigrationCheck(client, ignorePreflightErrors); err != nil {

View File

@ -54,6 +54,9 @@ func runPreflight(c workflow.RunData) error {
if err := preflight.RunRootCheckOnly(data.IgnorePreflightErrors()); err != nil {
return err
}
if err := preflight.RunUpgradeChecks(data.IgnorePreflightErrors()); err != nil {
return err
}
// If this is a control-plane node, pull the basic images.
if data.IsControlPlaneNode() {

View File

@ -1091,6 +1091,15 @@ func RunRootCheckOnly(ignorePreflightErrors sets.Set[string]) error {
return RunChecks(checks, os.Stderr, ignorePreflightErrors)
}
// RunUpgradeChecks initializes checks slice of structs and call RunChecks
func RunUpgradeChecks(ignorePreflightErrors sets.Set[string]) error {
checks := []Checker{
SystemVerificationCheck{},
}
return RunChecks(checks, os.Stderr, ignorePreflightErrors)
}
// RunPullImagesCheck will pull images kubeadm needs if they are not found on the system
func RunPullImagesCheck(execer utilsexec.Interface, cfg *kubeadmapi.InitConfiguration, ignorePreflightErrors sets.Set[string]) error {
containerRuntime := utilruntime.NewContainerRuntime(cfg.NodeRegistration.CRISocket)