mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-02 00:07:50 +00:00
Merge pull request #130045 from carlory/kubeadm-exec-check
kubeadm: update preflight check
This commit is contained in:
commit
3e4e2437e4
@ -19,6 +19,8 @@ limitations under the License.
|
||||
|
||||
package preflight
|
||||
|
||||
import utilsexec "k8s.io/utils/exec"
|
||||
|
||||
// This is a MacOS stub
|
||||
|
||||
// Check number of memory required by kubeadm
|
||||
@ -26,3 +28,9 @@ package preflight
|
||||
func (mc MemCheck) Check() (warnings, errorList []error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// addExecChecks adds checks that verify if certain binaries are in PATH
|
||||
// No-op for Darwin (MacOS).
|
||||
func addExecChecks(checks []Checker, _ utilsexec.Interface, _ string) []Checker {
|
||||
return checks
|
||||
}
|
||||
|
@ -88,5 +88,8 @@ func addExecChecks(checks []Checker, execer utilsexec.Interface, k8sVersion stri
|
||||
|
||||
// kubelet requires mount to be present in PATH for in-tree volume plugins.
|
||||
checks = append(checks, InPathCheck{executable: "mount", mandatory: true, exec: execer})
|
||||
|
||||
// kubeadm requires cp to be present in PATH for copying etcd directories.
|
||||
checks = append(checks, InPathCheck{executable: "cp", mandatory: true, exec: execer})
|
||||
return checks
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ package preflight
|
||||
|
||||
import (
|
||||
system "k8s.io/system-validators/validators"
|
||||
utilsexec "k8s.io/utils/exec"
|
||||
)
|
||||
|
||||
// addOSValidator adds a new OSValidator
|
||||
@ -47,9 +46,3 @@ func addIPv4Checks(checks []Checker) []Checker {
|
||||
func addSwapCheck(checks []Checker) []Checker {
|
||||
return checks
|
||||
}
|
||||
|
||||
// addExecChecks adds checks that verify if certain binaries are in PATH
|
||||
// No-op for Darwin (MacOS), Windows.
|
||||
func addExecChecks(checks []Checker, _ utilsexec.Interface, _ string) []Checker {
|
||||
return checks
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ package preflight
|
||||
import (
|
||||
"github.com/pkg/errors"
|
||||
"golang.org/x/sys/windows"
|
||||
utilsexec "k8s.io/utils/exec"
|
||||
)
|
||||
|
||||
// Check validates if a user has elevated (administrator) privileges.
|
||||
@ -38,3 +39,10 @@ func (ipuc IsPrivilegedUserCheck) Check() (warnings, errorList []error) {
|
||||
func (mc MemCheck) Check() (warnings, errorList []error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// addExecChecks adds checks that verify if certain binaries are in PATH.
|
||||
func addExecChecks(checks []Checker, execer utilsexec.Interface, _ string) []Checker {
|
||||
// kubeadm requires xcopy to be present in PATH for copying etcd directories.
|
||||
checks = append(checks, InPathCheck{executable: "xcopy", mandatory: true, exec: execer})
|
||||
return checks
|
||||
}
|
||||
|
@ -160,6 +160,13 @@ func GetInitSystem() (InitSystem, error) {
|
||||
}
|
||||
_, err = exec.LookPath("openrc")
|
||||
if err == nil {
|
||||
binaries := []string{"rc-service", "rc-update"}
|
||||
for _, binary := range binaries {
|
||||
_, err = exec.LookPath(binary)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "openrc detected, but missing required binary: %s", binary)
|
||||
}
|
||||
}
|
||||
return &OpenRCInitSystem{}, nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user