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
3b64f902
Commit
3b64f902
authored
Nov 30, 2018
by
Yecheng Fu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename GetUniqueVolumeNameForNonAttachableVolume to GetUniqueVolumeNameFromSpecWithPod
parent
1e44e07c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
6 deletions
+11
-6
desired_state_of_world.go
pkg/kubelet/volumemanager/cache/desired_state_of_world.go
+1
-1
reconciler.go
pkg/kubelet/volumemanager/reconciler/reconciler.go
+6
-2
util.go
pkg/volume/util/util.go
+4
-3
No files found.
pkg/kubelet/volumemanager/cache/desired_state_of_world.go
View file @
3b64f902
...
...
@@ -222,7 +222,7 @@ func (dsw *desiredStateOfWorld) AddPodToVolume(
}
else
{
// For non-attachable and non-device-mountable volumes, generate a unique name based on the pod
// namespace and name and the name of the volume within the pod.
volumeName
=
util
.
GetUniqueVolumeNameF
orNonAttachableVolume
(
podName
,
volumePlugin
,
volumeSpec
)
volumeName
=
util
.
GetUniqueVolumeNameF
romSpecWithPod
(
podName
,
volumePlugin
,
volumeSpec
)
}
if
_
,
volumeExists
:=
dsw
.
volumesToMount
[
volumeName
];
!
volumeExists
{
...
...
pkg/kubelet/volumemanager/reconciler/reconciler.go
View file @
3b64f902
...
...
@@ -455,6 +455,10 @@ func (rc *reconciler) reconstructVolume(volume podVolume) (*reconstructedVolume,
if
err
!=
nil
{
return
nil
,
err
}
deviceMountablePlugin
,
err
:=
rc
.
volumePluginMgr
.
FindDeviceMountablePluginByName
(
volume
.
pluginName
)
if
err
!=
nil
{
return
nil
,
err
}
// Create pod object
pod
:=
&
v1
.
Pod
{
...
...
@@ -480,13 +484,13 @@ func (rc *reconciler) reconstructVolume(volume podVolume) (*reconstructedVolume,
}
var
uniqueVolumeName
v1
.
UniqueVolumeName
if
attachablePlugin
!=
nil
{
if
attachablePlugin
!=
nil
||
deviceMountablePlugin
!=
nil
{
uniqueVolumeName
,
err
=
util
.
GetUniqueVolumeNameFromSpec
(
plugin
,
volumeSpec
)
if
err
!=
nil
{
return
nil
,
err
}
}
else
{
uniqueVolumeName
=
util
.
GetUniqueVolumeNameF
orNonAttachableVolume
(
volume
.
podName
,
plugin
,
volumeSpec
)
uniqueVolumeName
=
util
.
GetUniqueVolumeNameF
romSpecWithPod
(
volume
.
podName
,
plugin
,
volumeSpec
)
}
// Check existence of mount point for filesystem volume or symbolic link for block volume
isExist
,
checkErr
:=
rc
.
operationExecutor
.
CheckVolumeExistenceOperation
(
volumeSpec
,
volume
.
mountPath
,
volumeSpec
.
Name
(),
rc
.
mounter
,
uniqueVolumeName
,
volume
.
podName
,
pod
.
UID
,
attachablePlugin
)
...
...
pkg/volume/util/util.go
View file @
3b64f902
...
...
@@ -825,9 +825,10 @@ func GetUniqueVolumeName(pluginName, volumeName string) v1.UniqueVolumeName {
return
v1
.
UniqueVolumeName
(
fmt
.
Sprintf
(
"%s/%s"
,
pluginName
,
volumeName
))
}
// GetUniqueVolumeNameForNonAttachableVolume returns the unique volume name
// for a non-attachable volume.
func
GetUniqueVolumeNameForNonAttachableVolume
(
// GetUniqueVolumeNameFromSpecWithPod returns a unique volume name with pod
// name included. This is useful to generate different names for different pods
// on same volume.
func
GetUniqueVolumeNameFromSpecWithPod
(
podName
types
.
UniquePodName
,
volumePlugin
volume
.
VolumePlugin
,
volumeSpec
*
volume
.
Spec
)
v1
.
UniqueVolumeName
{
return
v1
.
UniqueVolumeName
(
fmt
.
Sprintf
(
"%s/%v-%s"
,
volumePlugin
.
GetPluginName
(),
podName
,
volumeSpec
.
Name
()))
...
...
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