From 05326f8489656566458b9144a0940625c4e92f7a Mon Sep 17 00:00:00 2001 From: Yassine TIJANI Date: Thu, 22 Aug 2019 16:43:27 +0100 Subject: [PATCH] remove the ipvs checks from the preflight checks Signed-off-by: Yassine TIJANI --- cmd/kubeadm/.import-restrictions | 3 -- cmd/kubeadm/app/cmd/phases/join/preflight.go | 4 --- cmd/kubeadm/app/preflight/BUILD | 3 -- cmd/kubeadm/app/preflight/checks.go | 30 +------------------- cmd/kubeadm/app/preflight/checks_darwin.go | 6 ---- cmd/kubeadm/app/preflight/checks_linux.go | 13 --------- cmd/kubeadm/app/preflight/checks_windows.go | 6 ---- 7 files changed, 1 insertion(+), 64 deletions(-) diff --git a/cmd/kubeadm/.import-restrictions b/cmd/kubeadm/.import-restrictions index 9c80406eace..f5afc29294b 100644 --- a/cmd/kubeadm/.import-restrictions +++ b/cmd/kubeadm/.import-restrictions @@ -77,9 +77,7 @@ "k8s.io/kubernetes/pkg/util/conntrack", "k8s.io/kubernetes/pkg/util/dbus", "k8s.io/kubernetes/pkg/util/hash", - "k8s.io/kubernetes/pkg/util/ipset", "k8s.io/kubernetes/pkg/util/iptables", - "k8s.io/kubernetes/pkg/util/ipvs", "k8s.io/kubernetes/pkg/util/metrics", "k8s.io/kubernetes/pkg/util/parsers", "k8s.io/kubernetes/pkg/util/sysctl", @@ -110,7 +108,6 @@ "github.com/coreos/etcd/pkg/transport", "github.com/davecgh/go-spew/spew", "github.com/docker/distribution/reference", - "github.com/docker/libnetwork/ipvs", "github.com/godbus/dbus", "github.com/gogo/protobuf/proto", "github.com/gogo/protobuf/sortkeys", diff --git a/cmd/kubeadm/app/cmd/phases/join/preflight.go b/cmd/kubeadm/app/cmd/phases/join/preflight.go index ee6d9779a63..70abd104635 100644 --- a/cmd/kubeadm/app/cmd/phases/join/preflight.go +++ b/cmd/kubeadm/app/cmd/phases/join/preflight.go @@ -99,10 +99,6 @@ func runPreflight(c workflow.RunData) error { // Continue with more specific checks based on the init configuration 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 { // Checks if the cluster configuration supports // joining a new control plane instance and if all the necessary certificates are provided diff --git a/cmd/kubeadm/app/preflight/BUILD b/cmd/kubeadm/app/preflight/BUILD index 2640ce4aa28..71f66fc4c84 100644 --- a/cmd/kubeadm/app/preflight/BUILD +++ b/cmd/kubeadm/app/preflight/BUILD @@ -26,7 +26,6 @@ go_library( "//cmd/kubeadm/app/util/system:go_default_library", "//cmd/kubeadm/app/version: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/sets:go_default_library", "//staging/src/k8s.io/apimachinery/pkg/util/version:go_default_library", @@ -39,8 +38,6 @@ go_library( ] + select({ "@io_bazel_rules_go//go/platform:linux": [ "//cmd/kubeadm/app/util:go_default_library", - "//pkg/proxy/ipvs:go_default_library", - "//pkg/util/ipset:go_default_library", ], "//conditions:default": [], }), diff --git a/cmd/kubeadm/app/preflight/checks.go b/cmd/kubeadm/app/preflight/checks.go index bff978ae922..d9222bd7c0f 100644 --- a/cmd/kubeadm/app/preflight/checks.go +++ b/cmd/kubeadm/app/preflight/checks.go @@ -49,7 +49,6 @@ import ( "k8s.io/kubernetes/cmd/kubeadm/app/util/system" kubeadmversion "k8s.io/kubernetes/cmd/kubeadm/app/version" "k8s.io/kubernetes/pkg/registry/core/service/ipallocator" - ipvsutil "k8s.io/kubernetes/pkg/util/ipvs" utilsexec "k8s.io/utils/exec" utilsnet "k8s.io/utils/net" ) @@ -865,20 +864,10 @@ func (ncc NumCPUCheck) Check() (warnings, errorList []error) { 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. // 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. -// 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 { if !isSecondaryControlPlane { // 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 { 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 if ip := net.ParseIP(cfg.LocalAPIEndpoint.AdvertiseAddress); ip != nil { if utilsnet.IsIPv6(ip) { @@ -1001,18 +985,6 @@ func RunJoinNodeChecks(execer utilsexec.Interface, cfg *kubeadmapi.JoinConfigura 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 // kubeadm init and join commands func addCommonChecks(execer utilsexec.Interface, k8sVersion string, nodeReg *kubeadmapi.NodeRegistrationOptions, checks []Checker) []Checker { diff --git a/cmd/kubeadm/app/preflight/checks_darwin.go b/cmd/kubeadm/app/preflight/checks_darwin.go index 59e9d030be9..d4cb02628a4 100644 --- a/cmd/kubeadm/app/preflight/checks_darwin.go +++ b/cmd/kubeadm/app/preflight/checks_darwin.go @@ -25,9 +25,3 @@ package preflight func (idsc IsDockerSystemdCheck) Check() (warnings, errorList []error) { 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 -} diff --git a/cmd/kubeadm/app/preflight/checks_linux.go b/cmd/kubeadm/app/preflight/checks_linux.go index d2e83f25604..4f7db008f98 100644 --- a/cmd/kubeadm/app/preflight/checks_linux.go +++ b/cmd/kubeadm/app/preflight/checks_linux.go @@ -21,10 +21,7 @@ package preflight import ( "github.com/pkg/errors" "k8s.io/kubernetes/cmd/kubeadm/app/util" - "k8s.io/kubernetes/pkg/proxy/ipvs" "k8s.io/utils/exec" - - utilipset "k8s.io/kubernetes/pkg/util/ipset" ) // 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 } - -// 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 -} diff --git a/cmd/kubeadm/app/preflight/checks_windows.go b/cmd/kubeadm/app/preflight/checks_windows.go index 05add8cfa41..f1515942a0b 100644 --- a/cmd/kubeadm/app/preflight/checks_windows.go +++ b/cmd/kubeadm/app/preflight/checks_windows.go @@ -54,9 +54,3 @@ func (ipuc IsPrivilegedUserCheck) Check() (warnings, errorList []error) { func (idsc IsDockerSystemdCheck) Check() (warnings, errorList []error) { 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 -}