diff --git a/cmd/kubelet/app/BUILD b/cmd/kubelet/app/BUILD index b2f3efbc793..62397f9fcef 100644 --- a/cmd/kubelet/app/BUILD +++ b/cmd/kubelet/app/BUILD @@ -92,9 +92,6 @@ go_library( "//pkg/kubelet/config:go_default_library", "//pkg/kubelet/container:go_default_library", "//pkg/kubelet/dockershim:go_default_library", - "//pkg/kubelet/dockershim/network:go_default_library", - "//pkg/kubelet/dockershim/network/cni:go_default_library", - "//pkg/kubelet/dockershim/network/kubenet:go_default_library", "//pkg/kubelet/dockershim/remote:go_default_library", "//pkg/kubelet/eviction:go_default_library", "//pkg/kubelet/eviction/api:go_default_library", diff --git a/cmd/kubelet/app/options/container_runtime.go b/cmd/kubelet/app/options/container_runtime.go index d07cfb699f4..693994cc462 100644 --- a/cmd/kubelet/app/options/container_runtime.go +++ b/cmd/kubelet/app/options/container_runtime.go @@ -53,5 +53,9 @@ func NewContainerRuntimeOptions() *config.ContainerRuntimeOptions { PodSandboxImage: defaultPodSandboxImage, ImagePullProgressDeadline: metav1.Duration{Duration: 1 * time.Minute}, ExperimentalDockershim: false, + + //Alpha feature + CNIBinDir: "/opt/cni/bin", + CNIConfDir: "/etc/cni/net.d", } } diff --git a/cmd/kubelet/app/plugins.go b/cmd/kubelet/app/plugins.go index 22700b051f1..b4e5cbe1256 100644 --- a/cmd/kubelet/app/plugins.go +++ b/cmd/kubelet/app/plugins.go @@ -23,10 +23,6 @@ import ( _ "k8s.io/kubernetes/pkg/credentialprovider/azure" _ "k8s.io/kubernetes/pkg/credentialprovider/gcp" _ "k8s.io/kubernetes/pkg/credentialprovider/rancher" - // Network plugins - "k8s.io/kubernetes/pkg/kubelet/dockershim/network" - "k8s.io/kubernetes/pkg/kubelet/dockershim/network/cni" - "k8s.io/kubernetes/pkg/kubelet/dockershim/network/kubenet" // Volume plugins "k8s.io/kubernetes/pkg/volume" "k8s.io/kubernetes/pkg/volume/aws_ebs" @@ -112,14 +108,3 @@ func ProbeVolumePlugins() []volume.VolumePlugin { func GetDynamicPluginProber(pluginDir string) volume.DynamicPluginProber { return flexvolume.GetDynamicPluginProber(pluginDir) } - -// ProbeNetworkPlugins collects all compiled-in plugins -func ProbeNetworkPlugins(cniConfDir string, cniBinDirs []string) []network.NetworkPlugin { - allPlugins := []network.NetworkPlugin{} - - // for each existing plugin, add to the list - allPlugins = append(allPlugins, cni.ProbeNetworkPlugins(cniConfDir, cniBinDirs)...) - allPlugins = append(allPlugins, kubenet.NewPlugin(cniBinDirs)) - - return allPlugins -} diff --git a/pkg/kubelet/config/flags.go b/pkg/kubelet/config/flags.go index 7710580794f..bedc919f6ef 100644 --- a/pkg/kubelet/config/flags.go +++ b/pkg/kubelet/config/flags.go @@ -96,12 +96,12 @@ func (s *ContainerRuntimeOptions) AddFlags(fs *pflag.FlagSet) { fs.BoolVar(&s.DockerDisableSharedPID, "docker-disable-shared-pid", s.DockerDisableSharedPID, fmt.Sprintf("Setting this to false causes Kubernetes to create pods using a shared process namespace for containers in a pod when running with Docker 1.13.1 or higher. A future Kubernetes release will make this configurable instead in the API. %s", dockerOnlyWarning)) fs.MarkDeprecated("docker-disable-shared-pid", "will be removed in a future release. This option will be replaced by PID namespace sharing that is configurable per-pod using the API. See https://features.k8s.io/495") fs.StringVar(&s.PodSandboxImage, "pod-infra-container-image", s.PodSandboxImage, fmt.Sprintf("The image whose network/ipc namespaces containers in each pod will use. %s", dockerOnlyWarning)) - fs.StringVar(&s.DockerEndpoint, "docker-endpoint", s.DockerEndpoint, fmt.Sprintf("Use this for the docker endpoint to communicate with %s", dockerOnlyWarning)) + fs.StringVar(&s.DockerEndpoint, "docker-endpoint", s.DockerEndpoint, fmt.Sprintf("Use this for the docker endpoint to communicate with. %s", dockerOnlyWarning)) fs.DurationVar(&s.ImagePullProgressDeadline.Duration, "image-pull-progress-deadline", s.ImagePullProgressDeadline.Duration, fmt.Sprintf("If no pulling progress is made before this deadline, the image pulling will be cancelled. %s", dockerOnlyWarning)) // Network plugin settings for Docker. fs.StringVar(&s.NetworkPluginName, "network-plugin", s.NetworkPluginName, fmt.Sprintf(" The name of the network plugin to be invoked for various events in kubelet/pod lifecycle. %s", dockerOnlyWarning)) - fs.StringVar(&s.CNIConfDir, "cni-conf-dir", s.CNIConfDir, fmt.Sprintf(" The full path of the directory in which to search for CNI config files. Default: /etc/cni/net.d. %s", dockerOnlyWarning)) - fs.StringVar(&s.CNIBinDir, "cni-bin-dir", s.CNIBinDir, fmt.Sprintf(" A comma-separated list of full paths of directories in which to search for CNI plugin binaries. Default: /opt/cni/bin. %s", dockerOnlyWarning)) + fs.StringVar(&s.CNIConfDir, "cni-conf-dir", s.CNIConfDir, fmt.Sprintf(" The full path of the directory in which to search for CNI config files. %s", dockerOnlyWarning)) + fs.StringVar(&s.CNIBinDir, "cni-bin-dir", s.CNIBinDir, fmt.Sprintf(" A comma-separated list of full paths of directories in which to search for CNI plugin binaries. %s", dockerOnlyWarning)) fs.Int32Var(&s.NetworkPluginMTU, "network-plugin-mtu", s.NetworkPluginMTU, fmt.Sprintf(" The MTU to be passed to the network plugin, to override the default. Set to 0 to use the default 1460 MTU. %s", dockerOnlyWarning)) } diff --git a/pkg/kubelet/dockershim/network/cni/cni.go b/pkg/kubelet/dockershim/network/cni/cni.go index 776f3eeda85..f612aa85d63 100644 --- a/pkg/kubelet/dockershim/network/cni/cni.go +++ b/pkg/kubelet/dockershim/network/cni/cni.go @@ -33,9 +33,7 @@ import ( ) const ( - CNIPluginName = "cni" - DefaultConfDir = "/etc/cni/net.d" - DefaultBinDir = "/opt/cni/bin" + CNIPluginName = "cni" ) type cniNetworkPlugin struct { @@ -81,13 +79,6 @@ func ProbeNetworkPlugins(confDir string, binDirs []string) []network.NetworkPlug binDirs = append(binDirs, dir) } } - if len(binDirs) == 0 { - binDirs = []string{DefaultBinDir} - } - - if confDir == "" { - confDir = DefaultConfDir - } plugin := &cniNetworkPlugin{ defaultNetwork: nil,