Skip to content

Commit 2c305d7

Browse files
committed
kubeadm: add system verification check(including kernel version check) for upgrade
1 parent 35f5841 commit 2c305d7

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

cmd/kubeadm/app/cmd/phases/upgrade/apply/preflight.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ func runPreflight(c workflow.RunData) error {
7272
if err := preflight.RunRootCheckOnly(ignorePreflightErrors); err != nil {
7373
return err
7474
}
75+
if err := preflight.RunUpgradeChecks(ignorePreflightErrors); err != nil {
76+
return err
77+
}
7578

7679
// Run CoreDNS migration check.
7780
if err := upgrade.RunCoreDNSMigrationCheck(client, ignorePreflightErrors); err != nil {

cmd/kubeadm/app/cmd/phases/upgrade/node/preflight.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ func runPreflight(c workflow.RunData) error {
5454
if err := preflight.RunRootCheckOnly(data.IgnorePreflightErrors()); err != nil {
5555
return err
5656
}
57+
if err := preflight.RunUpgradeChecks(data.IgnorePreflightErrors()); err != nil {
58+
return err
59+
}
5760

5861
// If this is a control-plane node, pull the basic images.
5962
if data.IsControlPlaneNode() {

cmd/kubeadm/app/preflight/checks.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,6 +1091,15 @@ func RunRootCheckOnly(ignorePreflightErrors sets.Set[string]) error {
10911091
return RunChecks(checks, os.Stderr, ignorePreflightErrors)
10921092
}
10931093

1094+
// RunUpgradeChecks initializes checks slice of structs and call RunChecks
1095+
func RunUpgradeChecks(ignorePreflightErrors sets.Set[string]) error {
1096+
checks := []Checker{
1097+
SystemVerificationCheck{},
1098+
}
1099+
1100+
return RunChecks(checks, os.Stderr, ignorePreflightErrors)
1101+
}
1102+
10941103
// RunPullImagesCheck will pull images kubeadm needs if they are not found on the system
10951104
func RunPullImagesCheck(execer utilsexec.Interface, cfg *kubeadmapi.InitConfiguration, ignorePreflightErrors sets.Set[string]) error {
10961105
containerRuntime := utilruntime.NewContainerRuntime(cfg.NodeRegistration.CRISocket)

0 commit comments

Comments
 (0)