mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 14:37:00 +00:00
Merge pull request #123984 from carlory/volume-remove-cloud-provider
Remove cloud provider dependency from volume host and volume controllers
This commit is contained in:
commit
38c2a963b4
@ -337,7 +337,6 @@ func startPersistentVolumeBinderController(ctx context.Context, controllerContex
|
||||
KubeClient: controllerContext.ClientBuilder.ClientOrDie("persistent-volume-binder"),
|
||||
SyncPeriod: controllerContext.ComponentConfig.PersistentVolumeBinderController.PVClaimBinderSyncPeriod.Duration,
|
||||
VolumePlugins: plugins,
|
||||
Cloud: controllerContext.Cloud,
|
||||
ClusterName: controllerContext.ComponentConfig.KubeCloudShared.ClusterName,
|
||||
VolumeInformer: controllerContext.InformerFactory.Core().V1().PersistentVolumes(),
|
||||
ClaimInformer: controllerContext.InformerFactory.Core().V1().PersistentVolumeClaims(),
|
||||
@ -384,7 +383,6 @@ func startPersistentVolumeAttachDetachController(ctx context.Context, controller
|
||||
csiNodeInformer,
|
||||
csiDriverInformer,
|
||||
controllerContext.InformerFactory.Storage().V1().VolumeAttachments(),
|
||||
controllerContext.Cloud,
|
||||
plugins,
|
||||
GetDynamicPluginProber(controllerContext.ComponentConfig.PersistentVolumeBinderController.VolumeConfiguration),
|
||||
controllerContext.ComponentConfig.AttachDetachController.DisableAttachDetachReconcilerSync,
|
||||
@ -419,7 +417,6 @@ func startPersistentVolumeExpanderController(ctx context.Context, controllerCont
|
||||
ctx,
|
||||
controllerContext.ClientBuilder.ClientOrDie("expand-controller"),
|
||||
controllerContext.InformerFactory.Core().V1().PersistentVolumeClaims(),
|
||||
controllerContext.Cloud,
|
||||
plugins,
|
||||
csiTranslator,
|
||||
csimigration.NewPluginManager(csiTranslator, utilfeature.DefaultFeatureGate),
|
||||
|
@ -46,7 +46,6 @@ import (
|
||||
kcache "k8s.io/client-go/tools/cache"
|
||||
"k8s.io/client-go/tools/record"
|
||||
"k8s.io/client-go/util/workqueue"
|
||||
cloudprovider "k8s.io/cloud-provider"
|
||||
csitrans "k8s.io/csi-translation-lib"
|
||||
"k8s.io/kubernetes/pkg/controller/volume/attachdetach/cache"
|
||||
"k8s.io/kubernetes/pkg/controller/volume/attachdetach/metrics"
|
||||
@ -114,7 +113,6 @@ func NewAttachDetachController(
|
||||
csiNodeInformer storageinformersv1.CSINodeInformer,
|
||||
csiDriverInformer storageinformersv1.CSIDriverInformer,
|
||||
volumeAttachmentInformer storageinformersv1.VolumeAttachmentInformer,
|
||||
cloud cloudprovider.Interface,
|
||||
plugins []volume.VolumePlugin,
|
||||
prober volume.DynamicPluginProber,
|
||||
disableReconciliationSync bool,
|
||||
@ -135,7 +133,6 @@ func NewAttachDetachController(
|
||||
podIndexer: podInformer.Informer().GetIndexer(),
|
||||
nodeLister: nodeInformer.Lister(),
|
||||
nodesSynced: nodeInformer.Informer().HasSynced,
|
||||
cloud: cloud,
|
||||
pvcQueue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "pvcs"),
|
||||
}
|
||||
|
||||
@ -277,9 +274,6 @@ type attachDetachController struct {
|
||||
volumeAttachmentLister storagelistersv1.VolumeAttachmentLister
|
||||
volumeAttachmentSynced kcache.InformerSynced
|
||||
|
||||
// cloud provider used by volume host
|
||||
cloud cloudprovider.Interface
|
||||
|
||||
// volumePluginMgr used to initialize and fetch volume plugins
|
||||
volumePluginMgr volume.VolumePluginMgr
|
||||
|
||||
@ -809,10 +803,6 @@ func (adc *attachDetachController) NewWrapperUnmounter(volName string, spec volu
|
||||
return nil, fmt.Errorf("NewWrapperUnmounter not supported by Attach/Detach controller's VolumeHost implementation")
|
||||
}
|
||||
|
||||
func (adc *attachDetachController) GetCloudProvider() cloudprovider.Interface {
|
||||
return adc.cloud
|
||||
}
|
||||
|
||||
func (adc *attachDetachController) GetMounter(pluginName string) mount.Interface {
|
||||
return nil
|
||||
}
|
||||
|
@ -58,7 +58,6 @@ func createADC(t testing.TB, tCtx ktesting.TContext, fakeKubeClient *fake.Client
|
||||
informerFactory.Storage().V1().CSINodes(),
|
||||
informerFactory.Storage().V1().CSIDrivers(),
|
||||
informerFactory.Storage().V1().VolumeAttachments(),
|
||||
nil, /* cloud */
|
||||
plugins,
|
||||
nil, /* prober */
|
||||
false,
|
||||
@ -272,7 +271,6 @@ func attachDetachRecoveryTestCase(t *testing.T, extraPods1 []*v1.Pod, extraPods2
|
||||
informerFactory.Storage().V1().CSINodes(),
|
||||
informerFactory.Storage().V1().CSIDrivers(),
|
||||
informerFactory.Storage().V1().VolumeAttachments(),
|
||||
nil, /* cloud */
|
||||
plugins,
|
||||
prober,
|
||||
false,
|
||||
|
@ -42,7 +42,6 @@ import (
|
||||
"k8s.io/client-go/tools/cache"
|
||||
"k8s.io/client-go/tools/record"
|
||||
"k8s.io/client-go/util/workqueue"
|
||||
cloudprovider "k8s.io/cloud-provider"
|
||||
"k8s.io/kubernetes/pkg/controller/volume/events"
|
||||
"k8s.io/kubernetes/pkg/features"
|
||||
"k8s.io/kubernetes/pkg/volume"
|
||||
@ -80,9 +79,6 @@ type expandController struct {
|
||||
pvcLister corelisters.PersistentVolumeClaimLister
|
||||
pvcsSynced cache.InformerSynced
|
||||
|
||||
// cloud provider used by volume host
|
||||
cloud cloudprovider.Interface
|
||||
|
||||
// volumePluginMgr used to initialize and fetch volume plugins
|
||||
volumePluginMgr volume.VolumePluginMgr
|
||||
|
||||
@ -103,14 +99,12 @@ func NewExpandController(
|
||||
ctx context.Context,
|
||||
kubeClient clientset.Interface,
|
||||
pvcInformer coreinformers.PersistentVolumeClaimInformer,
|
||||
cloud cloudprovider.Interface,
|
||||
plugins []volume.VolumePlugin,
|
||||
translator CSINameTranslator,
|
||||
csiMigratedPluginManager csimigration.PluginManager) (ExpandController, error) {
|
||||
|
||||
expc := &expandController{
|
||||
kubeClient: kubeClient,
|
||||
cloud: cloud,
|
||||
pvcLister: pvcInformer.Lister(),
|
||||
pvcsSynced: pvcInformer.Informer().HasSynced,
|
||||
queue: workqueue.NewNamedRateLimitingQueue(workqueue.DefaultControllerRateLimiter(), "volume_expand"),
|
||||
@ -407,10 +401,6 @@ func (expc *expandController) NewWrapperUnmounter(volName string, spec volume.Sp
|
||||
return nil, fmt.Errorf("NewWrapperUnmounter not supported by expand controller's VolumeHost implementation")
|
||||
}
|
||||
|
||||
func (expc *expandController) GetCloudProvider() cloudprovider.Interface {
|
||||
return expc.cloud
|
||||
}
|
||||
|
||||
func (expc *expandController) GetMounter(pluginName string) mount.Interface {
|
||||
return nil
|
||||
}
|
||||
|
@ -108,7 +108,7 @@ func TestSyncHandler(t *testing.T) {
|
||||
}
|
||||
allPlugins := []volume.VolumePlugin{}
|
||||
translator := csitrans.New()
|
||||
expc, err := NewExpandController(tCtx, fakeKubeClient, pvcInformer, nil, allPlugins, translator, csimigration.NewPluginManager(translator, utilfeature.DefaultFeatureGate))
|
||||
expc, err := NewExpandController(tCtx, fakeKubeClient, pvcInformer, allPlugins, translator, csimigration.NewPluginManager(translator, utilfeature.DefaultFeatureGate))
|
||||
if err != nil {
|
||||
t.Fatalf("error creating expand controller : %v", err)
|
||||
}
|
||||
|
@ -41,7 +41,6 @@ import (
|
||||
"k8s.io/client-go/tools/record"
|
||||
ref "k8s.io/client-go/tools/reference"
|
||||
"k8s.io/client-go/util/workqueue"
|
||||
cloudprovider "k8s.io/cloud-provider"
|
||||
volerr "k8s.io/cloud-provider/volume/errors"
|
||||
storagehelpers "k8s.io/component-helpers/storage/volume"
|
||||
"k8s.io/kubernetes/pkg/controller/volume/common"
|
||||
@ -119,18 +118,6 @@ import (
|
||||
// claims at the same time. The controller must recover from any conflicts
|
||||
// that may arise from these conditions.
|
||||
|
||||
// CloudVolumeCreatedForClaimNamespaceTag is a name of a tag attached to a real volume in cloud (e.g. AWS EBS or GCE PD)
|
||||
// with namespace of a persistent volume claim used to create this volume.
|
||||
const CloudVolumeCreatedForClaimNamespaceTag = "kubernetes.io/created-for/pvc/namespace"
|
||||
|
||||
// CloudVolumeCreatedForClaimNameTag is a name of a tag attached to a real volume in cloud (e.g. AWS EBS or GCE PD)
|
||||
// with name of a persistent volume claim used to create this volume.
|
||||
const CloudVolumeCreatedForClaimNameTag = "kubernetes.io/created-for/pvc/name"
|
||||
|
||||
// CloudVolumeCreatedForVolumeNameTag is a name of a tag attached to a real volume in cloud (e.g. AWS EBS or GCE PD)
|
||||
// with name of appropriate Kubernetes persistent volume .
|
||||
const CloudVolumeCreatedForVolumeNameTag = "kubernetes.io/created-for/pv/name"
|
||||
|
||||
// Number of retries when we create a PV object for a provisioned volume.
|
||||
const createProvisionedPVRetryCount = 5
|
||||
|
||||
@ -167,7 +154,6 @@ type PersistentVolumeController struct {
|
||||
kubeClient clientset.Interface
|
||||
eventBroadcaster record.EventBroadcaster
|
||||
eventRecorder record.EventRecorder
|
||||
cloud cloudprovider.Interface
|
||||
volumePluginMgr vol.VolumePluginMgr
|
||||
enableDynamicProvisioning bool
|
||||
clusterName string
|
||||
@ -1653,16 +1639,9 @@ func (ctrl *PersistentVolumeController) provisionClaimOperation(
|
||||
return pluginName, err
|
||||
}
|
||||
|
||||
// Gather provisioning options
|
||||
tags := make(map[string]string)
|
||||
tags[CloudVolumeCreatedForClaimNamespaceTag] = claim.Namespace
|
||||
tags[CloudVolumeCreatedForClaimNameTag] = claim.Name
|
||||
tags[CloudVolumeCreatedForVolumeNameTag] = pvName
|
||||
|
||||
options := vol.VolumeOptions{
|
||||
PersistentVolumeReclaimPolicy: *storageClass.ReclaimPolicy,
|
||||
MountOptions: storageClass.MountOptions,
|
||||
CloudTags: &tags,
|
||||
ClusterName: ctrl.clusterName,
|
||||
PVName: pvName,
|
||||
PVC: claim,
|
||||
|
@ -40,7 +40,6 @@ import (
|
||||
"k8s.io/client-go/tools/cache"
|
||||
"k8s.io/client-go/tools/record"
|
||||
"k8s.io/client-go/util/workqueue"
|
||||
cloudprovider "k8s.io/cloud-provider"
|
||||
storagehelpers "k8s.io/component-helpers/storage/volume"
|
||||
csitrans "k8s.io/csi-translation-lib"
|
||||
"k8s.io/kubernetes/pkg/controller"
|
||||
@ -65,7 +64,6 @@ type ControllerParameters struct {
|
||||
KubeClient clientset.Interface
|
||||
SyncPeriod time.Duration
|
||||
VolumePlugins []vol.VolumePlugin
|
||||
Cloud cloudprovider.Interface
|
||||
ClusterName string
|
||||
VolumeInformer coreinformers.PersistentVolumeInformer
|
||||
ClaimInformer coreinformers.PersistentVolumeClaimInformer
|
||||
@ -87,7 +85,6 @@ func NewController(ctx context.Context, p ControllerParameters) (*PersistentVolu
|
||||
eventBroadcaster: eventBroadcaster,
|
||||
eventRecorder: eventRecorder,
|
||||
runningOperations: goroutinemap.NewGoRoutineMap(true /* exponentialBackOffOnError */),
|
||||
cloud: p.Cloud,
|
||||
enableDynamicProvisioning: p.EnableDynamicProvisioning,
|
||||
clusterName: p.ClusterName,
|
||||
createProvisionedPVRetryCount: createProvisionedPVRetryCount,
|
||||
|
@ -29,7 +29,6 @@ import (
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
clientset "k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/tools/record"
|
||||
cloudprovider "k8s.io/cloud-provider"
|
||||
vol "k8s.io/kubernetes/pkg/volume"
|
||||
"k8s.io/kubernetes/pkg/volume/util/subpath"
|
||||
)
|
||||
@ -74,10 +73,6 @@ func (ctrl *PersistentVolumeController) NewWrapperUnmounter(volName string, spec
|
||||
return nil, fmt.Errorf("PersistentVolumeController.NewWrapperMounter is not implemented")
|
||||
}
|
||||
|
||||
func (ctrl *PersistentVolumeController) GetCloudProvider() cloudprovider.Interface {
|
||||
return ctrl.cloud
|
||||
}
|
||||
|
||||
func (ctrl *PersistentVolumeController) GetMounter(pluginName string) mount.Interface {
|
||||
return nil
|
||||
}
|
||||
|
@ -35,7 +35,6 @@ import (
|
||||
storagelisters "k8s.io/client-go/listers/storage/v1"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
"k8s.io/client-go/tools/record"
|
||||
cloudprovider "k8s.io/cloud-provider"
|
||||
"k8s.io/kubernetes/pkg/kubelet/clustertrustbundle"
|
||||
"k8s.io/kubernetes/pkg/kubelet/configmap"
|
||||
"k8s.io/kubernetes/pkg/kubelet/secret"
|
||||
@ -217,10 +216,6 @@ func (kvh *kubeletVolumeHost) NewWrapperUnmounter(volName string, spec volume.Sp
|
||||
return plugin.NewUnmounter(spec.Name(), podUID)
|
||||
}
|
||||
|
||||
func (kvh *kubeletVolumeHost) GetCloudProvider() cloudprovider.Interface {
|
||||
return kvh.kubelet.cloud
|
||||
}
|
||||
|
||||
func (kvh *kubeletVolumeHost) GetMounter(pluginName string) mount.Interface {
|
||||
return kvh.kubelet.mounter
|
||||
}
|
||||
|
@ -39,7 +39,6 @@ import (
|
||||
storagelistersv1 "k8s.io/client-go/listers/storage/v1"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
"k8s.io/client-go/tools/record"
|
||||
cloudprovider "k8s.io/cloud-provider"
|
||||
"k8s.io/kubernetes/pkg/volume/util/hostutil"
|
||||
"k8s.io/kubernetes/pkg/volume/util/recyclerclient"
|
||||
"k8s.io/kubernetes/pkg/volume/util/subpath"
|
||||
@ -85,8 +84,6 @@ type VolumeOptions struct {
|
||||
PVC *v1.PersistentVolumeClaim
|
||||
// Unique name of Kubernetes cluster.
|
||||
ClusterName string
|
||||
// Tags to attach to the real volume in the cloud provider - e.g. AWS EBS
|
||||
CloudTags *map[string]string
|
||||
// Volume provisioning parameters from StorageClass
|
||||
Parameters map[string]string
|
||||
}
|
||||
@ -382,9 +379,6 @@ type VolumeHost interface {
|
||||
// context.
|
||||
NewWrapperUnmounter(volName string, spec Spec, podUID types.UID) (Unmounter, error)
|
||||
|
||||
// Get cloud provider from kubelet.
|
||||
GetCloudProvider() cloudprovider.Interface
|
||||
|
||||
// Get mounter interface.
|
||||
GetMounter(pluginName string) mount.Interface
|
||||
|
||||
|
@ -40,7 +40,6 @@ import (
|
||||
storagelistersv1 "k8s.io/client-go/listers/storage/v1"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
"k8s.io/client-go/tools/record"
|
||||
cloudprovider "k8s.io/cloud-provider"
|
||||
csilibplugins "k8s.io/csi-translation-lib/plugins"
|
||||
. "k8s.io/kubernetes/pkg/volume"
|
||||
"k8s.io/kubernetes/pkg/volume/util/hostutil"
|
||||
@ -62,7 +61,6 @@ type fakeVolumeHost struct {
|
||||
rootDir string
|
||||
kubeClient clientset.Interface
|
||||
pluginMgr *VolumePluginMgr
|
||||
cloud cloudprovider.Interface
|
||||
mounter mount.Interface
|
||||
hostUtil hostutil.HostUtils
|
||||
exec *testingexec.FakeExec
|
||||
@ -81,19 +79,19 @@ var _ VolumeHost = &fakeVolumeHost{}
|
||||
var _ FakeVolumeHost = &fakeVolumeHost{}
|
||||
|
||||
func NewFakeVolumeHost(t *testing.T, rootDir string, kubeClient clientset.Interface, plugins []VolumePlugin) FakeVolumeHost {
|
||||
return newFakeVolumeHost(t, rootDir, kubeClient, plugins, nil, nil, "", nil, nil)
|
||||
return newFakeVolumeHost(t, rootDir, kubeClient, plugins, nil, "", nil, nil)
|
||||
}
|
||||
|
||||
func NewFakeVolumeHostWithCloudProvider(t *testing.T, rootDir string, kubeClient clientset.Interface, plugins []VolumePlugin, cloud cloudprovider.Interface) FakeVolumeHost {
|
||||
return newFakeVolumeHost(t, rootDir, kubeClient, plugins, cloud, nil, "", nil, nil)
|
||||
func NewFakeVolumeHostWithCloudProvider(t *testing.T, rootDir string, kubeClient clientset.Interface, plugins []VolumePlugin) FakeVolumeHost {
|
||||
return newFakeVolumeHost(t, rootDir, kubeClient, plugins, nil, "", nil, nil)
|
||||
}
|
||||
|
||||
func NewFakeVolumeHostWithCSINodeName(t *testing.T, rootDir string, kubeClient clientset.Interface, plugins []VolumePlugin, nodeName string, driverLister storagelistersv1.CSIDriverLister, volumeAttachLister storagelistersv1.VolumeAttachmentLister) FakeVolumeHost {
|
||||
return newFakeVolumeHost(t, rootDir, kubeClient, plugins, nil, nil, nodeName, driverLister, volumeAttachLister)
|
||||
return newFakeVolumeHost(t, rootDir, kubeClient, plugins, nil, nodeName, driverLister, volumeAttachLister)
|
||||
}
|
||||
|
||||
func newFakeVolumeHost(t *testing.T, rootDir string, kubeClient clientset.Interface, plugins []VolumePlugin, cloud cloudprovider.Interface, pathToTypeMap map[string]hostutil.FileType, nodeName string, driverLister storagelistersv1.CSIDriverLister, volumeAttachLister storagelistersv1.VolumeAttachmentLister) FakeVolumeHost {
|
||||
host := &fakeVolumeHost{rootDir: rootDir, kubeClient: kubeClient, cloud: cloud, nodeName: nodeName, csiDriverLister: driverLister, volumeAttachmentLister: volumeAttachLister}
|
||||
func newFakeVolumeHost(t *testing.T, rootDir string, kubeClient clientset.Interface, plugins []VolumePlugin, pathToTypeMap map[string]hostutil.FileType, nodeName string, driverLister storagelistersv1.CSIDriverLister, volumeAttachLister storagelistersv1.VolumeAttachmentLister) FakeVolumeHost {
|
||||
host := &fakeVolumeHost{rootDir: rootDir, kubeClient: kubeClient, nodeName: nodeName, csiDriverLister: driverLister, volumeAttachmentLister: volumeAttachLister}
|
||||
host.mounter = mount.NewFakeMounter(nil)
|
||||
host.hostUtil = hostutil.NewFakeHostUtil(pathToTypeMap)
|
||||
host.exec = &testingexec.FakeExec{DisableScripts: true}
|
||||
@ -138,10 +136,6 @@ func (f *fakeVolumeHost) GetKubeClient() clientset.Interface {
|
||||
return f.kubeClient
|
||||
}
|
||||
|
||||
func (f *fakeVolumeHost) GetCloudProvider() cloudprovider.Interface {
|
||||
return f.cloud
|
||||
}
|
||||
|
||||
func (f *fakeVolumeHost) GetMounter(pluginName string) mount.Interface {
|
||||
return f.mounter
|
||||
}
|
||||
@ -259,14 +253,13 @@ var _ AttachDetachVolumeHost = &fakeAttachDetachVolumeHost{}
|
||||
var _ FakeVolumeHost = &fakeAttachDetachVolumeHost{}
|
||||
|
||||
func NewFakeAttachDetachVolumeHostWithCSINodeName(t *testing.T, rootDir string, kubeClient clientset.Interface, plugins []VolumePlugin, nodeName string, driverLister storagelistersv1.CSIDriverLister, volumeAttachLister storagelistersv1.VolumeAttachmentLister) FakeVolumeHost {
|
||||
return newFakeAttachDetachVolumeHost(t, rootDir, kubeClient, plugins, nil, nil, nodeName, driverLister, volumeAttachLister)
|
||||
return newFakeAttachDetachVolumeHost(t, rootDir, kubeClient, plugins, nil, nodeName, driverLister, volumeAttachLister)
|
||||
}
|
||||
|
||||
func newFakeAttachDetachVolumeHost(t *testing.T, rootDir string, kubeClient clientset.Interface, plugins []VolumePlugin, cloud cloudprovider.Interface, pathToTypeMap map[string]hostutil.FileType, nodeName string, driverLister storagelistersv1.CSIDriverLister, volumeAttachLister storagelistersv1.VolumeAttachmentLister) FakeVolumeHost {
|
||||
func newFakeAttachDetachVolumeHost(t *testing.T, rootDir string, kubeClient clientset.Interface, plugins []VolumePlugin, pathToTypeMap map[string]hostutil.FileType, nodeName string, driverLister storagelistersv1.CSIDriverLister, volumeAttachLister storagelistersv1.VolumeAttachmentLister) FakeVolumeHost {
|
||||
host := &fakeAttachDetachVolumeHost{}
|
||||
host.rootDir = rootDir
|
||||
host.kubeClient = kubeClient
|
||||
host.cloud = cloud
|
||||
host.nodeName = nodeName
|
||||
host.csiDriverLister = driverLister
|
||||
host.volumeAttachmentLister = volumeAttachLister
|
||||
@ -331,26 +324,21 @@ var _ KubeletVolumeHost = &fakeKubeletVolumeHost{}
|
||||
var _ FakeVolumeHost = &fakeKubeletVolumeHost{}
|
||||
|
||||
func NewFakeKubeletVolumeHost(t *testing.T, rootDir string, kubeClient clientset.Interface, plugins []VolumePlugin) *fakeKubeletVolumeHost {
|
||||
return newFakeKubeletVolumeHost(t, rootDir, kubeClient, plugins, nil, nil, "", nil, nil)
|
||||
}
|
||||
|
||||
func NewFakeKubeletVolumeHostWithCloudProvider(t *testing.T, rootDir string, kubeClient clientset.Interface, plugins []VolumePlugin, cloud cloudprovider.Interface) *fakeKubeletVolumeHost {
|
||||
return newFakeKubeletVolumeHost(t, rootDir, kubeClient, plugins, cloud, nil, "", nil, nil)
|
||||
return newFakeKubeletVolumeHost(t, rootDir, kubeClient, plugins, nil, "", nil, nil)
|
||||
}
|
||||
|
||||
func NewFakeKubeletVolumeHostWithCSINodeName(t *testing.T, rootDir string, kubeClient clientset.Interface, plugins []VolumePlugin, nodeName string, driverLister storagelistersv1.CSIDriverLister, volumeAttachLister storagelistersv1.VolumeAttachmentLister) *fakeKubeletVolumeHost {
|
||||
return newFakeKubeletVolumeHost(t, rootDir, kubeClient, plugins, nil, nil, nodeName, driverLister, volumeAttachLister)
|
||||
return newFakeKubeletVolumeHost(t, rootDir, kubeClient, plugins, nil, nodeName, driverLister, volumeAttachLister)
|
||||
}
|
||||
|
||||
func NewFakeKubeletVolumeHostWithMounterFSType(t *testing.T, rootDir string, kubeClient clientset.Interface, plugins []VolumePlugin, pathToTypeMap map[string]hostutil.FileType) *fakeKubeletVolumeHost {
|
||||
return newFakeKubeletVolumeHost(t, rootDir, kubeClient, plugins, nil, pathToTypeMap, "", nil, nil)
|
||||
return newFakeKubeletVolumeHost(t, rootDir, kubeClient, plugins, pathToTypeMap, "", nil, nil)
|
||||
}
|
||||
|
||||
func newFakeKubeletVolumeHost(t *testing.T, rootDir string, kubeClient clientset.Interface, plugins []VolumePlugin, cloud cloudprovider.Interface, pathToTypeMap map[string]hostutil.FileType, nodeName string, driverLister storagelistersv1.CSIDriverLister, volumeAttachLister storagelistersv1.VolumeAttachmentLister) *fakeKubeletVolumeHost {
|
||||
func newFakeKubeletVolumeHost(t *testing.T, rootDir string, kubeClient clientset.Interface, plugins []VolumePlugin, pathToTypeMap map[string]hostutil.FileType, nodeName string, driverLister storagelistersv1.CSIDriverLister, volumeAttachLister storagelistersv1.VolumeAttachmentLister) *fakeKubeletVolumeHost {
|
||||
host := &fakeKubeletVolumeHost{}
|
||||
host.rootDir = rootDir
|
||||
host.kubeClient = kubeClient
|
||||
host.cloud = cloud
|
||||
host.nodeName = nodeName
|
||||
host.csiDriverLister = driverLister
|
||||
host.volumeAttachmentLister = volumeAttachLister
|
||||
@ -404,7 +392,6 @@ func (f *fakeKubeletVolumeHost) SetKubeletError(err error) {
|
||||
f.mux.Lock()
|
||||
defer f.mux.Unlock()
|
||||
f.kubeletErr = err
|
||||
return
|
||||
}
|
||||
|
||||
func (f *fakeKubeletVolumeHost) GetInformerFactory() informers.SharedInformerFactory {
|
||||
|
@ -30,7 +30,6 @@ import (
|
||||
clientset "k8s.io/client-go/kubernetes"
|
||||
restclient "k8s.io/client-go/rest"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
fakecloud "k8s.io/cloud-provider/fake"
|
||||
kubeapiservertesting "k8s.io/kubernetes/cmd/kube-apiserver/app/testing"
|
||||
"k8s.io/kubernetes/pkg/controller/volume/attachdetach"
|
||||
volumecache "k8s.io/kubernetes/pkg/controller/volume/attachdetach/cache"
|
||||
@ -348,7 +347,6 @@ func createAdClients(ctx context.Context, t *testing.T, server *kubeapiservertes
|
||||
Detachers: nil,
|
||||
}
|
||||
plugins := []volume.VolumePlugin{plugin}
|
||||
cloud := &fakecloud.Cloud{}
|
||||
informers := clientgoinformers.NewSharedInformerFactory(testClient, resyncPeriod)
|
||||
ctrl, err := attachdetach.NewAttachDetachController(
|
||||
ctx,
|
||||
@ -360,7 +358,6 @@ func createAdClients(ctx context.Context, t *testing.T, server *kubeapiservertes
|
||||
informers.Storage().V1().CSINodes(),
|
||||
informers.Storage().V1().CSIDrivers(),
|
||||
informers.Storage().V1().VolumeAttachments(),
|
||||
cloud,
|
||||
plugins,
|
||||
nil, /* prober */
|
||||
false,
|
||||
@ -379,7 +376,6 @@ func createAdClients(ctx context.Context, t *testing.T, server *kubeapiservertes
|
||||
KubeClient: testClient,
|
||||
SyncPeriod: controllerOptions.PVClaimBinderSyncPeriod,
|
||||
VolumePlugins: plugins,
|
||||
Cloud: nil,
|
||||
ClusterName: "volume-test-cluster",
|
||||
VolumeInformer: informers.Core().V1().PersistentVolumes(),
|
||||
ClaimInformer: informers.Core().V1().PersistentVolumeClaims(),
|
||||
|
@ -34,7 +34,6 @@ import (
|
||||
clientset "k8s.io/client-go/kubernetes"
|
||||
restclient "k8s.io/client-go/rest"
|
||||
ref "k8s.io/client-go/tools/reference"
|
||||
fakecloud "k8s.io/cloud-provider/fake"
|
||||
kubeapiservertesting "k8s.io/kubernetes/cmd/kube-apiserver/app/testing"
|
||||
"k8s.io/kubernetes/pkg/api/legacyscheme"
|
||||
persistentvolumecontroller "k8s.io/kubernetes/pkg/controller/volume/persistentvolume"
|
||||
@ -1353,7 +1352,6 @@ func createClients(ctx context.Context, namespaceName string, t *testing.T, s *k
|
||||
Detachers: nil,
|
||||
}
|
||||
plugins := []volume.VolumePlugin{plugin}
|
||||
cloud := &fakecloud.Cloud{}
|
||||
informers := informers.NewSharedInformerFactory(testClient, getSyncPeriod(syncPeriod))
|
||||
ctrl, err := persistentvolumecontroller.NewController(
|
||||
ctx,
|
||||
@ -1361,7 +1359,6 @@ func createClients(ctx context.Context, namespaceName string, t *testing.T, s *k
|
||||
KubeClient: binderClient,
|
||||
SyncPeriod: getSyncPeriod(syncPeriod),
|
||||
VolumePlugins: plugins,
|
||||
Cloud: cloud,
|
||||
VolumeInformer: informers.Core().V1().PersistentVolumes(),
|
||||
ClaimInformer: informers.Core().V1().PersistentVolumeClaims(),
|
||||
ClassInformer: informers.Storage().V1().StorageClasses(),
|
||||
|
@ -1111,7 +1111,6 @@ func initPVController(t *testing.T, testCtx *testutil.TestContext, provisionDela
|
||||
// https://github.com/kubernetes/kubernetes/issues/85320
|
||||
SyncPeriod: 5 * time.Second,
|
||||
VolumePlugins: plugins,
|
||||
Cloud: nil,
|
||||
ClusterName: "volume-test-cluster",
|
||||
VolumeInformer: informerFactory.Core().V1().PersistentVolumes(),
|
||||
ClaimInformer: informerFactory.Core().V1().PersistentVolumeClaims(),
|
||||
|
Loading…
Reference in New Issue
Block a user