...

Source file src/k8s.io/kubernetes/cmd/kubelet/app/plugins.go

Documentation: k8s.io/kubernetes/cmd/kubelet/app

     1  /*
     2  Copyright 2014 The Kubernetes Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package app
    18  
    19  // This file exists to force the desired plugin implementations to be linked.
    20  import (
    21  	"k8s.io/component-base/featuregate"
    22  	"k8s.io/utils/exec"
    23  
    24  	// Volume plugins
    25  	"k8s.io/kubernetes/pkg/volume"
    26  	"k8s.io/kubernetes/pkg/volume/cephfs"
    27  	"k8s.io/kubernetes/pkg/volume/configmap"
    28  	"k8s.io/kubernetes/pkg/volume/csi"
    29  	"k8s.io/kubernetes/pkg/volume/downwardapi"
    30  	"k8s.io/kubernetes/pkg/volume/emptydir"
    31  	"k8s.io/kubernetes/pkg/volume/fc"
    32  	"k8s.io/kubernetes/pkg/volume/flexvolume"
    33  	"k8s.io/kubernetes/pkg/volume/git_repo"
    34  	"k8s.io/kubernetes/pkg/volume/hostpath"
    35  	"k8s.io/kubernetes/pkg/volume/iscsi"
    36  	"k8s.io/kubernetes/pkg/volume/local"
    37  	"k8s.io/kubernetes/pkg/volume/nfs"
    38  	"k8s.io/kubernetes/pkg/volume/projected"
    39  	"k8s.io/kubernetes/pkg/volume/secret"
    40  
    41  	// Cloud providers
    42  	_ "k8s.io/kubernetes/pkg/cloudprovider/providers"
    43  )
    44  
    45  // ProbeVolumePlugins collects all volume plugins into an easy to use list.
    46  func ProbeVolumePlugins(featureGate featuregate.FeatureGate) ([]volume.VolumePlugin, error) {
    47  	allPlugins := []volume.VolumePlugin{}
    48  
    49  	// The list of plugins to probe is decided by the kubelet binary, not
    50  	// by dynamic linking or other "magic".  Plugins will be analyzed and
    51  	// initialized later.
    52  	//
    53  	// Kubelet does not currently need to configure volume plugins.
    54  	// If/when it does, see kube-controller-manager/app/plugins.go for example of using volume.VolumeConfig
    55  	var err error
    56  	allPlugins, err = appendLegacyProviderVolumes(allPlugins, featureGate)
    57  	if err != nil {
    58  		return allPlugins, err
    59  	}
    60  	allPlugins = append(allPlugins, emptydir.ProbeVolumePlugins()...)
    61  	allPlugins = append(allPlugins, git_repo.ProbeVolumePlugins()...)
    62  	allPlugins = append(allPlugins, hostpath.ProbeVolumePlugins(volume.VolumeConfig{})...)
    63  	allPlugins = append(allPlugins, nfs.ProbeVolumePlugins(volume.VolumeConfig{})...)
    64  	allPlugins = append(allPlugins, secret.ProbeVolumePlugins()...)
    65  	allPlugins = append(allPlugins, iscsi.ProbeVolumePlugins()...)
    66  	allPlugins = append(allPlugins, cephfs.ProbeVolumePlugins()...)
    67  	allPlugins = append(allPlugins, downwardapi.ProbeVolumePlugins()...)
    68  	allPlugins = append(allPlugins, fc.ProbeVolumePlugins()...)
    69  	allPlugins = append(allPlugins, configmap.ProbeVolumePlugins()...)
    70  	allPlugins = append(allPlugins, projected.ProbeVolumePlugins()...)
    71  	allPlugins = append(allPlugins, local.ProbeVolumePlugins()...)
    72  	allPlugins = append(allPlugins, csi.ProbeVolumePlugins()...)
    73  	return allPlugins, nil
    74  }
    75  
    76  // GetDynamicPluginProber gets the probers of dynamically discoverable plugins
    77  // for kubelet.
    78  // Currently only Flexvolume plugins are dynamically discoverable.
    79  func GetDynamicPluginProber(pluginDir string, runner exec.Interface) volume.DynamicPluginProber {
    80  	return flexvolume.GetDynamicPluginProber(pluginDir, runner)
    81  }
    82  

View as plain text