Skip to content

Commit

Permalink
Merge pull request #129401 from pacoxu/kubeadm-upgrade-precheck
Browse files Browse the repository at this point in the history
kubeadm: add kernel version check for upgrade
  • Loading branch information
k8s-ci-robot authored Jan 2, 2025
2 parents 1c2b2cc + 2c305d7 commit 3c22994
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/kubeadm/app/cmd/phases/upgrade/apply/preflight.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
3 changes: 3 additions & 0 deletions cmd/kubeadm/app/cmd/phases/upgrade/node/preflight.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
9 changes: 9 additions & 0 deletions cmd/kubeadm/app/preflight/checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3c22994

Please sign in to comment.