diff --git a/cmd/kubeadm/app/cmd/init_test.go b/cmd/kubeadm/app/cmd/init_test.go index ef380388af2..2f859752819 100644 --- a/cmd/kubeadm/app/cmd/init_test.go +++ b/cmd/kubeadm/app/cmd/init_test.go @@ -81,7 +81,7 @@ func TestNewInitData(t *testing.T) { }{ // Init data passed using flags { - name: "pass without any flag except the cri socket (use defaults)", + name: "pass without any flag (use defaults)", }, { name: "fail if unknown feature gates flag are passed", @@ -188,17 +188,9 @@ func TestNewInitData(t *testing.T) { t.Run(tc.name, func(t *testing.T) { // initialize an external init option and inject it to the init cmd initOptions := newInitOptions() + initOptions.skipCRIDetect = true // avoid CRI detection in unit tests cmd := newCmdInit(nil, initOptions) - // set the cri socket here, otherwise the testcase might fail if is run on the node with multiple - // cri endpoints configured, the failure caused by this is normally not an expected failure. - if tc.flags == nil { - tc.flags = make(map[string]string) - } - // set `cri-socket` only if `CfgPath` is not set - if _, okay := tc.flags[options.CfgPath]; !okay { - tc.flags[options.NodeCRISocket] = constants.UnknownCRISocket - } // sets cmd flags (that will be reflected on the init options) for f, v := range tc.flags { cmd.Flags().Set(f, v) diff --git a/cmd/kubeadm/app/cmd/join_test.go b/cmd/kubeadm/app/cmd/join_test.go index 2487193d42b..1ab6327f405 100644 --- a/cmd/kubeadm/app/cmd/join_test.go +++ b/cmd/kubeadm/app/cmd/join_test.go @@ -35,7 +35,6 @@ import ( kubeadmapi "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm" kubeadmapiv1 "k8s.io/kubernetes/cmd/kubeadm/app/apis/kubeadm/v1beta3" "k8s.io/kubernetes/cmd/kubeadm/app/cmd/options" - "k8s.io/kubernetes/cmd/kubeadm/app/constants" kubeconfigutil "k8s.io/kubernetes/cmd/kubeadm/app/util/kubeconfig" ) @@ -312,6 +311,7 @@ func TestNewJoinData(t *testing.T) { t.Run(tc.name, func(t *testing.T) { // initialize an external join option and inject it to the join cmd joinOptions := newJoinOptions() + joinOptions.skipCRIDetect = true // avoid CRI detection in unit tests cmd := newCmdJoin(nil, joinOptions) // set klog output destination to bytes.Buffer so that log could be fetched and verified later. @@ -320,15 +320,6 @@ func TestNewJoinData(t *testing.T) { klog.LogToStderr(false) defer klog.LogToStderr(true) - // set the cri socket here, otherwise the testcase might fail if is run on the node with multiple - // cri endpoints configured, the failure caused by this is normally not an expected failure. - if tc.flags == nil { - tc.flags = make(map[string]string) - } - // set `cri-socket` only if `CfgPath` is not set - if _, okay := tc.flags[options.CfgPath]; !okay { - tc.flags[options.NodeCRISocket] = constants.UnknownCRISocket - } // sets cmd flags (that will be reflected on the join options) for f, v := range tc.flags { cmd.Flags().Set(f, v) diff --git a/cmd/kubeadm/app/constants/constants.go b/cmd/kubeadm/app/constants/constants.go index 2f0d30bd488..869d4340c2f 100644 --- a/cmd/kubeadm/app/constants/constants.go +++ b/cmd/kubeadm/app/constants/constants.go @@ -261,9 +261,6 @@ const ( // init/join time for use later. kubeadm annotates the node object with this information AnnotationKubeadmCRISocket = "kubeadm.alpha.kubernetes.io/cri-socket" - // UnknownCRISocket defines the undetected or unknown CRI socket - UnknownCRISocket = "unix:///var/run/unknown.sock" - // KubeadmConfigConfigMap specifies in what ConfigMap in the kube-system namespace the `kubeadm init` configuration should be stored KubeadmConfigConfigMap = "kubeadm-config" diff --git a/cmd/kubeadm/app/phases/uploadconfig/uploadconfig_test.go b/cmd/kubeadm/app/phases/uploadconfig/uploadconfig_test.go index a5eb4bc0413..31fbe7c5dae 100644 --- a/cmd/kubeadm/app/phases/uploadconfig/uploadconfig_test.go +++ b/cmd/kubeadm/app/phases/uploadconfig/uploadconfig_test.go @@ -56,7 +56,7 @@ func TestUploadConfiguration(t *testing.T) { cfg.ComponentConfigs = kubeadmapi.ComponentConfigMap{} cfg.ClusterConfiguration.KubernetesVersion = kubeadmconstants.MinimumControlPlaneVersion.WithPatch(10).String() cfg.NodeRegistration.Name = "node-foo" - cfg.NodeRegistration.CRISocket = kubeadmconstants.UnknownCRISocket + cfg.NodeRegistration.CRISocket = kubeadmconstants.DefaultCRISocket client := clientsetfake.NewSimpleClientset() // For idempotent test, we check the result of the second call.