mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-26 05:03:09 +00:00
Merge pull request #35491 from pmorie/byebye-getrootcontext
Automatic merge from submit-queue Remove GetRootContext method from VolumeHost interface Remove the `GetRootContext` call from the `VolumeHost` interface, since Kubernetes no longer needs to know the SELinux context of the Kubelet directory. Per #33951 and #35127. Depends on #33663; only the last commit is relevant to this PR.
This commit is contained in:
commit
43a915e628
@ -593,10 +593,6 @@ func (adc *attachDetachController) GetHostIP() (net.IP, error) {
|
|||||||
return nil, fmt.Errorf("GetHostIP() not supported by Attach/Detach controller's VolumeHost implementation")
|
return nil, fmt.Errorf("GetHostIP() not supported by Attach/Detach controller's VolumeHost implementation")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (adc *attachDetachController) GetRootContext() string {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (adc *attachDetachController) GetNodeAllocatable() (api.ResourceList, error) {
|
func (adc *attachDetachController) GetNodeAllocatable() (api.ResourceList, error) {
|
||||||
return api.ResourceList{}, nil
|
return api.ResourceList{}, nil
|
||||||
}
|
}
|
||||||
|
@ -77,10 +77,6 @@ func (ctrl *PersistentVolumeController) GetHostIP() (net.IP, error) {
|
|||||||
return nil, fmt.Errorf("PersistentVolumeController.GetHostIP() is not implemented")
|
return nil, fmt.Errorf("PersistentVolumeController.GetHostIP() is not implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ctrl *PersistentVolumeController) GetRootContext() string {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (ctrl *PersistentVolumeController) GetNodeAllocatable() (api.ResourceList, error) {
|
func (ctrl *PersistentVolumeController) GetNodeAllocatable() (api.ResourceList, error) {
|
||||||
return api.ResourceList{}, nil
|
return api.ResourceList{}, nil
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,6 @@ go_library(
|
|||||||
"pod_container_deletor.go",
|
"pod_container_deletor.go",
|
||||||
"pod_workers.go",
|
"pod_workers.go",
|
||||||
"reason_cache.go",
|
"reason_cache.go",
|
||||||
"root_context_linux.go",
|
|
||||||
"runonce.go",
|
"runonce.go",
|
||||||
"runtime.go",
|
"runtime.go",
|
||||||
"util.go",
|
"util.go",
|
||||||
@ -122,7 +121,6 @@ go_library(
|
|||||||
"//vendor:github.com/google/cadvisor/events",
|
"//vendor:github.com/google/cadvisor/events",
|
||||||
"//vendor:github.com/google/cadvisor/info/v1",
|
"//vendor:github.com/google/cadvisor/info/v1",
|
||||||
"//vendor:github.com/google/cadvisor/info/v2",
|
"//vendor:github.com/google/cadvisor/info/v2",
|
||||||
"//vendor:github.com/opencontainers/runc/libcontainer/selinux",
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
// +build linux
|
|
||||||
|
|
||||||
/*
|
|
||||||
Copyright 2015 The Kubernetes Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package kubelet
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/opencontainers/runc/libcontainer/selinux"
|
|
||||||
)
|
|
||||||
|
|
||||||
// getRootDirContext gets the SELinux context of the kubelet rootDir
|
|
||||||
// or returns an error.
|
|
||||||
func (kl *Kubelet) getRootDirContext() (string, error) {
|
|
||||||
// If SELinux is not enabled, return an empty string
|
|
||||||
if !selinux.SelinuxEnabled() {
|
|
||||||
return "", nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the SELinux context of the rootDir.
|
|
||||||
return selinux.Getfilecon(kl.getRootDir())
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
// +build !linux
|
|
||||||
|
|
||||||
/*
|
|
||||||
Copyright 2015 The Kubernetes Authors.
|
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
you may not use this file except in compliance with the License.
|
|
||||||
You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package kubelet
|
|
||||||
|
|
||||||
func (kl *Kubelet) getRootDirContext() (string, error) {
|
|
||||||
// For now, just return a blank security context on unsupported platforms
|
|
||||||
return "", nil
|
|
||||||
}
|
|
@ -132,12 +132,3 @@ func (kvh *kubeletVolumeHost) GetNodeAllocatable() (api.ResourceList, error) {
|
|||||||
}
|
}
|
||||||
return node.Status.Allocatable, nil
|
return node.Status.Allocatable, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (kvh *kubeletVolumeHost) GetRootContext() string {
|
|
||||||
rootContext, err := kvh.kubelet.getRootDirContext()
|
|
||||||
if err != nil {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
return rootContext
|
|
||||||
}
|
|
||||||
|
@ -184,7 +184,7 @@ func newTestVolumeManager(
|
|||||||
plug := &volumetest.FakeVolumePlugin{PluginName: "fake", Host: nil}
|
plug := &volumetest.FakeVolumePlugin{PluginName: "fake", Host: nil}
|
||||||
fakeRecorder := &record.FakeRecorder{}
|
fakeRecorder := &record.FakeRecorder{}
|
||||||
plugMgr := &volume.VolumePluginMgr{}
|
plugMgr := &volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins([]volume.VolumePlugin{plug}, volumetest.NewFakeVolumeHost(tmpDir, kubeClient, nil, "" /* rootContext */))
|
plugMgr.InitPlugins([]volume.VolumePlugin{plug}, volumetest.NewFakeVolumeHost(tmpDir, kubeClient, nil))
|
||||||
|
|
||||||
vm, err := NewVolumeManager(
|
vm, err := NewVolumeManager(
|
||||||
true,
|
true,
|
||||||
|
@ -169,7 +169,7 @@ func TestAttachDetach(t *testing.T) {
|
|||||||
// newPlugin creates a new gcePersistentDiskPlugin with fake cloud, NewAttacher
|
// newPlugin creates a new gcePersistentDiskPlugin with fake cloud, NewAttacher
|
||||||
// and NewDetacher won't work.
|
// and NewDetacher won't work.
|
||||||
func newPlugin() *awsElasticBlockStorePlugin {
|
func newPlugin() *awsElasticBlockStorePlugin {
|
||||||
host := volumetest.NewFakeVolumeHost("/tmp", nil, nil, "")
|
host := volumetest.NewFakeVolumeHost("/tmp", nil, nil)
|
||||||
plugins := ProbeVolumePlugins()
|
plugins := ProbeVolumePlugins()
|
||||||
plugin := plugins[0]
|
plugin := plugins[0]
|
||||||
plugin.Init(host)
|
plugin.Init(host)
|
||||||
|
@ -39,7 +39,7 @@ func TestCanSupport(t *testing.T) {
|
|||||||
}
|
}
|
||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
|
|
||||||
plug, err := plugMgr.FindPluginByName("kubernetes.io/aws-ebs")
|
plug, err := plugMgr.FindPluginByName("kubernetes.io/aws-ebs")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -63,7 +63,7 @@ func TestGetAccessModes(t *testing.T) {
|
|||||||
}
|
}
|
||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
|
|
||||||
plug, err := plugMgr.FindPersistentPluginByName("kubernetes.io/aws-ebs")
|
plug, err := plugMgr.FindPersistentPluginByName("kubernetes.io/aws-ebs")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -112,7 +112,7 @@ func TestPlugin(t *testing.T) {
|
|||||||
}
|
}
|
||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
|
|
||||||
plug, err := plugMgr.FindPluginByName("kubernetes.io/aws-ebs")
|
plug, err := plugMgr.FindPluginByName("kubernetes.io/aws-ebs")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -250,7 +250,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
|
|||||||
}
|
}
|
||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, clientset, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, clientset, nil))
|
||||||
plug, _ := plugMgr.FindPluginByName(awsElasticBlockStorePluginName)
|
plug, _ := plugMgr.FindPluginByName(awsElasticBlockStorePluginName)
|
||||||
|
|
||||||
// readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes
|
// readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes
|
||||||
@ -270,7 +270,7 @@ func TestMounterAndUnmounterTypeAssert(t *testing.T) {
|
|||||||
}
|
}
|
||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
|
|
||||||
plug, err := plugMgr.FindPluginByName("kubernetes.io/aws-ebs")
|
plug, err := plugMgr.FindPluginByName("kubernetes.io/aws-ebs")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -39,7 +39,7 @@ func TestCanSupport(t *testing.T) {
|
|||||||
}
|
}
|
||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
|
|
||||||
plug, err := plugMgr.FindPluginByName(azureDataDiskPluginName)
|
plug, err := plugMgr.FindPluginByName(azureDataDiskPluginName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -106,7 +106,7 @@ func TestPlugin(t *testing.T) {
|
|||||||
}
|
}
|
||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
|
|
||||||
plug, err := plugMgr.FindPluginByName(azureDataDiskPluginName)
|
plug, err := plugMgr.FindPluginByName(azureDataDiskPluginName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -37,7 +37,7 @@ func TestCanSupport(t *testing.T) {
|
|||||||
}
|
}
|
||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
|
|
||||||
plug, err := plugMgr.FindPluginByName("kubernetes.io/azure-file")
|
plug, err := plugMgr.FindPluginByName("kubernetes.io/azure-file")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -61,7 +61,7 @@ func TestGetAccessModes(t *testing.T) {
|
|||||||
}
|
}
|
||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
|
|
||||||
plug, err := plugMgr.FindPersistentPluginByName("kubernetes.io/azure-file")
|
plug, err := plugMgr.FindPersistentPluginByName("kubernetes.io/azure-file")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -88,7 +88,7 @@ func TestPlugin(t *testing.T) {
|
|||||||
}
|
}
|
||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
|
|
||||||
plug, err := plugMgr.FindPluginByName("kubernetes.io/azure-file")
|
plug, err := plugMgr.FindPluginByName("kubernetes.io/azure-file")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -185,7 +185,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
|
|||||||
client := fake.NewSimpleClientset(pv, claim)
|
client := fake.NewSimpleClientset(pv, claim)
|
||||||
|
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost("/tmp/fake", client, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost("/tmp/fake", client, nil))
|
||||||
plug, _ := plugMgr.FindPluginByName(azureFilePluginName)
|
plug, _ := plugMgr.FindPluginByName(azureFilePluginName)
|
||||||
|
|
||||||
// readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes
|
// readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes
|
||||||
@ -211,7 +211,7 @@ func TestMounterAndUnmounterTypeAssert(t *testing.T) {
|
|||||||
}
|
}
|
||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
|
|
||||||
plug, err := plugMgr.FindPluginByName("kubernetes.io/azure-file")
|
plug, err := plugMgr.FindPluginByName("kubernetes.io/azure-file")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -36,7 +36,7 @@ func TestCanSupport(t *testing.T) {
|
|||||||
}
|
}
|
||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
plug, err := plugMgr.FindPluginByName("kubernetes.io/cephfs")
|
plug, err := plugMgr.FindPluginByName("kubernetes.io/cephfs")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Can't find the plugin by name")
|
t.Errorf("Can't find the plugin by name")
|
||||||
@ -59,7 +59,7 @@ func TestPlugin(t *testing.T) {
|
|||||||
}
|
}
|
||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
plug, err := plugMgr.FindPluginByName("kubernetes.io/cephfs")
|
plug, err := plugMgr.FindPluginByName("kubernetes.io/cephfs")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Can't find the plugin by name")
|
t.Errorf("Can't find the plugin by name")
|
||||||
|
@ -219,7 +219,7 @@ func TestAttachDetach(t *testing.T) {
|
|||||||
// newPlugin creates a new gcePersistentDiskPlugin with fake cloud, NewAttacher
|
// newPlugin creates a new gcePersistentDiskPlugin with fake cloud, NewAttacher
|
||||||
// and NewDetacher won't work.
|
// and NewDetacher won't work.
|
||||||
func newPlugin() *cinderPlugin {
|
func newPlugin() *cinderPlugin {
|
||||||
host := volumetest.NewFakeVolumeHost("/tmp", nil, nil, "")
|
host := volumetest.NewFakeVolumeHost("/tmp", nil, nil)
|
||||||
plugins := ProbeVolumePlugins()
|
plugins := ProbeVolumePlugins()
|
||||||
plugin := plugins[0]
|
plugin := plugins[0]
|
||||||
plugin.Init(host)
|
plugin.Init(host)
|
||||||
|
@ -38,7 +38,7 @@ func TestCanSupport(t *testing.T) {
|
|||||||
}
|
}
|
||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
|
|
||||||
plug, err := plugMgr.FindPluginByName("kubernetes.io/cinder")
|
plug, err := plugMgr.FindPluginByName("kubernetes.io/cinder")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -134,7 +134,7 @@ func TestPlugin(t *testing.T) {
|
|||||||
}
|
}
|
||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
|
|
||||||
plug, err := plugMgr.FindPluginByName("kubernetes.io/cinder")
|
plug, err := plugMgr.FindPluginByName("kubernetes.io/cinder")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -244,7 +244,7 @@ func newTestHost(t *testing.T, clientset clientset.Interface) (string, volume.Vo
|
|||||||
t.Fatalf("can't make a temp rootdir: %v", err)
|
t.Fatalf("can't make a temp rootdir: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return tempDir, volumetest.NewFakeVolumeHost(tempDir, clientset, empty_dir.ProbeVolumePlugins(), "" /* rootContext */)
|
return tempDir, volumetest.NewFakeVolumeHost(tempDir, clientset, empty_dir.ProbeVolumePlugins())
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCanSupport(t *testing.T) {
|
func TestCanSupport(t *testing.T) {
|
||||||
|
@ -41,7 +41,7 @@ func newTestHost(t *testing.T, clientset clientset.Interface) (string, volume.Vo
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("can't make a temp rootdir: %v", err)
|
t.Fatalf("can't make a temp rootdir: %v", err)
|
||||||
}
|
}
|
||||||
return tempDir, volumetest.NewFakeVolumeHost(tempDir, clientset, empty_dir.ProbeVolumePlugins(), "" /* rootContext */)
|
return tempDir, volumetest.NewFakeVolumeHost(tempDir, clientset, empty_dir.ProbeVolumePlugins())
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCanSupport(t *testing.T) {
|
func TestCanSupport(t *testing.T) {
|
||||||
|
@ -35,7 +35,7 @@ import (
|
|||||||
// Construct an instance of a plugin, by name.
|
// Construct an instance of a plugin, by name.
|
||||||
func makePluginUnderTest(t *testing.T, plugName, basePath string) volume.VolumePlugin {
|
func makePluginUnderTest(t *testing.T, plugName, basePath string) volume.VolumePlugin {
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(basePath, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(basePath, nil, nil))
|
||||||
|
|
||||||
plug, err := plugMgr.FindPluginByName(plugName)
|
plug, err := plugMgr.FindPluginByName(plugName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -38,7 +38,7 @@ func TestCanSupport(t *testing.T) {
|
|||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
|
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
|
|
||||||
plug, err := plugMgr.FindPluginByName("kubernetes.io/fc")
|
plug, err := plugMgr.FindPluginByName("kubernetes.io/fc")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -60,7 +60,7 @@ func TestGetAccessModes(t *testing.T) {
|
|||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
|
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
|
|
||||||
plug, err := plugMgr.FindPersistentPluginByName("kubernetes.io/fc")
|
plug, err := plugMgr.FindPersistentPluginByName("kubernetes.io/fc")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -131,7 +131,7 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) {
|
|||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
|
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
|
|
||||||
plug, err := plugMgr.FindPluginByName("kubernetes.io/fc")
|
plug, err := plugMgr.FindPluginByName("kubernetes.io/fc")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -274,7 +274,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
|
|||||||
client := fake.NewSimpleClientset(pv, claim)
|
client := fake.NewSimpleClientset(pv, claim)
|
||||||
|
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, client, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, client, nil))
|
||||||
plug, _ := plugMgr.FindPluginByName(fcPluginName)
|
plug, _ := plugMgr.FindPluginByName(fcPluginName)
|
||||||
|
|
||||||
// readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes
|
// readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes
|
||||||
|
@ -182,7 +182,7 @@ func TestCanSupport(t *testing.T) {
|
|||||||
|
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
installPluginUnderTest(t, "kubernetes.io", "fakeAttacher", tmpDir, execScriptTempl1, nil)
|
installPluginUnderTest(t, "kubernetes.io", "fakeAttacher", tmpDir, execScriptTempl1, nil)
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(tmpDir), volumetest.NewFakeVolumeHost("fake", nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(tmpDir), volumetest.NewFakeVolumeHost("fake", nil, nil))
|
||||||
plugin, err := plugMgr.FindPluginByName("kubernetes.io/fakeAttacher")
|
plugin, err := plugMgr.FindPluginByName("kubernetes.io/fakeAttacher")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Can't find the plugin by name")
|
t.Errorf("Can't find the plugin by name")
|
||||||
@ -210,7 +210,7 @@ func TestGetAccessModes(t *testing.T) {
|
|||||||
|
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
installPluginUnderTest(t, "kubernetes.io", "fakeAttacher", tmpDir, execScriptTempl1, nil)
|
installPluginUnderTest(t, "kubernetes.io", "fakeAttacher", tmpDir, execScriptTempl1, nil)
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(tmpDir), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(tmpDir), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
|
|
||||||
plugin, err := plugMgr.FindPersistentPluginByName("kubernetes.io/fakeAttacher")
|
plugin, err := plugMgr.FindPersistentPluginByName("kubernetes.io/fakeAttacher")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -233,7 +233,7 @@ func contains(modes []api.PersistentVolumeAccessMode, mode api.PersistentVolumeA
|
|||||||
func doTestPluginAttachDetach(t *testing.T, spec *volume.Spec, tmpDir string) {
|
func doTestPluginAttachDetach(t *testing.T, spec *volume.Spec, tmpDir string) {
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
installPluginUnderTest(t, "kubernetes.io", "fakeAttacher", tmpDir, execScriptTempl1, nil)
|
installPluginUnderTest(t, "kubernetes.io", "fakeAttacher", tmpDir, execScriptTempl1, nil)
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(tmpDir), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(tmpDir), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
plugin, err := plugMgr.FindPluginByName("kubernetes.io/fakeAttacher")
|
plugin, err := plugMgr.FindPluginByName("kubernetes.io/fakeAttacher")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Can't find the plugin by name")
|
t.Errorf("Can't find the plugin by name")
|
||||||
@ -314,7 +314,7 @@ func doTestPluginMountUnmount(t *testing.T, spec *volume.Spec, tmpDir string) {
|
|||||||
|
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
installPluginUnderTest(t, "kubernetes.io", "fakeMounter", tmpDir, execScriptTempl2, nil)
|
installPluginUnderTest(t, "kubernetes.io", "fakeMounter", tmpDir, execScriptTempl2, nil)
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(tmpDir), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(tmpDir), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
plugin, err := plugMgr.FindPluginByName("kubernetes.io/fakeMounter")
|
plugin, err := plugMgr.FindPluginByName("kubernetes.io/fakeMounter")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Can't find the plugin by name")
|
t.Errorf("Can't find the plugin by name")
|
||||||
|
@ -127,7 +127,7 @@ func newInitializedVolumePlugMgr(t *testing.T) (*volume.VolumePluginMgr, string)
|
|||||||
plugMgr := &volume.VolumePluginMgr{}
|
plugMgr := &volume.VolumePluginMgr{}
|
||||||
dir, err := utiltesting.MkTmpdir("flocker")
|
dir, err := utiltesting.MkTmpdir("flocker")
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(dir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(dir, nil, nil))
|
||||||
return plugMgr, dir
|
return plugMgr, dir
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,7 +138,7 @@ func TestPlugin(t *testing.T) {
|
|||||||
}
|
}
|
||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
|
|
||||||
plug, err := plugMgr.FindPluginByName("kubernetes.io/flocker")
|
plug, err := plugMgr.FindPluginByName("kubernetes.io/flocker")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -34,7 +34,7 @@ func newTestableProvisioner(assert *assert.Assertions, options volume.VolumeOpti
|
|||||||
assert.NoError(err, fmt.Sprintf("can't make a temp dir: %v", err))
|
assert.NoError(err, fmt.Sprintf("can't make a temp dir: %v", err))
|
||||||
|
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
|
|
||||||
plug, err := plugMgr.FindPluginByName(pluginName)
|
plug, err := plugMgr.FindPluginByName(pluginName)
|
||||||
assert.NoError(err, "Can't find the plugin by name")
|
assert.NoError(err, "Can't find the plugin by name")
|
||||||
|
@ -202,8 +202,7 @@ func newPlugin() *gcePersistentDiskPlugin {
|
|||||||
host := volumetest.NewFakeVolumeHost(
|
host := volumetest.NewFakeVolumeHost(
|
||||||
"/tmp", /* rootDir */
|
"/tmp", /* rootDir */
|
||||||
nil, /* kubeClient */
|
nil, /* kubeClient */
|
||||||
nil, /* plugins */
|
nil /* plugins */)
|
||||||
"" /* rootContext */)
|
|
||||||
plugins := ProbeVolumePlugins()
|
plugins := ProbeVolumePlugins()
|
||||||
plugin := plugins[0]
|
plugin := plugins[0]
|
||||||
plugin.Init(host)
|
plugin.Init(host)
|
||||||
|
@ -38,7 +38,7 @@ func TestCanSupport(t *testing.T) {
|
|||||||
}
|
}
|
||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
|
|
||||||
plug, err := plugMgr.FindPluginByName("kubernetes.io/gce-pd")
|
plug, err := plugMgr.FindPluginByName("kubernetes.io/gce-pd")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -62,7 +62,7 @@ func TestGetAccessModes(t *testing.T) {
|
|||||||
}
|
}
|
||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
|
|
||||||
plug, err := plugMgr.FindPersistentPluginByName("kubernetes.io/gce-pd")
|
plug, err := plugMgr.FindPersistentPluginByName("kubernetes.io/gce-pd")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -105,7 +105,7 @@ func TestPlugin(t *testing.T) {
|
|||||||
}
|
}
|
||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
|
|
||||||
plug, err := plugMgr.FindPluginByName("kubernetes.io/gce-pd")
|
plug, err := plugMgr.FindPluginByName("kubernetes.io/gce-pd")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -243,7 +243,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
|
|||||||
}
|
}
|
||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, client, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, client, nil))
|
||||||
plug, _ := plugMgr.FindPluginByName(gcePersistentDiskPluginName)
|
plug, _ := plugMgr.FindPluginByName(gcePersistentDiskPluginName)
|
||||||
|
|
||||||
// readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes
|
// readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes
|
||||||
|
@ -38,7 +38,7 @@ func newTestHost(t *testing.T) (string, volume.VolumeHost) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("can't make a temp rootdir: %v", err)
|
t.Fatalf("can't make a temp rootdir: %v", err)
|
||||||
}
|
}
|
||||||
return tempDir, volumetest.NewFakeVolumeHost(tempDir, nil, empty_dir.ProbeVolumePlugins(), "" /* rootContext */)
|
return tempDir, volumetest.NewFakeVolumeHost(tempDir, nil, empty_dir.ProbeVolumePlugins())
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCanSupport(t *testing.T) {
|
func TestCanSupport(t *testing.T) {
|
||||||
|
@ -42,7 +42,7 @@ func TestCanSupport(t *testing.T) {
|
|||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
|
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
plug, err := plugMgr.FindPluginByName("kubernetes.io/glusterfs")
|
plug, err := plugMgr.FindPluginByName("kubernetes.io/glusterfs")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Can't find the plugin by name")
|
t.Errorf("Can't find the plugin by name")
|
||||||
@ -66,7 +66,7 @@ func TestGetAccessModes(t *testing.T) {
|
|||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
|
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
|
|
||||||
plug, err := plugMgr.FindPersistentPluginByName("kubernetes.io/glusterfs")
|
plug, err := plugMgr.FindPersistentPluginByName("kubernetes.io/glusterfs")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -94,7 +94,7 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) {
|
|||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
|
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
plug, err := plugMgr.FindPluginByName("kubernetes.io/glusterfs")
|
plug, err := plugMgr.FindPluginByName("kubernetes.io/glusterfs")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Can't find the plugin by name")
|
t.Errorf("Can't find the plugin by name")
|
||||||
@ -227,7 +227,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
|
|||||||
client := fake.NewSimpleClientset(pv, claim, ep)
|
client := fake.NewSimpleClientset(pv, claim, ep)
|
||||||
|
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, client, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, client, nil))
|
||||||
plug, _ := plugMgr.FindPluginByName(glusterfsPluginName)
|
plug, _ := plugMgr.FindPluginByName(glusterfsPluginName)
|
||||||
|
|
||||||
// readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes
|
// readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes
|
||||||
|
@ -35,7 +35,7 @@ import (
|
|||||||
|
|
||||||
func TestCanSupport(t *testing.T) {
|
func TestCanSupport(t *testing.T) {
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(volume.VolumeConfig{}), volumetest.NewFakeVolumeHost("fake", nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(volume.VolumeConfig{}), volumetest.NewFakeVolumeHost("fake", nil, nil))
|
||||||
|
|
||||||
plug, err := plugMgr.FindPluginByName("kubernetes.io/host-path")
|
plug, err := plugMgr.FindPluginByName("kubernetes.io/host-path")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -57,7 +57,7 @@ func TestCanSupport(t *testing.T) {
|
|||||||
|
|
||||||
func TestGetAccessModes(t *testing.T) {
|
func TestGetAccessModes(t *testing.T) {
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(volume.VolumeConfig{}), volumetest.NewFakeVolumeHost("/tmp/fake", nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(volume.VolumeConfig{}), volumetest.NewFakeVolumeHost("/tmp/fake", nil, nil))
|
||||||
|
|
||||||
plug, err := plugMgr.FindPersistentPluginByName("kubernetes.io/host-path")
|
plug, err := plugMgr.FindPersistentPluginByName("kubernetes.io/host-path")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -70,7 +70,7 @@ func TestGetAccessModes(t *testing.T) {
|
|||||||
|
|
||||||
func TestRecycler(t *testing.T) {
|
func TestRecycler(t *testing.T) {
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
pluginHost := volumetest.NewFakeVolumeHost("/tmp/fake", nil, nil, "" /* rootContext */)
|
pluginHost := volumetest.NewFakeVolumeHost("/tmp/fake", nil, nil)
|
||||||
plugMgr.InitPlugins([]volume.VolumePlugin{&hostPathPlugin{nil, volumetest.NewFakeRecycler, nil, nil, volume.VolumeConfig{}}}, pluginHost)
|
plugMgr.InitPlugins([]volume.VolumePlugin{&hostPathPlugin{nil, volumetest.NewFakeRecycler, nil, nil, volume.VolumeConfig{}}}, pluginHost)
|
||||||
|
|
||||||
spec := &volume.Spec{PersistentVolume: &api.PersistentVolume{Spec: api.PersistentVolumeSpec{PersistentVolumeSource: api.PersistentVolumeSource{HostPath: &api.HostPathVolumeSource{Path: "/foo"}}}}}
|
spec := &volume.Spec{PersistentVolume: &api.PersistentVolume{Spec: api.PersistentVolumeSpec{PersistentVolumeSource: api.PersistentVolumeSource{HostPath: &api.HostPathVolumeSource{Path: "/foo"}}}}}
|
||||||
@ -100,7 +100,7 @@ func TestDeleter(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(volume.VolumeConfig{}), volumetest.NewFakeVolumeHost("/tmp/fake", nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(volume.VolumeConfig{}), volumetest.NewFakeVolumeHost("/tmp/fake", nil, nil))
|
||||||
|
|
||||||
spec := &volume.Spec{PersistentVolume: &api.PersistentVolume{Spec: api.PersistentVolumeSpec{PersistentVolumeSource: api.PersistentVolumeSource{HostPath: &api.HostPathVolumeSource{Path: tempPath}}}}}
|
spec := &volume.Spec{PersistentVolume: &api.PersistentVolume{Spec: api.PersistentVolumeSpec{PersistentVolumeSource: api.PersistentVolumeSource{HostPath: &api.HostPathVolumeSource{Path: tempPath}}}}}
|
||||||
plug, err := plugMgr.FindDeletablePluginBySpec(spec)
|
plug, err := plugMgr.FindDeletablePluginBySpec(spec)
|
||||||
@ -134,7 +134,7 @@ func TestDeleterTempDir(t *testing.T) {
|
|||||||
|
|
||||||
for name, test := range tests {
|
for name, test := range tests {
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(volume.VolumeConfig{}), volumetest.NewFakeVolumeHost("/tmp/fake", nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(volume.VolumeConfig{}), volumetest.NewFakeVolumeHost("/tmp/fake", nil, nil))
|
||||||
spec := &volume.Spec{PersistentVolume: &api.PersistentVolume{Spec: api.PersistentVolumeSpec{PersistentVolumeSource: api.PersistentVolumeSource{HostPath: &api.HostPathVolumeSource{Path: test.path}}}}}
|
spec := &volume.Spec{PersistentVolume: &api.PersistentVolume{Spec: api.PersistentVolumeSpec{PersistentVolumeSource: api.PersistentVolumeSource{HostPath: &api.HostPathVolumeSource{Path: test.path}}}}}
|
||||||
plug, _ := plugMgr.FindDeletablePluginBySpec(spec)
|
plug, _ := plugMgr.FindDeletablePluginBySpec(spec)
|
||||||
deleter, _ := plug.NewDeleter(spec)
|
deleter, _ := plug.NewDeleter(spec)
|
||||||
@ -155,7 +155,7 @@ func TestProvisioner(t *testing.T) {
|
|||||||
|
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(volume.VolumeConfig{ProvisioningEnabled: true}),
|
plugMgr.InitPlugins(ProbeVolumePlugins(volume.VolumeConfig{ProvisioningEnabled: true}),
|
||||||
volumetest.NewFakeVolumeHost("/tmp/fake", nil, nil, "" /* rootContext */))
|
volumetest.NewFakeVolumeHost("/tmp/fake", nil, nil))
|
||||||
spec := &volume.Spec{PersistentVolume: &api.PersistentVolume{Spec: api.PersistentVolumeSpec{PersistentVolumeSource: api.PersistentVolumeSource{HostPath: &api.HostPathVolumeSource{Path: tempPath}}}}}
|
spec := &volume.Spec{PersistentVolume: &api.PersistentVolume{Spec: api.PersistentVolumeSpec{PersistentVolumeSource: api.PersistentVolumeSource{HostPath: &api.HostPathVolumeSource{Path: tempPath}}}}}
|
||||||
plug, err := plugMgr.FindCreatablePluginBySpec(spec)
|
plug, err := plugMgr.FindCreatablePluginBySpec(spec)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -193,7 +193,7 @@ func TestProvisioner(t *testing.T) {
|
|||||||
|
|
||||||
func TestPlugin(t *testing.T) {
|
func TestPlugin(t *testing.T) {
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(volume.VolumeConfig{}), volumetest.NewFakeVolumeHost("fake", nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(volume.VolumeConfig{}), volumetest.NewFakeVolumeHost("fake", nil, nil))
|
||||||
|
|
||||||
plug, err := plugMgr.FindPluginByName("kubernetes.io/host-path")
|
plug, err := plugMgr.FindPluginByName("kubernetes.io/host-path")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -265,7 +265,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
|
|||||||
client := fake.NewSimpleClientset(pv, claim)
|
client := fake.NewSimpleClientset(pv, claim)
|
||||||
|
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(volume.VolumeConfig{}), volumetest.NewFakeVolumeHost("/tmp/fake", client, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(volume.VolumeConfig{}), volumetest.NewFakeVolumeHost("/tmp/fake", client, nil))
|
||||||
plug, _ := plugMgr.FindPluginByName(hostPathPluginName)
|
plug, _ := plugMgr.FindPluginByName(hostPathPluginName)
|
||||||
|
|
||||||
// readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes
|
// readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes
|
||||||
|
@ -38,7 +38,7 @@ func TestCanSupport(t *testing.T) {
|
|||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
|
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
|
|
||||||
plug, err := plugMgr.FindPluginByName("kubernetes.io/iscsi")
|
plug, err := plugMgr.FindPluginByName("kubernetes.io/iscsi")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -60,7 +60,7 @@ func TestGetAccessModes(t *testing.T) {
|
|||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
|
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
|
|
||||||
plug, err := plugMgr.FindPersistentPluginByName("kubernetes.io/iscsi")
|
plug, err := plugMgr.FindPersistentPluginByName("kubernetes.io/iscsi")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -131,7 +131,7 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) {
|
|||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
|
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
|
|
||||||
plug, err := plugMgr.FindPluginByName("kubernetes.io/iscsi")
|
plug, err := plugMgr.FindPluginByName("kubernetes.io/iscsi")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -274,7 +274,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
|
|||||||
client := fake.NewSimpleClientset(pv, claim)
|
client := fake.NewSimpleClientset(pv, claim)
|
||||||
|
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, client, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, client, nil))
|
||||||
plug, _ := plugMgr.FindPluginByName(iscsiPluginName)
|
plug, _ := plugMgr.FindPluginByName(iscsiPluginName)
|
||||||
|
|
||||||
// readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes
|
// readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes
|
||||||
|
@ -38,7 +38,7 @@ func TestCanSupport(t *testing.T) {
|
|||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
|
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(volume.VolumeConfig{}), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(volume.VolumeConfig{}), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
plug, err := plugMgr.FindPluginByName("kubernetes.io/nfs")
|
plug, err := plugMgr.FindPluginByName("kubernetes.io/nfs")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Can't find the plugin by name")
|
t.Errorf("Can't find the plugin by name")
|
||||||
@ -65,7 +65,7 @@ func TestGetAccessModes(t *testing.T) {
|
|||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
|
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(volume.VolumeConfig{}), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(volume.VolumeConfig{}), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
|
|
||||||
plug, err := plugMgr.FindPersistentPluginByName("kubernetes.io/nfs")
|
plug, err := plugMgr.FindPersistentPluginByName("kubernetes.io/nfs")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -84,7 +84,7 @@ func TestRecycler(t *testing.T) {
|
|||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
|
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins([]volume.VolumePlugin{&nfsPlugin{nil, newMockRecycler, volume.VolumeConfig{}}}, volumetest.NewFakeVolumeHost(tmpDir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins([]volume.VolumePlugin{&nfsPlugin{nil, newMockRecycler, volume.VolumeConfig{}}}, volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
|
|
||||||
spec := &volume.Spec{PersistentVolume: &api.PersistentVolume{Spec: api.PersistentVolumeSpec{PersistentVolumeSource: api.PersistentVolumeSource{NFS: &api.NFSVolumeSource{Path: "/foo"}}}}}
|
spec := &volume.Spec{PersistentVolume: &api.PersistentVolume{Spec: api.PersistentVolumeSpec{PersistentVolumeSource: api.PersistentVolumeSource{NFS: &api.NFSVolumeSource{Path: "/foo"}}}}}
|
||||||
plug, err := plugMgr.FindRecyclablePluginBySpec(spec)
|
plug, err := plugMgr.FindRecyclablePluginBySpec(spec)
|
||||||
@ -141,7 +141,7 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) {
|
|||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
|
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(volume.VolumeConfig{}), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(volume.VolumeConfig{}), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
plug, err := plugMgr.FindPluginByName("kubernetes.io/nfs")
|
plug, err := plugMgr.FindPluginByName("kubernetes.io/nfs")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Can't find the plugin by name")
|
t.Errorf("Can't find the plugin by name")
|
||||||
@ -269,7 +269,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
|
|||||||
client := fake.NewSimpleClientset(pv, claim)
|
client := fake.NewSimpleClientset(pv, claim)
|
||||||
|
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(volume.VolumeConfig{}), volumetest.NewFakeVolumeHost(tmpDir, client, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(volume.VolumeConfig{}), volumetest.NewFakeVolumeHost(tmpDir, client, nil))
|
||||||
plug, _ := plugMgr.FindPluginByName(nfsPluginName)
|
plug, _ := plugMgr.FindPluginByName(nfsPluginName)
|
||||||
|
|
||||||
// readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes
|
// readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes
|
||||||
|
@ -212,12 +212,6 @@ type VolumeHost interface {
|
|||||||
// Returns host IP or nil in the case of error.
|
// Returns host IP or nil in the case of error.
|
||||||
GetHostIP() (net.IP, error)
|
GetHostIP() (net.IP, error)
|
||||||
|
|
||||||
// Returns the rootcontext to use when performing mounts for a volume.
|
|
||||||
// This is a temporary measure in order to set the rootContext of tmpfs
|
|
||||||
// mounts correctly. It will be replaced and expanded on by future
|
|
||||||
// SecurityContext work.
|
|
||||||
GetRootContext() string
|
|
||||||
|
|
||||||
// Returns node allocatable
|
// Returns node allocatable
|
||||||
GetNodeAllocatable() (api.ResourceList, error)
|
GetNodeAllocatable() (api.ResourceList, error)
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ func TestCanSupport(t *testing.T) {
|
|||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
|
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, ""))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
plug, err := plugMgr.FindPluginByName("kubernetes.io/quobyte")
|
plug, err := plugMgr.FindPluginByName("kubernetes.io/quobyte")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Can't find the plugin by name")
|
t.Errorf("Can't find the plugin by name")
|
||||||
@ -62,7 +62,7 @@ func TestGetAccessModes(t *testing.T) {
|
|||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
|
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, ""))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
|
|
||||||
plug, err := plugMgr.FindPersistentPluginByName("kubernetes.io/quobyte")
|
plug, err := plugMgr.FindPersistentPluginByName("kubernetes.io/quobyte")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -90,7 +90,7 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) {
|
|||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
|
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, ""))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
plug, err := plugMgr.FindPluginByName("kubernetes.io/quobyte")
|
plug, err := plugMgr.FindPluginByName("kubernetes.io/quobyte")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Can't find the plugin by name")
|
t.Errorf("Can't find the plugin by name")
|
||||||
@ -186,7 +186,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
|
|||||||
|
|
||||||
client := fake.NewSimpleClientset(pv, claim)
|
client := fake.NewSimpleClientset(pv, claim)
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, client, nil, ""))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, client, nil))
|
||||||
plug, _ := plugMgr.FindPluginByName(quobytePluginName)
|
plug, _ := plugMgr.FindPluginByName(quobytePluginName)
|
||||||
|
|
||||||
// readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes
|
// readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes
|
||||||
|
@ -38,7 +38,7 @@ func TestCanSupport(t *testing.T) {
|
|||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
|
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
|
|
||||||
plug, err := plugMgr.FindPluginByName("kubernetes.io/rbd")
|
plug, err := plugMgr.FindPluginByName("kubernetes.io/rbd")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -103,7 +103,7 @@ func doTestPlugin(t *testing.T, spec *volume.Spec) {
|
|||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
|
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
|
|
||||||
plug, err := plugMgr.FindPluginByName("kubernetes.io/rbd")
|
plug, err := plugMgr.FindPluginByName("kubernetes.io/rbd")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -227,7 +227,7 @@ func TestPersistentClaimReadOnlyFlag(t *testing.T) {
|
|||||||
client := fake.NewSimpleClientset(pv, claim)
|
client := fake.NewSimpleClientset(pv, claim)
|
||||||
|
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, client, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, client, nil))
|
||||||
plug, _ := plugMgr.FindPluginByName(rbdPluginName)
|
plug, _ := plugMgr.FindPluginByName(rbdPluginName)
|
||||||
|
|
||||||
// readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes
|
// readOnly bool is supplied by persistent-claim volume source when its mounter creates other volumes
|
||||||
|
@ -247,7 +247,7 @@ func newTestHost(t *testing.T, clientset clientset.Interface) (string, volume.Vo
|
|||||||
t.Fatalf("can't make a temp rootdir: %v", err)
|
t.Fatalf("can't make a temp rootdir: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return tempDir, volumetest.NewFakeVolumeHost(tempDir, clientset, empty_dir.ProbeVolumePlugins(), "" /* rootContext */)
|
return tempDir, volumetest.NewFakeVolumeHost(tempDir, clientset, empty_dir.ProbeVolumePlugins())
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCanSupport(t *testing.T) {
|
func TestCanSupport(t *testing.T) {
|
||||||
|
@ -42,17 +42,16 @@ import (
|
|||||||
|
|
||||||
// fakeVolumeHost is useful for testing volume plugins.
|
// fakeVolumeHost is useful for testing volume plugins.
|
||||||
type fakeVolumeHost struct {
|
type fakeVolumeHost struct {
|
||||||
rootDir string
|
rootDir string
|
||||||
kubeClient clientset.Interface
|
kubeClient clientset.Interface
|
||||||
pluginMgr VolumePluginMgr
|
pluginMgr VolumePluginMgr
|
||||||
cloud cloudprovider.Interface
|
cloud cloudprovider.Interface
|
||||||
mounter mount.Interface
|
mounter mount.Interface
|
||||||
writer io.Writer
|
writer io.Writer
|
||||||
rootContext string
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewFakeVolumeHost(rootDir string, kubeClient clientset.Interface, plugins []VolumePlugin, rootContext string) *fakeVolumeHost {
|
func NewFakeVolumeHost(rootDir string, kubeClient clientset.Interface, plugins []VolumePlugin) *fakeVolumeHost {
|
||||||
host := &fakeVolumeHost{rootDir: rootDir, kubeClient: kubeClient, cloud: nil, rootContext: rootContext}
|
host := &fakeVolumeHost{rootDir: rootDir, kubeClient: kubeClient, cloud: nil}
|
||||||
host.mounter = &mount.FakeMounter{}
|
host.mounter = &mount.FakeMounter{}
|
||||||
host.writer = &io.StdWriter{}
|
host.writer = &io.StdWriter{}
|
||||||
host.pluginMgr.InitPlugins(plugins, host)
|
host.pluginMgr.InitPlugins(plugins, host)
|
||||||
@ -123,10 +122,6 @@ func (f *fakeVolumeHost) GetHostIP() (net.IP, error) {
|
|||||||
return nil, fmt.Errorf("GetHostIP() not implemented")
|
return nil, fmt.Errorf("GetHostIP() not implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *fakeVolumeHost) GetRootContext() string {
|
|
||||||
return f.rootContext
|
|
||||||
}
|
|
||||||
|
|
||||||
func (f *fakeVolumeHost) GetNodeAllocatable() (api.ResourceList, error) {
|
func (f *fakeVolumeHost) GetNodeAllocatable() (api.ResourceList, error) {
|
||||||
return api.ResourceList{}, nil
|
return api.ResourceList{}, nil
|
||||||
}
|
}
|
||||||
@ -743,7 +738,6 @@ func GetTestVolumePluginMgr(
|
|||||||
"", /* rootDir */
|
"", /* rootDir */
|
||||||
nil, /* kubeClient */
|
nil, /* kubeClient */
|
||||||
nil, /* plugins */
|
nil, /* plugins */
|
||||||
"", /* rootContext */
|
|
||||||
)
|
)
|
||||||
plugins := ProbeVolumePlugins(VolumeConfig{})
|
plugins := ProbeVolumePlugins(VolumeConfig{})
|
||||||
if err := v.pluginMgr.InitPlugins(plugins, v); err != nil {
|
if err := v.pluginMgr.InitPlugins(plugins, v); err != nil {
|
||||||
|
@ -165,7 +165,7 @@ func TestAttachDetach(t *testing.T) {
|
|||||||
// newPlugin creates a new vsphereVolumePlugin with fake cloud, NewAttacher
|
// newPlugin creates a new vsphereVolumePlugin with fake cloud, NewAttacher
|
||||||
// and NewDetacher won't work.
|
// and NewDetacher won't work.
|
||||||
func newPlugin() *vsphereVolumePlugin {
|
func newPlugin() *vsphereVolumePlugin {
|
||||||
host := volumetest.NewFakeVolumeHost("/tmp", nil, nil, "")
|
host := volumetest.NewFakeVolumeHost("/tmp", nil, nil)
|
||||||
plugins := ProbeVolumePlugins()
|
plugins := ProbeVolumePlugins()
|
||||||
plugin := plugins[0]
|
plugin := plugins[0]
|
||||||
plugin.Init(host)
|
plugin.Init(host)
|
||||||
|
@ -37,7 +37,7 @@ func TestCanSupport(t *testing.T) {
|
|||||||
}
|
}
|
||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
|
|
||||||
plug, err := plugMgr.FindPluginByName("kubernetes.io/vsphere-volume")
|
plug, err := plugMgr.FindPluginByName("kubernetes.io/vsphere-volume")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -83,7 +83,7 @@ func TestPlugin(t *testing.T) {
|
|||||||
defer os.RemoveAll(tmpDir)
|
defer os.RemoveAll(tmpDir)
|
||||||
|
|
||||||
plugMgr := volume.VolumePluginMgr{}
|
plugMgr := volume.VolumePluginMgr{}
|
||||||
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil, "" /* rootContext */))
|
plugMgr.InitPlugins(ProbeVolumePlugins(), volumetest.NewFakeVolumeHost(tmpDir, nil, nil))
|
||||||
|
|
||||||
plug, err := plugMgr.FindPluginByName("kubernetes.io/vsphere-volume")
|
plug, err := plugMgr.FindPluginByName("kubernetes.io/vsphere-volume")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -1110,7 +1110,7 @@ func createClients(ns *api.Namespace, t *testing.T, s *httptest.Server, syncPeri
|
|||||||
Burst: 1000000,
|
Burst: 1000000,
|
||||||
})
|
})
|
||||||
|
|
||||||
host := volumetest.NewFakeVolumeHost("/tmp/fake", nil, nil, "" /* rootContext */)
|
host := volumetest.NewFakeVolumeHost("/tmp/fake", nil, nil)
|
||||||
plugin := &volumetest.FakeVolumePlugin{
|
plugin := &volumetest.FakeVolumePlugin{
|
||||||
PluginName: provisionerPluginName,
|
PluginName: provisionerPluginName,
|
||||||
Host: host,
|
Host: host,
|
||||||
|
Loading…
Reference in New Issue
Block a user