Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
657a1a1a
Commit
657a1a1a
authored
Jan 30, 2019
by
danielqsj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change import alias of utils/strings
parent
509bd528
Hide whitespace changes
Inline
Side-by-side
Showing
42 changed files
with
116 additions
and
118 deletions
+116
-118
reconciler_test.go
...troller/volume/attachdetach/reconciler/reconciler_test.go
+2
-2
mount_pod.go
pkg/kubelet/mountpod/mount_pod.go
+2
-2
reconciler.go
pkg/kubelet/volumemanager/reconciler/reconciler.go
+2
-2
aws_ebs.go
pkg/volume/awsebs/aws_ebs.go
+2
-2
aws_ebs_block.go
pkg/volume/awsebs/aws_ebs_block.go
+3
-4
azure_common.go
pkg/volume/azure_dd/azure_common.go
+2
-2
azure_dd_block.go
pkg/volume/azure_dd/azure_dd_block.go
+2
-2
azure_file.go
pkg/volume/azure_file/azure_file.go
+2
-2
azure_provision.go
pkg/volume/azure_file/azure_provision.go
+2
-2
cephfs.go
pkg/volume/cephfs/cephfs.go
+3
-3
cinder.go
pkg/volume/cinder/cinder.go
+2
-2
cinder_block.go
pkg/volume/cinder/cinder_block.go
+2
-2
configmap.go
pkg/volume/configmap/configmap.go
+3
-3
csi_block.go
pkg/volume/csi/csi_block.go
+4
-4
csi_mounter.go
pkg/volume/csi/csi_mounter.go
+3
-3
csi_util.go
pkg/volume/csi/csi_util.go
+3
-4
downwardapi.go
pkg/volume/downwardapi/downwardapi.go
+3
-3
empty_dir.go
pkg/volume/emptydir/empty_dir.go
+3
-3
fc.go
pkg/volume/fc/fc.go
+3
-3
plugin.go
pkg/volume/flexvolume/plugin.go
+4
-4
probe.go
pkg/volume/flexvolume/probe.go
+2
-2
volume.go
pkg/volume/flexvolume/volume.go
+2
-2
flocker.go
pkg/volume/flocker/flocker.go
+4
-4
gce_pd.go
pkg/volume/gcepd/gce_pd.go
+2
-2
gce_pd_block.go
pkg/volume/gcepd/gce_pd_block.go
+2
-2
git_repo.go
pkg/volume/git_repo/git_repo.go
+3
-3
glusterfs.go
pkg/volume/glusterfs/glusterfs.go
+5
-5
iscsi.go
pkg/volume/iscsi/iscsi.go
+4
-4
local.go
pkg/volume/local/local.go
+5
-5
nfs.go
pkg/volume/nfs/nfs.go
+2
-2
photon_pd.go
pkg/volume/photon_pd/photon_pd.go
+2
-2
portworx.go
pkg/volume/portworx/portworx.go
+2
-2
projected.go
pkg/volume/projected/projected.go
+2
-2
quobyte.go
pkg/volume/quobyte/quobyte.go
+4
-4
rbd.go
pkg/volume/rbd/rbd.go
+3
-3
sio_volume.go
pkg/volume/scaleio/sio_volume.go
+2
-2
secret.go
pkg/volume/secret/secret.go
+2
-2
storageos.go
pkg/volume/storageos/storageos.go
+5
-5
testing.go
pkg/volume/testing/testing.go
+4
-4
util.go
pkg/volume/util/util.go
+2
-2
vsphere_volume.go
pkg/volume/vsphere_volume/vsphere_volume.go
+3
-3
vsphere_volume_block.go
pkg/volume/vsphere_volume/vsphere_volume_block.go
+2
-2
No files found.
pkg/controller/volume/attachdetach/reconciler/reconciler_test.go
View file @
657a1a1a
...
...
@@ -32,7 +32,7 @@ import (
volumetesting
"k8s.io/kubernetes/pkg/volume/testing"
"k8s.io/kubernetes/pkg/volume/util/operationexecutor"
"k8s.io/kubernetes/pkg/volume/util/types"
utils
s
trings
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
const
(
...
...
@@ -738,7 +738,7 @@ func Test_ReportMultiAttachError(t *testing.T) {
volumeSpec
:=
controllervolumetesting
.
GetTestVolumeSpec
(
string
(
volumeName
),
volumeName
)
volumeSpec
.
PersistentVolume
.
Spec
.
AccessModes
=
[]
v1
.
PersistentVolumeAccessMode
{
v1
.
ReadWriteOnce
}
uid
:=
string
(
n
.
name
)
+
"-"
+
podName
// unique UID
namespace
,
name
:=
utils
s
trings
.
SplitQualifiedName
(
podName
)
namespace
,
name
:=
utilstrings
.
SplitQualifiedName
(
podName
)
pod
:=
controllervolumetesting
.
NewPod
(
uid
,
name
)
pod
.
Namespace
=
namespace
_
,
err
:=
dsw
.
AddPod
(
types
.
UniquePodName
(
uid
),
pod
,
volumeSpec
,
n
.
name
)
...
...
pkg/kubelet/mountpod/mount_pod.go
View file @
657a1a1a
...
...
@@ -26,7 +26,7 @@ import (
"k8s.io/api/core/v1"
"k8s.io/kubernetes/pkg/kubelet/config"
kubepod
"k8s.io/kubernetes/pkg/kubelet/pod"
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
// Manager is an interface that tracks pods with mount utilities for individual
...
...
@@ -68,7 +68,7 @@ func NewManager(rootDirectory string, podManager kubepod.Manager) (Manager, erro
func
(
m
*
basicManager
)
getVolumePluginRegistrationPath
(
pluginName
string
)
string
{
// sanitize plugin name so it does not escape directory
safePluginName
:=
strings
.
EscapeQualifiedName
(
pluginName
)
+
".json"
safePluginName
:=
util
strings
.
EscapeQualifiedName
(
pluginName
)
+
".json"
return
path
.
Join
(
m
.
registrationDirectory
,
safePluginName
)
}
...
...
pkg/kubelet/volumemanager/reconciler/reconciler.go
View file @
657a1a1a
...
...
@@ -44,7 +44,7 @@ import (
"k8s.io/kubernetes/pkg/volume/util/nestedpendingoperations"
"k8s.io/kubernetes/pkg/volume/util/operationexecutor"
volumetypes
"k8s.io/kubernetes/pkg/volume/util/types"
utils
s
trings
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
// Reconciler runs a periodic loop to reconcile the desired state of the world
...
...
@@ -678,7 +678,7 @@ func getVolumesFromPodDir(podDir string) ([]podVolume, error) {
klog
.
Errorf
(
"Could not read volume plugin directory %q: %v"
,
volumePluginPath
,
err
)
continue
}
unescapePluginName
:=
utils
s
trings
.
UnescapeQualifiedName
(
pluginName
)
unescapePluginName
:=
utilstrings
.
UnescapeQualifiedName
(
pluginName
)
for
_
,
volumeName
:=
range
volumePluginDirs
{
mountPath
:=
path
.
Join
(
volumePluginPath
,
volumeName
)
klog
.
V
(
5
)
.
Infof
(
"podName: %v, mount path from volume plugin directory: %v, "
,
podName
,
mountPath
)
...
...
pkg/volume/awsebs/aws_ebs.go
View file @
657a1a1a
...
...
@@ -37,7 +37,7 @@ import (
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/util"
utils
s
trings
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
// ProbeVolumePlugins is the primary entrypoint for volume plugins.
...
...
@@ -60,7 +60,7 @@ const (
)
func
getPath
(
uid
types
.
UID
,
volName
string
,
host
volume
.
VolumeHost
)
string
{
return
host
.
GetPodVolumeDir
(
uid
,
utils
s
trings
.
EscapeQualifiedName
(
awsElasticBlockStorePluginName
),
volName
)
return
host
.
GetPodVolumeDir
(
uid
,
utilstrings
.
EscapeQualifiedName
(
awsElasticBlockStorePluginName
),
volName
)
}
func
(
plugin
*
awsElasticBlockStorePlugin
)
Init
(
host
volume
.
VolumeHost
)
error
{
...
...
pkg/volume/awsebs/aws_ebs_block.go
View file @
657a1a1a
...
...
@@ -22,16 +22,15 @@ import (
"strconv"
"strings"
"k8s.io/klog"
"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/klog"
"k8s.io/kubernetes/pkg/cloudprovider/providers/aws"
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/util"
"k8s.io/kubernetes/pkg/volume/util/volumepathhandler"
utils
s
trings
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
var
_
volume
.
BlockVolumePlugin
=
&
awsElasticBlockStorePlugin
{}
...
...
@@ -172,5 +171,5 @@ func (ebs *awsElasticBlockStore) GetGlobalMapPath(spec *volume.Spec) (string, er
// path: pods/{podUid}/volumeDevices/kubernetes.io~aws
func
(
ebs
*
awsElasticBlockStore
)
GetPodDeviceMapPath
()
(
string
,
string
)
{
name
:=
awsElasticBlockStorePluginName
return
ebs
.
plugin
.
host
.
GetPodVolumeDeviceDir
(
ebs
.
podUID
,
utils
s
trings
.
EscapeQualifiedName
(
name
)),
ebs
.
volName
return
ebs
.
plugin
.
host
.
GetPodVolumeDeviceDir
(
ebs
.
podUID
,
utilstrings
.
EscapeQualifiedName
(
name
)),
ebs
.
volName
}
pkg/volume/azure_dd/azure_common.go
View file @
657a1a1a
...
...
@@ -34,7 +34,7 @@ import (
"k8s.io/kubernetes/pkg/cloudprovider/providers/azure"
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
const
(
...
...
@@ -66,7 +66,7 @@ var (
)
func
getPath
(
uid
types
.
UID
,
volName
string
,
host
volume
.
VolumeHost
)
string
{
return
host
.
GetPodVolumeDir
(
uid
,
strings
.
EscapeQualifiedName
(
azureDataDiskPluginName
),
volName
)
return
host
.
GetPodVolumeDir
(
uid
,
util
strings
.
EscapeQualifiedName
(
azureDataDiskPluginName
),
volName
)
}
// creates a unique path for disks (even if they share the same *.vhd name)
...
...
pkg/volume/azure_dd/azure_dd_block.go
View file @
657a1a1a
...
...
@@ -28,7 +28,7 @@ import (
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/util"
"k8s.io/kubernetes/pkg/volume/util/volumepathhandler"
utils
s
trings
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
var
_
volume
.
VolumePlugin
=
&
azureDataDiskPlugin
{}
...
...
@@ -157,5 +157,5 @@ func (disk *dataDisk) GetGlobalMapPath(spec *volume.Spec) (string, error) {
// path: pods/{podUid}/volumeDevices/kubernetes.io~azure
func
(
disk
*
dataDisk
)
GetPodDeviceMapPath
()
(
string
,
string
)
{
name
:=
azureDataDiskPluginName
return
disk
.
plugin
.
host
.
GetPodVolumeDeviceDir
(
disk
.
podUID
,
utils
s
trings
.
EscapeQualifiedName
(
name
)),
disk
.
volumeName
return
disk
.
plugin
.
host
.
GetPodVolumeDeviceDir
(
disk
.
podUID
,
utilstrings
.
EscapeQualifiedName
(
name
)),
disk
.
volumeName
}
pkg/volume/azure_file/azure_file.go
View file @
657a1a1a
...
...
@@ -32,7 +32,7 @@ import (
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/volume"
volutil
"k8s.io/kubernetes/pkg/volume/util"
utils
s
trings
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
// ProbeVolumePlugins is the primary endpoint for volume plugins
...
...
@@ -53,7 +53,7 @@ const (
)
func
getPath
(
uid
types
.
UID
,
volName
string
,
host
volume
.
VolumeHost
)
string
{
return
host
.
GetPodVolumeDir
(
uid
,
utils
s
trings
.
EscapeQualifiedName
(
azureFilePluginName
),
volName
)
return
host
.
GetPodVolumeDir
(
uid
,
utilstrings
.
EscapeQualifiedName
(
azureFilePluginName
),
volName
)
}
func
(
plugin
*
azureFilePlugin
)
Init
(
host
volume
.
VolumeHost
)
error
{
...
...
pkg/volume/azure_file/azure_provision.go
View file @
657a1a1a
...
...
@@ -30,7 +30,7 @@ import (
"k8s.io/kubernetes/pkg/cloudprovider/providers/azure"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/util"
utils
s
trings
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
var
_
volume
.
DeletableVolumePlugin
=
&
azureFilePlugin
{}
...
...
@@ -116,7 +116,7 @@ var _ volume.Deleter = &azureFileDeleter{}
func
(
f
*
azureFileDeleter
)
GetPath
()
string
{
name
:=
azureFilePluginName
return
f
.
plugin
.
host
.
GetPodVolumeDir
(
f
.
podUID
,
utils
s
trings
.
EscapeQualifiedName
(
name
),
f
.
volName
)
return
f
.
plugin
.
host
.
GetPodVolumeDir
(
f
.
podUID
,
utilstrings
.
EscapeQualifiedName
(
name
),
f
.
volName
)
}
func
(
f
*
azureFileDeleter
)
Delete
()
error
{
...
...
pkg/volume/cephfs/cephfs.go
View file @
657a1a1a
...
...
@@ -31,7 +31,7 @@ import (
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/util"
utils
s
trings
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
// ProbeVolumePlugins is the primary entrypoint for volume plugins.
...
...
@@ -289,13 +289,13 @@ func (cephfsVolume *cephfsUnmounter) TearDownAt(dir string) error {
// GetPath creates global mount path
func
(
cephfsVolume
*
cephfs
)
GetPath
()
string
{
name
:=
cephfsPluginName
return
cephfsVolume
.
plugin
.
host
.
GetPodVolumeDir
(
cephfsVolume
.
podUID
,
utils
s
trings
.
EscapeQualifiedName
(
name
),
cephfsVolume
.
volName
)
return
cephfsVolume
.
plugin
.
host
.
GetPodVolumeDir
(
cephfsVolume
.
podUID
,
utilstrings
.
EscapeQualifiedName
(
name
),
cephfsVolume
.
volName
)
}
// GetKeyringPath creates cephfuse keyring path
func
(
cephfsVolume
*
cephfs
)
GetKeyringPath
()
string
{
name
:=
cephfsPluginName
volumeDir
:=
cephfsVolume
.
plugin
.
host
.
GetPodVolumeDir
(
cephfsVolume
.
podUID
,
utils
s
trings
.
EscapeQualifiedName
(
name
),
cephfsVolume
.
volName
)
volumeDir
:=
cephfsVolume
.
plugin
.
host
.
GetPodVolumeDir
(
cephfsVolume
.
podUID
,
utilstrings
.
EscapeQualifiedName
(
name
),
cephfsVolume
.
volName
)
volumeKeyringDir
:=
volumeDir
+
"~keyring"
return
volumeKeyringDir
}
...
...
pkg/volume/cinder/cinder.go
View file @
657a1a1a
...
...
@@ -35,7 +35,7 @@ import (
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/util"
"k8s.io/utils/keymutex"
utils
s
trings
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
const
(
...
...
@@ -82,7 +82,7 @@ const (
)
func
getPath
(
uid
types
.
UID
,
volName
string
,
host
volume
.
VolumeHost
)
string
{
return
host
.
GetPodVolumeDir
(
uid
,
utils
s
trings
.
EscapeQualifiedName
(
cinderVolumePluginName
),
volName
)
return
host
.
GetPodVolumeDir
(
uid
,
utilstrings
.
EscapeQualifiedName
(
cinderVolumePluginName
),
volName
)
}
func
(
plugin
*
cinderPlugin
)
Init
(
host
volume
.
VolumeHost
)
error
{
...
...
pkg/volume/cinder/cinder_block.go
View file @
657a1a1a
...
...
@@ -27,7 +27,7 @@ import (
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/util"
"k8s.io/kubernetes/pkg/volume/util/volumepathhandler"
utils
s
trings
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
var
_
volume
.
VolumePlugin
=
&
cinderPlugin
{}
...
...
@@ -163,5 +163,5 @@ func (cd *cinderVolume) GetGlobalMapPath(spec *volume.Spec) (string, error) {
// path: pods/{podUid}/volumeDevices/kubernetes.io~cinder
func
(
cd
*
cinderVolume
)
GetPodDeviceMapPath
()
(
string
,
string
)
{
name
:=
cinderVolumePluginName
return
cd
.
plugin
.
host
.
GetPodVolumeDeviceDir
(
cd
.
podUID
,
utils
s
trings
.
EscapeQualifiedName
(
name
)),
cd
.
volName
return
cd
.
plugin
.
host
.
GetPodVolumeDeviceDir
(
cd
.
podUID
,
utilstrings
.
EscapeQualifiedName
(
name
)),
cd
.
volName
}
pkg/volume/configmap/configmap.go
View file @
657a1a1a
...
...
@@ -27,7 +27,7 @@ import (
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/volume"
volumeutil
"k8s.io/kubernetes/pkg/volume/util"
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
// ProbeVolumePlugins is the entry point for plugin detection in a package.
...
...
@@ -48,7 +48,7 @@ type configMapPlugin struct {
var
_
volume
.
VolumePlugin
=
&
configMapPlugin
{}
func
getPath
(
uid
types
.
UID
,
volName
string
,
host
volume
.
VolumeHost
)
string
{
return
host
.
GetPodVolumeDir
(
uid
,
strings
.
EscapeQualifiedName
(
configMapPluginName
),
volName
)
return
host
.
GetPodVolumeDir
(
uid
,
util
strings
.
EscapeQualifiedName
(
configMapPluginName
),
volName
)
}
func
(
plugin
*
configMapPlugin
)
Init
(
host
volume
.
VolumeHost
)
error
{
...
...
@@ -142,7 +142,7 @@ type configMapVolume struct {
var
_
volume
.
Volume
=
&
configMapVolume
{}
func
(
sv
*
configMapVolume
)
GetPath
()
string
{
return
sv
.
plugin
.
host
.
GetPodVolumeDir
(
sv
.
podUID
,
strings
.
EscapeQualifiedName
(
configMapPluginName
),
sv
.
volName
)
return
sv
.
plugin
.
host
.
GetPodVolumeDir
(
sv
.
podUID
,
util
strings
.
EscapeQualifiedName
(
configMapPluginName
),
sv
.
volName
)
}
// configMapVolumeMounter handles retrieving secrets from the API server
...
...
pkg/volume/csi/csi_block.go
View file @
657a1a1a
...
...
@@ -33,7 +33,7 @@ import (
"k8s.io/client-go/kubernetes"
"k8s.io/kubernetes/pkg/volume"
ioutil
"k8s.io/kubernetes/pkg/volume/util"
utils
s
trings
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
type
csiBlockMapper
struct
{
...
...
@@ -62,21 +62,21 @@ func (m *csiBlockMapper) GetGlobalMapPath(spec *volume.Spec) (string, error) {
// getStagingPath returns a staging path for a directory (on the node) that should be used on NodeStageVolume/NodeUnstageVolume
// Example: plugins/kubernetes.io/csi/volumeDevices/staging/{pvname}
func
(
m
*
csiBlockMapper
)
getStagingPath
()
string
{
sanitizedSpecVolID
:=
utils
s
trings
.
EscapeQualifiedName
(
m
.
specName
)
sanitizedSpecVolID
:=
utilstrings
.
EscapeQualifiedName
(
m
.
specName
)
return
path
.
Join
(
m
.
plugin
.
host
.
GetVolumeDevicePluginDir
(
csiPluginName
),
"staging"
,
sanitizedSpecVolID
)
}
// getPublishPath returns a publish path for a file (on the node) that should be used on NodePublishVolume/NodeUnpublishVolume
// Example: plugins/kubernetes.io/csi/volumeDevices/publish/{pvname}
func
(
m
*
csiBlockMapper
)
getPublishPath
()
string
{
sanitizedSpecVolID
:=
utils
s
trings
.
EscapeQualifiedName
(
m
.
specName
)
sanitizedSpecVolID
:=
utilstrings
.
EscapeQualifiedName
(
m
.
specName
)
return
path
.
Join
(
m
.
plugin
.
host
.
GetVolumeDevicePluginDir
(
csiPluginName
),
"publish"
,
sanitizedSpecVolID
)
}
// GetPodDeviceMapPath returns pod's device file which will be mapped to a volume
// returns: pods/{podUid}/volumeDevices/kubernetes.io~csi, {pvname}
func
(
m
*
csiBlockMapper
)
GetPodDeviceMapPath
()
(
string
,
string
)
{
path
:=
m
.
plugin
.
host
.
GetPodVolumeDeviceDir
(
m
.
podUID
,
utils
s
trings
.
EscapeQualifiedName
(
csiPluginName
))
path
:=
m
.
plugin
.
host
.
GetPodVolumeDeviceDir
(
m
.
podUID
,
utilstrings
.
EscapeQualifiedName
(
csiPluginName
))
specName
:=
m
.
specName
klog
.
V
(
4
)
.
Infof
(
log
(
"blockMapper.GetPodDeviceMapPath [path=%s; name=%s]"
,
path
,
specName
))
return
path
,
specName
...
...
pkg/volume/csi/csi_mounter.go
View file @
657a1a1a
...
...
@@ -32,7 +32,7 @@ import (
"k8s.io/client-go/kubernetes"
"k8s.io/kubernetes/pkg/features"
"k8s.io/kubernetes/pkg/volume"
utils
s
trings
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
//TODO (vladimirvivien) move this in a central loc later
...
...
@@ -79,8 +79,8 @@ func (c *csiMountMgr) GetPath() string {
}
func
getTargetPath
(
uid
types
.
UID
,
specVolumeID
string
,
host
volume
.
VolumeHost
)
string
{
specVolID
:=
utils
s
trings
.
EscapeQualifiedName
(
specVolumeID
)
return
host
.
GetPodVolumeDir
(
uid
,
utils
s
trings
.
EscapeQualifiedName
(
csiPluginName
),
specVolID
)
specVolID
:=
utilstrings
.
EscapeQualifiedName
(
specVolumeID
)
return
host
.
GetPodVolumeDir
(
uid
,
utilstrings
.
EscapeQualifiedName
(
csiPluginName
),
specVolID
)
}
// volume.Mounter methods
...
...
pkg/volume/csi/csi_util.go
View file @
657a1a1a
...
...
@@ -21,7 +21,6 @@ import (
"fmt"
"os"
"path"
"time"
api
"k8s.io/api/core/v1"
...
...
@@ -29,7 +28,7 @@ import (
"k8s.io/client-go/kubernetes"
"k8s.io/klog"
"k8s.io/kubernetes/pkg/volume"
utils
s
trings
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
const
(
...
...
@@ -117,7 +116,7 @@ func log(msg string, parts ...interface{}) string {
// symlink for a block device associated with a given specVolumeID.
// path: plugins/kubernetes.io/csi/volumeDevices/{specVolumeID}/dev
func
getVolumeDevicePluginDir
(
specVolID
string
,
host
volume
.
VolumeHost
)
string
{
sanitizedSpecVolID
:=
utils
s
trings
.
EscapeQualifiedName
(
specVolID
)
sanitizedSpecVolID
:=
utilstrings
.
EscapeQualifiedName
(
specVolID
)
return
path
.
Join
(
host
.
GetVolumeDevicePluginDir
(
csiPluginName
),
sanitizedSpecVolID
,
"dev"
)
}
...
...
@@ -125,7 +124,7 @@ func getVolumeDevicePluginDir(specVolID string, host volume.VolumeHost) string {
// volume data for a block device associated with a given specVolumeID.
// path: plugins/kubernetes.io/csi/volumeDevices/{specVolumeID}/data
func
getVolumeDeviceDataDir
(
specVolID
string
,
host
volume
.
VolumeHost
)
string
{
sanitizedSpecVolID
:=
utils
s
trings
.
EscapeQualifiedName
(
specVolID
)
sanitizedSpecVolID
:=
utilstrings
.
EscapeQualifiedName
(
specVolID
)
return
path
.
Join
(
host
.
GetVolumeDevicePluginDir
(
csiPluginName
),
sanitizedSpecVolID
,
"data"
)
}
...
...
pkg/volume/downwardapi/downwardapi.go
View file @
657a1a1a
...
...
@@ -28,7 +28,7 @@ import (
"k8s.io/kubernetes/pkg/fieldpath"
"k8s.io/kubernetes/pkg/volume"
volumeutil
"k8s.io/kubernetes/pkg/volume/util"
utils
s
trings
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
// ProbeVolumePlugins is the entry point for plugin detection in a package.
...
...
@@ -48,7 +48,7 @@ type downwardAPIPlugin struct {
var
_
volume
.
VolumePlugin
=
&
downwardAPIPlugin
{}
func
getPath
(
uid
types
.
UID
,
volName
string
,
host
volume
.
VolumeHost
)
string
{
return
host
.
GetPodVolumeDir
(
uid
,
utils
s
trings
.
EscapeQualifiedName
(
downwardAPIPluginName
),
volName
)
return
host
.
GetPodVolumeDir
(
uid
,
utilstrings
.
EscapeQualifiedName
(
downwardAPIPluginName
),
volName
)
}
func
wrappedVolumeSpec
()
volume
.
Spec
{
...
...
@@ -288,7 +288,7 @@ func CollectData(items []v1.DownwardAPIVolumeFile, pod *v1.Pod, host volume.Volu
}
func
(
d
*
downwardAPIVolume
)
GetPath
()
string
{
return
d
.
plugin
.
host
.
GetPodVolumeDir
(
d
.
podUID
,
utils
s
trings
.
EscapeQualifiedName
(
downwardAPIPluginName
),
d
.
volName
)
return
d
.
plugin
.
host
.
GetPodVolumeDir
(
d
.
podUID
,
utilstrings
.
EscapeQualifiedName
(
downwardAPIPluginName
),
d
.
volName
)
}
// downwardAPIVolumeCleaner handles cleaning up downwardAPI volumes
...
...
pkg/volume/emptydir/empty_dir.go
View file @
657a1a1a
...
...
@@ -30,7 +30,7 @@ import (
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/volume"
volumeutil
"k8s.io/kubernetes/pkg/volume/util"
utils
s
trings
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
// TODO: in the near future, this will be changed to be more restrictive
...
...
@@ -59,7 +59,7 @@ const (
)
func
getPath
(
uid
types
.
UID
,
volName
string
,
host
volume
.
VolumeHost
)
string
{
return
host
.
GetPodVolumeDir
(
uid
,
utils
s
trings
.
EscapeQualifiedName
(
emptyDirPluginName
),
volName
)
return
host
.
GetPodVolumeDir
(
uid
,
utilstrings
.
EscapeQualifiedName
(
emptyDirPluginName
),
volName
)
}
func
(
plugin
*
emptyDirPlugin
)
Init
(
host
volume
.
VolumeHost
)
error
{
...
...
@@ -420,7 +420,7 @@ func (ed *emptyDir) teardownTmpfsOrHugetlbfs(dir string) error {
}
func
(
ed
*
emptyDir
)
getMetaDir
()
string
{
return
path
.
Join
(
ed
.
plugin
.
host
.
GetPodPluginDir
(
ed
.
pod
.
UID
,
utils
s
trings
.
EscapeQualifiedName
(
emptyDirPluginName
)),
ed
.
volName
)
return
path
.
Join
(
ed
.
plugin
.
host
.
GetPodPluginDir
(
ed
.
pod
.
UID
,
utilstrings
.
EscapeQualifiedName
(
emptyDirPluginName
)),
ed
.
volName
)
}
func
getVolumeSource
(
spec
*
volume
.
Spec
)
(
*
v1
.
EmptyDirVolumeSource
,
bool
)
{
...
...
pkg/volume/fc/fc.go
View file @
657a1a1a
...
...
@@ -32,7 +32,7 @@ import (
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/util"
"k8s.io/kubernetes/pkg/volume/util/volumepathhandler"
utils
s
trings
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
// ProbeVolumePlugins is the primary entrypoint for volume plugins.
...
...
@@ -360,7 +360,7 @@ type fcDisk struct {
func
(
fc
*
fcDisk
)
GetPath
()
string
{
// safe to use PodVolumeDir now: volume teardown occurs before pod is cleaned up
return
fc
.
plugin
.
host
.
GetPodVolumeDir
(
fc
.
podUID
,
utils
s
trings
.
EscapeQualifiedName
(
fcPluginName
),
fc
.
volName
)
return
fc
.
plugin
.
host
.
GetPodVolumeDir
(
fc
.
podUID
,
utilstrings
.
EscapeQualifiedName
(
fcPluginName
),
fc
.
volName
)
}
func
(
fc
*
fcDisk
)
fcGlobalMapPath
(
spec
*
volume
.
Spec
)
(
string
,
error
)
{
...
...
@@ -373,7 +373,7 @@ func (fc *fcDisk) fcGlobalMapPath(spec *volume.Spec) (string, error) {
}
func
(
fc
*
fcDisk
)
fcPodDeviceMapPath
()
(
string
,
string
)
{
return
fc
.
plugin
.
host
.
GetPodVolumeDeviceDir
(
fc
.
podUID
,
utils
s
trings
.
EscapeQualifiedName
(
fcPluginName
)),
fc
.
volName
return
fc
.
plugin
.
host
.
GetPodVolumeDeviceDir
(
fc
.
podUID
,
utilstrings
.
EscapeQualifiedName
(
fcPluginName
)),
fc
.
volName
}
type
fcDiskMounter
struct
{
...
...
pkg/volume/flexvolume/plugin.go
View file @
657a1a1a
...
...
@@ -30,7 +30,7 @@ import (
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/util"
"k8s.io/utils/exec"
utils
s
trings
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
const
(
...
...
@@ -71,7 +71,7 @@ type pluginFactory struct{}
func
(
pluginFactory
)
NewFlexVolumePlugin
(
pluginDir
,
name
string
,
runner
exec
.
Interface
)
(
volume
.
VolumePlugin
,
error
)
{
execPath
:=
path
.
Join
(
pluginDir
,
name
)
driverName
:=
utils
s
trings
.
UnescapeQualifiedName
(
name
)
driverName
:=
utilstrings
.
UnescapeQualifiedName
(
name
)
flexPlugin
:=
&
flexVolumePlugin
{
driverName
:
driverName
,
...
...
@@ -185,7 +185,7 @@ func (plugin *flexVolumePlugin) newMounterInternal(spec *volume.Spec, pod *api.P
var
metricsProvider
volume
.
MetricsProvider
if
plugin
.
capabilities
.
SupportsMetrics
{
metricsProvider
=
volume
.
NewMetricsStatFS
(
plugin
.
host
.
GetPodVolumeDir
(
pod
.
UID
,
utils
s
trings
.
EscapeQualifiedName
(
sourceDriver
),
spec
.
Name
()))
pod
.
UID
,
utilstrings
.
EscapeQualifiedName
(
sourceDriver
),
spec
.
Name
()))
}
else
{
metricsProvider
=
&
volume
.
MetricsNil
{}
}
...
...
@@ -219,7 +219,7 @@ func (plugin *flexVolumePlugin) newUnmounterInternal(volName string, podUID type
var
metricsProvider
volume
.
MetricsProvider
if
plugin
.
capabilities
.
SupportsMetrics
{
metricsProvider
=
volume
.
NewMetricsStatFS
(
plugin
.
host
.
GetPodVolumeDir
(
podUID
,
utils
s
trings
.
EscapeQualifiedName
(
plugin
.
driverName
),
volName
))
podUID
,
utilstrings
.
EscapeQualifiedName
(
plugin
.
driverName
),
volName
))
}
else
{
metricsProvider
=
&
volume
.
MetricsNil
{}
}
...
...
pkg/volume/flexvolume/probe.go
View file @
657a1a1a
...
...
@@ -29,7 +29,7 @@ import (
utilfs
"k8s.io/kubernetes/pkg/util/filesystem"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/utils/exec"
utils
s
trings
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
type
flexVolumeProber
struct
{
...
...
@@ -139,7 +139,7 @@ func (prober *flexVolumeProber) newProbeEvent(driverDirName string, op volume.Pr
probeEvent
.
Plugin
=
plugin
probeEvent
.
PluginName
=
plugin
.
GetPluginName
()
}
else
if
op
==
volume
.
ProbeRemove
{
driverName
:=
utils
s
trings
.
UnescapeQualifiedName
(
driverDirName
)
driverName
:=
utilstrings
.
UnescapeQualifiedName
(
driverDirName
)
probeEvent
.
PluginName
=
flexVolumePluginNamePrefix
+
driverName
}
else
{
...
...
pkg/volume/flexvolume/volume.go
View file @
657a1a1a
...
...
@@ -20,7 +20,7 @@ import (
"k8s.io/apimachinery/pkg/types"
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/volume"
utils
s
trings
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
type
flexVolume
struct
{
...
...
@@ -51,5 +51,5 @@ type flexVolume struct {
func
(
f
*
flexVolume
)
GetPath
()
string
{
name
:=
f
.
driverName
return
f
.
plugin
.
host
.
GetPodVolumeDir
(
f
.
podUID
,
utils
s
trings
.
EscapeQualifiedName
(
name
),
f
.
volName
)
return
f
.
plugin
.
host
.
GetPodVolumeDir
(
f
.
podUID
,
utilstrings
.
EscapeQualifiedName
(
name
),
f
.
volName
)
}
pkg/volume/flocker/flocker.go
View file @
657a1a1a
...
...
@@ -22,15 +22,15 @@ import (
"path"
"time"
flockerapi
"github.com/clusterhq/flocker-go"
"k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/klog"
"k8s.io/kubernetes/pkg/util/env"
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/utils/strings"
flockerapi
"github.com/clusterhq/flocker-go"
utilstrings
"k8s.io/utils/strings"
)
// ProbeVolumePlugins is the primary entrypoint for volume plugins.
...
...
@@ -77,7 +77,7 @@ const (
)
func
getPath
(
uid
types
.
UID
,
volName
string
,
host
volume
.
VolumeHost
)
string
{
return
host
.
GetPodVolumeDir
(
uid
,
strings
.
EscapeQualifiedName
(
flockerPluginName
),
volName
)
return
host
.
GetPodVolumeDir
(
uid
,
util
strings
.
EscapeQualifiedName
(
flockerPluginName
),
volName
)
}
func
makeGlobalFlockerPath
(
datasetUUID
string
)
string
{
...
...
pkg/volume/gcepd/gce_pd.go
View file @
657a1a1a
...
...
@@ -36,7 +36,7 @@ import (
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/util"
utils
s
trings
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
// ProbeVolumePlugins is the primary entrypoint for volume plugins.
...
...
@@ -72,7 +72,7 @@ const (
)
func
getPath
(
uid
types
.
UID
,
volName
string
,
host
volume
.
VolumeHost
)
string
{
return
host
.
GetPodVolumeDir
(
uid
,
utils
s
trings
.
EscapeQualifiedName
(
gcePersistentDiskPluginName
),
volName
)
return
host
.
GetPodVolumeDir
(
uid
,
utilstrings
.
EscapeQualifiedName
(
gcePersistentDiskPluginName
),
volName
)
}
func
(
plugin
*
gcePersistentDiskPlugin
)
Init
(
host
volume
.
VolumeHost
)
error
{
...
...
pkg/volume/gcepd/gce_pd_block.go
View file @
657a1a1a
...
...
@@ -29,7 +29,7 @@ import (
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/util"
"k8s.io/kubernetes/pkg/volume/util/volumepathhandler"
utils
s
trings
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
var
_
volume
.
VolumePlugin
=
&
gcePersistentDiskPlugin
{}
...
...
@@ -170,5 +170,5 @@ func (pd *gcePersistentDisk) GetGlobalMapPath(spec *volume.Spec) (string, error)
// path: pods/{podUid}/volumeDevices/kubernetes.io~aws
func
(
pd
*
gcePersistentDisk
)
GetPodDeviceMapPath
()
(
string
,
string
)
{
name
:=
gcePersistentDiskPluginName
return
pd
.
plugin
.
host
.
GetPodVolumeDeviceDir
(
pd
.
podUID
,
utils
s
trings
.
EscapeQualifiedName
(
name
)),
pd
.
volName
return
pd
.
plugin
.
host
.
GetPodVolumeDeviceDir
(
pd
.
podUID
,
utilstrings
.
EscapeQualifiedName
(
name
)),
pd
.
volName
}
pkg/volume/git_repo/git_repo.go
View file @
657a1a1a
...
...
@@ -28,7 +28,7 @@ import (
"k8s.io/kubernetes/pkg/volume"
volumeutil
"k8s.io/kubernetes/pkg/volume/util"
"k8s.io/utils/exec"
utils
s
trings
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
// This is the primary entrypoint for volume plugins.
...
...
@@ -147,7 +147,7 @@ var _ volume.Volume = &gitRepoVolume{}
func
(
gr
*
gitRepoVolume
)
GetPath
()
string
{
name
:=
gitRepoPluginName
return
gr
.
plugin
.
host
.
GetPodVolumeDir
(
gr
.
podUID
,
utils
s
trings
.
EscapeQualifiedName
(
name
),
gr
.
volName
)
return
gr
.
plugin
.
host
.
GetPodVolumeDir
(
gr
.
podUID
,
utilstrings
.
EscapeQualifiedName
(
name
),
gr
.
volName
)
}
// gitRepoVolumeMounter builds git repo volumes.
...
...
@@ -248,7 +248,7 @@ func (b *gitRepoVolumeMounter) SetUpAt(dir string, fsGroup *int64) error {
}
func
(
b
*
gitRepoVolumeMounter
)
getMetaDir
()
string
{
return
path
.
Join
(
b
.
plugin
.
host
.
GetPodPluginDir
(
b
.
podUID
,
utils
s
trings
.
EscapeQualifiedName
(
gitRepoPluginName
)),
b
.
volName
)
return
path
.
Join
(
b
.
plugin
.
host
.
GetPodPluginDir
(
b
.
podUID
,
utilstrings
.
EscapeQualifiedName
(
gitRepoPluginName
)),
b
.
volName
)
}
func
(
b
*
gitRepoVolumeMounter
)
execCommand
(
command
string
,
args
[]
string
,
dir
string
)
([]
byte
,
error
)
{
...
...
pkg/volume/glusterfs/glusterfs.go
View file @
657a1a1a
...
...
@@ -42,7 +42,7 @@ import (
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/volume"
volutil
"k8s.io/kubernetes/pkg/volume/util"
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
// ProbeVolumePlugins is the primary entrypoint for volume plugins.
...
...
@@ -200,7 +200,7 @@ func (plugin *glusterfsPlugin) newMounterInternal(spec *volume.Spec, ep *v1.Endp
mounter
:
mounter
,
pod
:
pod
,
plugin
:
plugin
,
MetricsProvider
:
volume
.
NewMetricsStatFS
(
plugin
.
host
.
GetPodVolumeDir
(
pod
.
UID
,
strings
.
EscapeQualifiedName
(
glusterfsPluginName
),
spec
.
Name
())),
MetricsProvider
:
volume
.
NewMetricsStatFS
(
plugin
.
host
.
GetPodVolumeDir
(
pod
.
UID
,
util
strings
.
EscapeQualifiedName
(
glusterfsPluginName
),
spec
.
Name
())),
},
hosts
:
ep
,
path
:
volPath
,
...
...
@@ -219,7 +219,7 @@ func (plugin *glusterfsPlugin) newUnmounterInternal(volName string, podUID types
mounter
:
mounter
,
pod
:
&
v1
.
Pod
{
ObjectMeta
:
metav1
.
ObjectMeta
{
UID
:
podUID
}},
plugin
:
plugin
,
MetricsProvider
:
volume
.
NewMetricsStatFS
(
plugin
.
host
.
GetPodVolumeDir
(
podUID
,
strings
.
EscapeQualifiedName
(
glusterfsPluginName
),
volName
)),
MetricsProvider
:
volume
.
NewMetricsStatFS
(
plugin
.
host
.
GetPodVolumeDir
(
podUID
,
util
strings
.
EscapeQualifiedName
(
glusterfsPluginName
),
volName
)),
}},
nil
}
...
...
@@ -301,7 +301,7 @@ func (b *glusterfsMounter) SetUpAt(dir string, fsGroup *int64) error {
func
(
glusterfsVolume
*
glusterfs
)
GetPath
()
string
{
name
:=
glusterfsPluginName
return
glusterfsVolume
.
plugin
.
host
.
GetPodVolumeDir
(
glusterfsVolume
.
pod
.
UID
,
strings
.
EscapeQualifiedName
(
name
),
glusterfsVolume
.
volName
)
return
glusterfsVolume
.
plugin
.
host
.
GetPodVolumeDir
(
glusterfsVolume
.
pod
.
UID
,
util
strings
.
EscapeQualifiedName
(
name
),
glusterfsVolume
.
volName
)
}
type
glusterfsUnmounter
struct
{
...
...
@@ -542,7 +542,7 @@ type glusterfsVolumeDeleter struct {
func
(
d
*
glusterfsVolumeDeleter
)
GetPath
()
string
{
name
:=
glusterfsPluginName
return
d
.
plugin
.
host
.
GetPodVolumeDir
(
d
.
glusterfsMounter
.
glusterfs
.
pod
.
UID
,
strings
.
EscapeQualifiedName
(
name
),
d
.
glusterfsMounter
.
glusterfs
.
volName
)
return
d
.
plugin
.
host
.
GetPodVolumeDir
(
d
.
glusterfsMounter
.
glusterfs
.
pod
.
UID
,
util
strings
.
EscapeQualifiedName
(
name
),
d
.
glusterfsMounter
.
glusterfs
.
volName
)
}
// Traverse the PVs, fetching all the GIDs from those
...
...
pkg/volume/iscsi/iscsi.go
View file @
657a1a1a
...
...
@@ -32,7 +32,7 @@ import (
ioutil
"k8s.io/kubernetes/pkg/volume/util"
"k8s.io/kubernetes/pkg/volume/util/volumepathhandler"
"k8s.io/utils/keymutex"
utils
s
trings
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
// This is the primary entrypoint for volume plugins.
...
...
@@ -181,7 +181,7 @@ func (plugin *iscsiPlugin) newUnmounterInternal(volName string, podUID types.UID
VolName
:
volName
,
manager
:
manager
,
plugin
:
plugin
,
MetricsProvider
:
volume
.
NewMetricsStatFS
(
plugin
.
host
.
GetPodVolumeDir
(
podUID
,
utils
s
trings
.
EscapeQualifiedName
(
iscsiPluginName
),
volName
)),
MetricsProvider
:
volume
.
NewMetricsStatFS
(
plugin
.
host
.
GetPodVolumeDir
(
podUID
,
utilstrings
.
EscapeQualifiedName
(
iscsiPluginName
),
volName
)),
},
mounter
:
mounter
,
exec
:
exec
,
...
...
@@ -285,7 +285,7 @@ type iscsiDisk struct {
func
(
iscsi
*
iscsiDisk
)
GetPath
()
string
{
name
:=
iscsiPluginName
// safe to use PodVolumeDir now: volume teardown occurs before pod is cleaned up
return
iscsi
.
plugin
.
host
.
GetPodVolumeDir
(
iscsi
.
podUID
,
utils
s
trings
.
EscapeQualifiedName
(
name
),
iscsi
.
VolName
)
return
iscsi
.
plugin
.
host
.
GetPodVolumeDir
(
iscsi
.
podUID
,
utilstrings
.
EscapeQualifiedName
(
name
),
iscsi
.
VolName
)
}
func
(
iscsi
*
iscsiDisk
)
iscsiGlobalMapPath
(
spec
*
volume
.
Spec
)
(
string
,
error
)
{
...
...
@@ -299,7 +299,7 @@ func (iscsi *iscsiDisk) iscsiGlobalMapPath(spec *volume.Spec) (string, error) {
func
(
iscsi
*
iscsiDisk
)
iscsiPodDeviceMapPath
()
(
string
,
string
)
{
name
:=
iscsiPluginName
return
iscsi
.
plugin
.
host
.
GetPodVolumeDeviceDir
(
iscsi
.
podUID
,
utils
s
trings
.
EscapeQualifiedName
(
name
)),
iscsi
.
VolName
return
iscsi
.
plugin
.
host
.
GetPodVolumeDeviceDir
(
iscsi
.
podUID
,
utilstrings
.
EscapeQualifiedName
(
name
)),
iscsi
.
VolName
}
type
iscsiDiskMounter
struct
{
...
...
pkg/volume/local/local.go
View file @
657a1a1a
...
...
@@ -35,7 +35,7 @@ import (
"k8s.io/kubernetes/pkg/volume/util"
"k8s.io/kubernetes/pkg/volume/validation"
"k8s.io/utils/keymutex"
utils
s
trings
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
const
(
...
...
@@ -132,7 +132,7 @@ func (plugin *localVolumePlugin) NewMounter(spec *volume.Spec, pod *v1.Pod, _ vo
mounter
:
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()),
plugin
:
plugin
,
globalPath
:
globalLocalPath
,
MetricsProvider
:
volume
.
NewMetricsStatFS
(
plugin
.
host
.
GetPodVolumeDir
(
pod
.
UID
,
utils
s
trings
.
EscapeQualifiedName
(
localVolumePluginName
),
spec
.
Name
())),
MetricsProvider
:
volume
.
NewMetricsStatFS
(
plugin
.
host
.
GetPodVolumeDir
(
pod
.
UID
,
utilstrings
.
EscapeQualifiedName
(
localVolumePluginName
),
spec
.
Name
())),
},
mountOptions
:
util
.
MountOptionFromSpec
(
spec
),
readOnly
:
readOnly
,
...
...
@@ -392,7 +392,7 @@ type localVolume struct {
}
func
(
l
*
localVolume
)
GetPath
()
string
{
return
l
.
plugin
.
host
.
GetPodVolumeDir
(
l
.
podUID
,
utils
s
trings
.
EscapeQualifiedName
(
localVolumePluginName
),
l
.
volName
)
return
l
.
plugin
.
host
.
GetPodVolumeDir
(
l
.
podUID
,
utilstrings
.
EscapeQualifiedName
(
localVolumePluginName
),
l
.
volName
)
}
type
localVolumeMounter
struct
{
...
...
@@ -584,7 +584,7 @@ func (u *localVolumeUnmapper) TearDownDevice(mapPath, _ string) error {
// GetGlobalMapPath returns global map path and error.
// path: plugins/kubernetes.io/kubernetes.io/local-volume/volumeDevices/{volumeName}
func
(
lv
*
localVolume
)
GetGlobalMapPath
(
spec
*
volume
.
Spec
)
(
string
,
error
)
{
return
filepath
.
Join
(
lv
.
plugin
.
host
.
GetVolumeDevicePluginDir
(
utils
s
trings
.
EscapeQualifiedName
(
localVolumePluginName
)),
return
filepath
.
Join
(
lv
.
plugin
.
host
.
GetVolumeDevicePluginDir
(
utilstrings
.
EscapeQualifiedName
(
localVolumePluginName
)),
lv
.
volName
),
nil
}
...
...
@@ -593,5 +593,5 @@ func (lv *localVolume) GetGlobalMapPath(spec *volume.Spec) (string, error) {
// volName: local-pv-ff0d6d4
func
(
lv
*
localVolume
)
GetPodDeviceMapPath
()
(
string
,
string
)
{
return
lv
.
plugin
.
host
.
GetPodVolumeDeviceDir
(
lv
.
podUID
,
utils
s
trings
.
EscapeQualifiedName
(
localVolumePluginName
)),
lv
.
volName
utilstrings
.
EscapeQualifiedName
(
localVolumePluginName
)),
lv
.
volName
}
pkg/volume/nfs/nfs.go
View file @
657a1a1a
...
...
@@ -29,7 +29,7 @@ import (
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/util"
"k8s.io/kubernetes/pkg/volume/util/recyclerclient"
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
// This is the primary entrypoint for volume plugins.
...
...
@@ -189,7 +189,7 @@ type nfs struct {
func
(
nfsVolume
*
nfs
)
GetPath
()
string
{
name
:=
nfsPluginName
return
nfsVolume
.
plugin
.
host
.
GetPodVolumeDir
(
nfsVolume
.
pod
.
UID
,
strings
.
EscapeQualifiedName
(
name
),
nfsVolume
.
volName
)
return
nfsVolume
.
plugin
.
host
.
GetPodVolumeDir
(
nfsVolume
.
pod
.
UID
,
util
strings
.
EscapeQualifiedName
(
name
),
nfsVolume
.
volName
)
}
// Checks prior to mount operations to verify that the required components (binaries, etc.)
...
...
pkg/volume/photon_pd/photon_pd.go
View file @
657a1a1a
...
...
@@ -29,7 +29,7 @@ import (
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/util"
utils
s
trings
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
// This is the primary entrypoint for volume plugins.
...
...
@@ -290,7 +290,7 @@ func makeGlobalPDPath(host volume.VolumeHost, devName string) string {
func
(
ppd
*
photonPersistentDisk
)
GetPath
()
string
{
name
:=
photonPersistentDiskPluginName
return
ppd
.
plugin
.
host
.
GetPodVolumeDir
(
ppd
.
podUID
,
utils
s
trings
.
EscapeQualifiedName
(
name
),
ppd
.
volName
)
return
ppd
.
plugin
.
host
.
GetPodVolumeDir
(
ppd
.
podUID
,
utilstrings
.
EscapeQualifiedName
(
name
),
ppd
.
volName
)
}
// TODO: supporting more access mode for PhotonController persistent disk
...
...
pkg/volume/portworx/portworx.go
View file @
657a1a1a
...
...
@@ -29,7 +29,7 @@ import (
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/util"
utils
s
trings
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
const
(
...
...
@@ -58,7 +58,7 @@ const (
)
func
getPath
(
uid
types
.
UID
,
volName
string
,
host
volume
.
VolumeHost
)
string
{
return
host
.
GetPodVolumeDir
(
uid
,
utils
s
trings
.
EscapeQualifiedName
(
portworxVolumePluginName
),
volName
)
return
host
.
GetPodVolumeDir
(
uid
,
utilstrings
.
EscapeQualifiedName
(
portworxVolumePluginName
),
volName
)
}
func
(
plugin
*
portworxVolumePlugin
)
Init
(
host
volume
.
VolumeHost
)
error
{
...
...
pkg/volume/projected/projected.go
View file @
657a1a1a
...
...
@@ -33,7 +33,7 @@ import (
"k8s.io/kubernetes/pkg/volume/downwardapi"
"k8s.io/kubernetes/pkg/volume/secret"
volumeutil
"k8s.io/kubernetes/pkg/volume/util"
utils
s
trings
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
// ProbeVolumePlugins is the entry point for plugin detection in a package.
...
...
@@ -66,7 +66,7 @@ func wrappedVolumeSpec() volume.Spec {
}
func
getPath
(
uid
types
.
UID
,
volName
string
,
host
volume
.
VolumeHost
)
string
{
return
host
.
GetPodVolumeDir
(
uid
,
utils
s
trings
.
EscapeQualifiedName
(
projectedPluginName
),
volName
)
return
host
.
GetPodVolumeDir
(
uid
,
utilstrings
.
EscapeQualifiedName
(
projectedPluginName
),
volName
)
}
func
(
plugin
*
projectedPlugin
)
Init
(
host
volume
.
VolumeHost
)
error
{
...
...
pkg/volume/quobyte/quobyte.go
View file @
657a1a1a
...
...
@@ -31,7 +31,7 @@ import (
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/util"
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
// ProbeVolumePlugins is the primary entrypoint for volume plugins.
...
...
@@ -92,7 +92,7 @@ func (plugin *quobytePlugin) CanSupport(spec *volume.Spec) bool {
// If Quobyte is already mounted we don't need to check if the binary is installed
if
mounter
,
err
:=
plugin
.
newMounterInternal
(
spec
,
nil
,
plugin
.
host
.
GetMounter
(
plugin
.
GetPluginName
()));
err
==
nil
{
qm
,
_
:=
mounter
.
(
*
quobyteMounter
)
pluginDir
:=
plugin
.
host
.
GetPluginDir
(
strings
.
EscapeQualifiedName
(
quobytePluginName
))
pluginDir
:=
plugin
.
host
.
GetPluginDir
(
util
strings
.
EscapeQualifiedName
(
quobytePluginName
))
if
mounted
,
err
:=
qm
.
pluginDirIsMounted
(
pluginDir
);
mounted
&&
err
==
nil
{
klog
.
V
(
4
)
.
Infof
(
"quobyte: can support"
)
return
true
...
...
@@ -238,7 +238,7 @@ func (mounter *quobyteMounter) CanMount() error {
// SetUp attaches the disk and bind mounts to the volume path.
func
(
mounter
*
quobyteMounter
)
SetUp
(
fsGroup
*
int64
)
error
{
pluginDir
:=
mounter
.
plugin
.
host
.
GetPluginDir
(
strings
.
EscapeQualifiedName
(
quobytePluginName
))
pluginDir
:=
mounter
.
plugin
.
host
.
GetPluginDir
(
util
strings
.
EscapeQualifiedName
(
quobytePluginName
))
return
mounter
.
SetUpAt
(
pluginDir
,
fsGroup
)
}
...
...
@@ -284,7 +284,7 @@ func (quobyteVolume *quobyte) GetPath() string {
// Quobyte has only one mount in the PluginDir where all Volumes are mounted
// The Quobyte client does a fixed-user mapping
pluginDir
:=
quobyteVolume
.
plugin
.
host
.
GetPluginDir
(
strings
.
EscapeQualifiedName
(
quobytePluginName
))
pluginDir
:=
quobyteVolume
.
plugin
.
host
.
GetPluginDir
(
util
strings
.
EscapeQualifiedName
(
quobytePluginName
))
return
path
.
Join
(
pluginDir
,
fmt
.
Sprintf
(
"%s#%s@%s"
,
user
,
group
,
quobyteVolume
.
volume
))
}
...
...
pkg/volume/rbd/rbd.go
View file @
657a1a1a
...
...
@@ -37,7 +37,7 @@ import (
"k8s.io/kubernetes/pkg/volume"
volutil
"k8s.io/kubernetes/pkg/volume/util"
"k8s.io/kubernetes/pkg/volume/util/volumepathhandler"
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
var
(
...
...
@@ -75,7 +75,7 @@ const (
)
func
getPath
(
uid
types
.
UID
,
volName
string
,
host
volume
.
VolumeHost
)
string
{
return
host
.
GetPodVolumeDir
(
uid
,
strings
.
EscapeQualifiedName
(
rbdPluginName
),
volName
)
return
host
.
GetPodVolumeDir
(
uid
,
util
strings
.
EscapeQualifiedName
(
rbdPluginName
),
volName
)
}
func
(
plugin
*
rbdPlugin
)
Init
(
host
volume
.
VolumeHost
)
error
{
...
...
@@ -930,7 +930,7 @@ func (rbd *rbd) rbdGlobalMapPath(spec *volume.Spec) (string, error) {
func
(
rbd
*
rbd
)
rbdPodDeviceMapPath
()
(
string
,
string
)
{
name
:=
rbdPluginName
return
rbd
.
plugin
.
host
.
GetPodVolumeDeviceDir
(
rbd
.
podUID
,
strings
.
EscapeQualifiedName
(
name
)),
rbd
.
volName
return
rbd
.
plugin
.
host
.
GetPodVolumeDeviceDir
(
rbd
.
podUID
,
util
strings
.
EscapeQualifiedName
(
name
)),
rbd
.
volName
}
type
rbdDiskUnmapper
struct
{
...
...
pkg/volume/scaleio/sio_volume.go
View file @
657a1a1a
...
...
@@ -32,7 +32,7 @@ import (
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/util"
utils
s
trings
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
type
sioVolume
struct
{
...
...
@@ -61,7 +61,7 @@ var _ volume.Volume = &sioVolume{}
func
(
v
*
sioVolume
)
GetPath
()
string
{
return
v
.
plugin
.
host
.
GetPodVolumeDir
(
v
.
podUID
,
utils
s
trings
.
EscapeQualifiedName
(
sioPluginName
),
utilstrings
.
EscapeQualifiedName
(
sioPluginName
),
v
.
volSpecName
)
}
...
...
pkg/volume/secret/secret.go
View file @
657a1a1a
...
...
@@ -27,7 +27,7 @@ import (
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/volume"
volumeutil
"k8s.io/kubernetes/pkg/volume/util"
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
// ProbeVolumePlugins is the entry point for plugin detection in a package.
...
...
@@ -54,7 +54,7 @@ func wrappedVolumeSpec() volume.Spec {
}
func
getPath
(
uid
types
.
UID
,
volName
string
,
host
volume
.
VolumeHost
)
string
{
return
host
.
GetPodVolumeDir
(
uid
,
strings
.
EscapeQualifiedName
(
secretPluginName
),
volName
)
return
host
.
GetPodVolumeDir
(
uid
,
util
strings
.
EscapeQualifiedName
(
secretPluginName
),
volName
)
}
func
(
plugin
*
secretPlugin
)
Init
(
host
volume
.
VolumeHost
)
error
{
...
...
pkg/volume/storageos/storageos.go
View file @
657a1a1a
...
...
@@ -33,7 +33,7 @@ import (
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/util"
utils
s
trings
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
// ProbeVolumePlugins is the primary entrypoint for volume plugins.
...
...
@@ -63,9 +63,9 @@ const (
func
getPath
(
uid
types
.
UID
,
volNamespace
string
,
volName
string
,
pvName
string
,
host
volume
.
VolumeHost
)
string
{
if
len
(
volNamespace
)
!=
0
&&
len
(
volName
)
!=
0
&&
strings
.
Count
(
volName
,
"."
)
==
0
{
return
host
.
GetPodVolumeDir
(
uid
,
utils
s
trings
.
EscapeQualifiedName
(
storageosPluginName
),
pvName
+
"."
+
volNamespace
+
"."
+
volName
)
return
host
.
GetPodVolumeDir
(
uid
,
utilstrings
.
EscapeQualifiedName
(
storageosPluginName
),
pvName
+
"."
+
volNamespace
+
"."
+
volName
)
}
return
host
.
GetPodVolumeDir
(
uid
,
utils
s
trings
.
EscapeQualifiedName
(
storageosPluginName
),
pvName
)
return
host
.
GetPodVolumeDir
(
uid
,
utilstrings
.
EscapeQualifiedName
(
storageosPluginName
),
pvName
)
}
func
(
plugin
*
storageosPlugin
)
Init
(
host
volume
.
VolumeHost
)
error
{
...
...
@@ -431,7 +431,7 @@ func (b *storageosMounter) SetUpAt(dir string, fsGroup *int64) error {
}
func
makeGlobalPDName
(
host
volume
.
VolumeHost
,
pvName
,
volNamespace
,
volName
string
)
string
{
return
path
.
Join
(
host
.
GetPluginDir
(
utils
s
trings
.
EscapeQualifiedName
(
storageosPluginName
)),
mount
.
MountsInGlobalPDPath
,
pvName
+
"."
+
volNamespace
+
"."
+
volName
)
return
path
.
Join
(
host
.
GetPluginDir
(
utilstrings
.
EscapeQualifiedName
(
storageosPluginName
)),
mount
.
MountsInGlobalPDPath
,
pvName
+
"."
+
volNamespace
+
"."
+
volName
)
}
// Given the pod id and PV name, finds the volume's namespace and name from the
...
...
@@ -443,7 +443,7 @@ func getVolumeInfo(pvName string, podUID types.UID, host volume.VolumeHost) (str
return
volNamespace
,
volName
,
nil
}
volumeDir
:=
filepath
.
Dir
(
host
.
GetPodVolumeDir
(
podUID
,
utils
s
trings
.
EscapeQualifiedName
(
storageosPluginName
),
pvName
))
volumeDir
:=
filepath
.
Dir
(
host
.
GetPodVolumeDir
(
podUID
,
utilstrings
.
EscapeQualifiedName
(
storageosPluginName
),
pvName
))
files
,
err
:=
ioutil
.
ReadDir
(
volumeDir
)
if
err
!=
nil
{
return
""
,
""
,
fmt
.
Errorf
(
"Could not read mounts from pod volume dir: %s"
,
err
)
...
...
pkg/volume/testing/testing.go
View file @
657a1a1a
...
...
@@ -43,7 +43,7 @@ import (
"k8s.io/kubernetes/pkg/volume/util"
"k8s.io/kubernetes/pkg/volume/util/recyclerclient"
"k8s.io/kubernetes/pkg/volume/util/volumepathhandler"
utils
s
trings
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
const
(
...
...
@@ -765,7 +765,7 @@ func (fv *FakeVolume) GetPath() string {
}
func
(
fv
*
FakeVolume
)
getPath
()
string
{
return
path
.
Join
(
fv
.
Plugin
.
Host
.
GetPodVolumeDir
(
fv
.
PodUID
,
utils
s
trings
.
EscapeQualifiedName
(
fv
.
Plugin
.
PluginName
),
fv
.
VolName
))
return
path
.
Join
(
fv
.
Plugin
.
Host
.
GetPodVolumeDir
(
fv
.
PodUID
,
utilstrings
.
EscapeQualifiedName
(
fv
.
Plugin
.
PluginName
),
fv
.
VolName
))
}
func
(
fv
*
FakeVolume
)
TearDown
()
error
{
...
...
@@ -810,7 +810,7 @@ func (fv *FakeVolume) GetGlobalMapPath(spec *Spec) (string, error) {
// Block volume support
func
(
fv
*
FakeVolume
)
getGlobalMapPath
()
(
string
,
error
)
{
return
path
.
Join
(
fv
.
Plugin
.
Host
.
GetVolumeDevicePluginDir
(
utils
s
trings
.
EscapeQualifiedName
(
fv
.
Plugin
.
PluginName
)),
"pluginDependentPath"
),
nil
return
path
.
Join
(
fv
.
Plugin
.
Host
.
GetVolumeDevicePluginDir
(
utilstrings
.
EscapeQualifiedName
(
fv
.
Plugin
.
PluginName
)),
"pluginDependentPath"
),
nil
}
// Block volume support
...
...
@@ -830,7 +830,7 @@ func (fv *FakeVolume) GetPodDeviceMapPath() (string, string) {
// Block volume support
func
(
fv
*
FakeVolume
)
getPodDeviceMapPath
()
(
string
,
string
)
{
return
path
.
Join
(
fv
.
Plugin
.
Host
.
GetPodVolumeDeviceDir
(
fv
.
PodUID
,
utils
s
trings
.
EscapeQualifiedName
(
fv
.
Plugin
.
PluginName
))),
fv
.
VolName
return
path
.
Join
(
fv
.
Plugin
.
Host
.
GetPodVolumeDeviceDir
(
fv
.
PodUID
,
utilstrings
.
EscapeQualifiedName
(
fv
.
Plugin
.
PluginName
))),
fv
.
VolName
}
// Block volume support
...
...
pkg/volume/util/util.go
View file @
657a1a1a
...
...
@@ -47,7 +47,7 @@ import (
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/util/types"
"k8s.io/kubernetes/pkg/volume/util/volumepathhandler"
utils
s
trings
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
const
(
...
...
@@ -820,7 +820,7 @@ func GetPersistentVolumeClaimVolumeMode(claim *v1.PersistentVolumeClaim) (v1.Per
// GetPersistentVolumeClaimQualifiedName returns a qualified name for pvc.
func
GetPersistentVolumeClaimQualifiedName
(
claim
*
v1
.
PersistentVolumeClaim
)
string
{
return
utils
s
trings
.
JoinQualifiedName
(
claim
.
GetNamespace
(),
claim
.
GetName
())
return
utilstrings
.
JoinQualifiedName
(
claim
.
GetNamespace
(),
claim
.
GetName
())
}
// CheckVolumeModeFilesystem checks VolumeMode.
...
...
pkg/volume/vsphere_volume/vsphere_volume.go
View file @
657a1a1a
...
...
@@ -32,7 +32,7 @@ import (
"k8s.io/kubernetes/pkg/util/mount"
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/util"
utils
s
trings
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
// This is the primary entrypoint for volume plugins.
...
...
@@ -54,7 +54,7 @@ const (
)
func
getPath
(
uid
types
.
UID
,
volName
string
,
host
volume
.
VolumeHost
)
string
{
return
host
.
GetPodVolumeDir
(
uid
,
utils
s
trings
.
EscapeQualifiedName
(
vsphereVolumePluginName
),
volName
)
return
host
.
GetPodVolumeDir
(
uid
,
utilstrings
.
EscapeQualifiedName
(
vsphereVolumePluginName
),
volName
)
}
// vSphere Volume Plugin
...
...
@@ -298,7 +298,7 @@ func makeGlobalPDPath(host volume.VolumeHost, devName string) string {
func
(
vv
*
vsphereVolume
)
GetPath
()
string
{
name
:=
vsphereVolumePluginName
return
vv
.
plugin
.
host
.
GetPodVolumeDir
(
vv
.
podUID
,
utils
s
trings
.
EscapeQualifiedName
(
name
),
vv
.
volName
)
return
vv
.
plugin
.
host
.
GetPodVolumeDir
(
vv
.
podUID
,
utilstrings
.
EscapeQualifiedName
(
name
),
vv
.
volName
)
}
// vSphere Persistent Volume Plugin
...
...
pkg/volume/vsphere_volume/vsphere_volume_block.go
View file @
657a1a1a
...
...
@@ -29,7 +29,7 @@ import (
"k8s.io/kubernetes/pkg/volume"
"k8s.io/kubernetes/pkg/volume/util"
"k8s.io/kubernetes/pkg/volume/util/volumepathhandler"
utils
s
trings
"k8s.io/utils/strings"
utilstrings
"k8s.io/utils/strings"
)
var
_
volume
.
BlockVolumePlugin
=
&
vsphereVolumePlugin
{}
...
...
@@ -157,5 +157,5 @@ func (v *vsphereVolume) GetGlobalMapPath(spec *volume.Spec) (string, error) {
}
func
(
v
*
vsphereVolume
)
GetPodDeviceMapPath
()
(
string
,
string
)
{
return
v
.
plugin
.
host
.
GetPodVolumeDeviceDir
(
v
.
podUID
,
utils
s
trings
.
EscapeQualifiedName
(
vsphereVolumePluginName
)),
v
.
volName
return
v
.
plugin
.
host
.
GetPodVolumeDeviceDir
(
v
.
podUID
,
utilstrings
.
EscapeQualifiedName
(
vsphereVolumePluginName
)),
v
.
volName
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment