mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 15:25:57 +00:00
remove the ipvs checks from the preflight checks
Signed-off-by: Yassine TIJANI <ytijani@vmware.com>
This commit is contained in:
parent
5df8781ee3
commit
05326f8489
@ -77,9 +77,7 @@
|
|||||||
"k8s.io/kubernetes/pkg/util/conntrack",
|
"k8s.io/kubernetes/pkg/util/conntrack",
|
||||||
"k8s.io/kubernetes/pkg/util/dbus",
|
"k8s.io/kubernetes/pkg/util/dbus",
|
||||||
"k8s.io/kubernetes/pkg/util/hash",
|
"k8s.io/kubernetes/pkg/util/hash",
|
||||||
"k8s.io/kubernetes/pkg/util/ipset",
|
|
||||||
"k8s.io/kubernetes/pkg/util/iptables",
|
"k8s.io/kubernetes/pkg/util/iptables",
|
||||||
"k8s.io/kubernetes/pkg/util/ipvs",
|
|
||||||
"k8s.io/kubernetes/pkg/util/metrics",
|
"k8s.io/kubernetes/pkg/util/metrics",
|
||||||
"k8s.io/kubernetes/pkg/util/parsers",
|
"k8s.io/kubernetes/pkg/util/parsers",
|
||||||
"k8s.io/kubernetes/pkg/util/sysctl",
|
"k8s.io/kubernetes/pkg/util/sysctl",
|
||||||
@ -110,7 +108,6 @@
|
|||||||
"github.com/coreos/etcd/pkg/transport",
|
"github.com/coreos/etcd/pkg/transport",
|
||||||
"github.com/davecgh/go-spew/spew",
|
"github.com/davecgh/go-spew/spew",
|
||||||
"github.com/docker/distribution/reference",
|
"github.com/docker/distribution/reference",
|
||||||
"github.com/docker/libnetwork/ipvs",
|
|
||||||
"github.com/godbus/dbus",
|
"github.com/godbus/dbus",
|
||||||
"github.com/gogo/protobuf/proto",
|
"github.com/gogo/protobuf/proto",
|
||||||
"github.com/gogo/protobuf/sortkeys",
|
"github.com/gogo/protobuf/sortkeys",
|
||||||
|
@ -99,10 +99,6 @@ func runPreflight(c workflow.RunData) error {
|
|||||||
|
|
||||||
// Continue with more specific checks based on the init configuration
|
// Continue with more specific checks based on the init configuration
|
||||||
klog.V(1).Infoln("[preflight] Running configuration dependant checks")
|
klog.V(1).Infoln("[preflight] Running configuration dependant checks")
|
||||||
if err := preflight.RunOptionalJoinNodeChecks(utilsexec.New(), &initCfg.ClusterConfiguration, j.IgnorePreflightErrors()); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if j.Cfg().ControlPlane != nil {
|
if j.Cfg().ControlPlane != nil {
|
||||||
// Checks if the cluster configuration supports
|
// Checks if the cluster configuration supports
|
||||||
// joining a new control plane instance and if all the necessary certificates are provided
|
// joining a new control plane instance and if all the necessary certificates are provided
|
||||||
|
@ -26,7 +26,6 @@ go_library(
|
|||||||
"//cmd/kubeadm/app/util/system:go_default_library",
|
"//cmd/kubeadm/app/util/system:go_default_library",
|
||||||
"//cmd/kubeadm/app/version:go_default_library",
|
"//cmd/kubeadm/app/version:go_default_library",
|
||||||
"//pkg/registry/core/service/ipallocator:go_default_library",
|
"//pkg/registry/core/service/ipallocator:go_default_library",
|
||||||
"//pkg/util/ipvs:go_default_library",
|
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/util/net:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/util/net:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
|
||||||
"//staging/src/k8s.io/apimachinery/pkg/util/version:go_default_library",
|
"//staging/src/k8s.io/apimachinery/pkg/util/version:go_default_library",
|
||||||
@ -39,8 +38,6 @@ go_library(
|
|||||||
] + select({
|
] + select({
|
||||||
"@io_bazel_rules_go//go/platform:linux": [
|
"@io_bazel_rules_go//go/platform:linux": [
|
||||||
"//cmd/kubeadm/app/util:go_default_library",
|
"//cmd/kubeadm/app/util:go_default_library",
|
||||||
"//pkg/proxy/ipvs:go_default_library",
|
|
||||||
"//pkg/util/ipset:go_default_library",
|
|
||||||
],
|
],
|
||||||
"//conditions:default": [],
|
"//conditions:default": [],
|
||||||
}),
|
}),
|
||||||
|
@ -49,7 +49,6 @@ import (
|
|||||||
"k8s.io/kubernetes/cmd/kubeadm/app/util/system"
|
"k8s.io/kubernetes/cmd/kubeadm/app/util/system"
|
||||||
kubeadmversion "k8s.io/kubernetes/cmd/kubeadm/app/version"
|
kubeadmversion "k8s.io/kubernetes/cmd/kubeadm/app/version"
|
||||||
"k8s.io/kubernetes/pkg/registry/core/service/ipallocator"
|
"k8s.io/kubernetes/pkg/registry/core/service/ipallocator"
|
||||||
ipvsutil "k8s.io/kubernetes/pkg/util/ipvs"
|
|
||||||
utilsexec "k8s.io/utils/exec"
|
utilsexec "k8s.io/utils/exec"
|
||||||
utilsnet "k8s.io/utils/net"
|
utilsnet "k8s.io/utils/net"
|
||||||
)
|
)
|
||||||
@ -865,20 +864,10 @@ func (ncc NumCPUCheck) Check() (warnings, errorList []error) {
|
|||||||
return warnings, errorList
|
return warnings, errorList
|
||||||
}
|
}
|
||||||
|
|
||||||
// IPVSProxierCheck tests if IPVS proxier can be used.
|
|
||||||
type IPVSProxierCheck struct {
|
|
||||||
exec utilsexec.Interface
|
|
||||||
}
|
|
||||||
|
|
||||||
// Name returns label for IPVSProxierCheck
|
|
||||||
func (r IPVSProxierCheck) Name() string {
|
|
||||||
return "IPVSProxierCheck"
|
|
||||||
}
|
|
||||||
|
|
||||||
// RunInitNodeChecks executes all individual, applicable to control-plane node checks.
|
// RunInitNodeChecks executes all individual, applicable to control-plane node checks.
|
||||||
// The boolean flag 'isSecondaryControlPlane' controls whether we are running checks in a --join-control-plane scenario.
|
// The boolean flag 'isSecondaryControlPlane' controls whether we are running checks in a --join-control-plane scenario.
|
||||||
// The boolean flag 'downloadCerts' controls whether we should skip checks on certificates because we are downloading them.
|
// The boolean flag 'downloadCerts' controls whether we should skip checks on certificates because we are downloading them.
|
||||||
// If the flag is set to true we should skip checks already executed by RunJoinNodeChecks and RunOptionalJoinNodeChecks.
|
// If the flag is set to true we should skip checks already executed by RunJoinNodeChecks.
|
||||||
func RunInitNodeChecks(execer utilsexec.Interface, cfg *kubeadmapi.InitConfiguration, ignorePreflightErrors sets.String, isSecondaryControlPlane bool, downloadCerts bool) error {
|
func RunInitNodeChecks(execer utilsexec.Interface, cfg *kubeadmapi.InitConfiguration, ignorePreflightErrors sets.String, isSecondaryControlPlane bool, downloadCerts bool) error {
|
||||||
if !isSecondaryControlPlane {
|
if !isSecondaryControlPlane {
|
||||||
// First, check if we're root separately from the other preflight checks and fail fast
|
// First, check if we're root separately from the other preflight checks and fail fast
|
||||||
@ -911,11 +900,6 @@ func RunInitNodeChecks(execer utilsexec.Interface, cfg *kubeadmapi.InitConfigura
|
|||||||
if !isSecondaryControlPlane {
|
if !isSecondaryControlPlane {
|
||||||
checks = addCommonChecks(execer, cfg.KubernetesVersion, &cfg.NodeRegistration, checks)
|
checks = addCommonChecks(execer, cfg.KubernetesVersion, &cfg.NodeRegistration, checks)
|
||||||
|
|
||||||
// Check if IVPS kube-proxy mode is supported
|
|
||||||
if cfg.ComponentConfigs.KubeProxy != nil && cfg.ComponentConfigs.KubeProxy.Mode == ipvsutil.IPVSProxyMode {
|
|
||||||
checks = append(checks, IPVSProxierCheck{exec: execer})
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if Bridge-netfilter and IPv6 relevant flags are set
|
// Check if Bridge-netfilter and IPv6 relevant flags are set
|
||||||
if ip := net.ParseIP(cfg.LocalAPIEndpoint.AdvertiseAddress); ip != nil {
|
if ip := net.ParseIP(cfg.LocalAPIEndpoint.AdvertiseAddress); ip != nil {
|
||||||
if utilsnet.IsIPv6(ip) {
|
if utilsnet.IsIPv6(ip) {
|
||||||
@ -1001,18 +985,6 @@ func RunJoinNodeChecks(execer utilsexec.Interface, cfg *kubeadmapi.JoinConfigura
|
|||||||
return RunChecks(checks, os.Stderr, ignorePreflightErrors)
|
return RunChecks(checks, os.Stderr, ignorePreflightErrors)
|
||||||
}
|
}
|
||||||
|
|
||||||
// RunOptionalJoinNodeChecks executes all individual, applicable to node configuration dependant checks
|
|
||||||
func RunOptionalJoinNodeChecks(execer utilsexec.Interface, cfg *kubeadmapi.ClusterConfiguration, ignorePreflightErrors sets.String) error {
|
|
||||||
checks := []Checker{}
|
|
||||||
|
|
||||||
// Check if IPVS kube-proxy mode is supported
|
|
||||||
if cfg.ComponentConfigs.KubeProxy != nil && cfg.ComponentConfigs.KubeProxy.Mode == ipvsutil.IPVSProxyMode {
|
|
||||||
checks = append(checks, IPVSProxierCheck{exec: execer})
|
|
||||||
}
|
|
||||||
|
|
||||||
return RunChecks(checks, os.Stderr, ignorePreflightErrors)
|
|
||||||
}
|
|
||||||
|
|
||||||
// addCommonChecks is a helper function to duplicate checks that are common between both the
|
// addCommonChecks is a helper function to duplicate checks that are common between both the
|
||||||
// kubeadm init and join commands
|
// kubeadm init and join commands
|
||||||
func addCommonChecks(execer utilsexec.Interface, k8sVersion string, nodeReg *kubeadmapi.NodeRegistrationOptions, checks []Checker) []Checker {
|
func addCommonChecks(execer utilsexec.Interface, k8sVersion string, nodeReg *kubeadmapi.NodeRegistrationOptions, checks []Checker) []Checker {
|
||||||
|
@ -25,9 +25,3 @@ package preflight
|
|||||||
func (idsc IsDockerSystemdCheck) Check() (warnings, errorList []error) {
|
func (idsc IsDockerSystemdCheck) Check() (warnings, errorList []error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check determines if IPVS proxier can be used or not
|
|
||||||
// No-op for for Darwin (MacOS).
|
|
||||||
func (ipvspc IPVSProxierCheck) Check() (warnings, errors []error) {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
|
@ -21,10 +21,7 @@ package preflight
|
|||||||
import (
|
import (
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"k8s.io/kubernetes/cmd/kubeadm/app/util"
|
"k8s.io/kubernetes/cmd/kubeadm/app/util"
|
||||||
"k8s.io/kubernetes/pkg/proxy/ipvs"
|
|
||||||
"k8s.io/utils/exec"
|
"k8s.io/utils/exec"
|
||||||
|
|
||||||
utilipset "k8s.io/kubernetes/pkg/util/ipset"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Check validates if Docker is setup to use systemd as the cgroup driver.
|
// Check validates if Docker is setup to use systemd as the cgroup driver.
|
||||||
@ -43,13 +40,3 @@ func (idsc IsDockerSystemdCheck) Check() (warnings, errorList []error) {
|
|||||||
}
|
}
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check determines if IPVS proxier can be used or not
|
|
||||||
func (ipvspc IPVSProxierCheck) Check() (warnings, errors []error) {
|
|
||||||
ipsetInterface := utilipset.New(ipvspc.exec)
|
|
||||||
kernelHandler := ipvs.NewLinuxKernelHandler()
|
|
||||||
if _, err := ipvs.CanUseIPVSProxier(kernelHandler, ipsetInterface); err != nil {
|
|
||||||
return nil, []error{err}
|
|
||||||
}
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
|
@ -54,9 +54,3 @@ func (ipuc IsPrivilegedUserCheck) Check() (warnings, errorList []error) {
|
|||||||
func (idsc IsDockerSystemdCheck) Check() (warnings, errorList []error) {
|
func (idsc IsDockerSystemdCheck) Check() (warnings, errorList []error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check determines if IPVS proxier can be used or not
|
|
||||||
// No-op for Windows.
|
|
||||||
func (ipvspc IPVSProxierCheck) Check() (warnings, errors []error) {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user