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
6ade5461
Commit
6ade5461
authored
Apr 19, 2017
by
Michelle Au
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add GetNodeLabels to VolumeHost interface
parent
f6b3d083
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
0 deletions
+23
-0
attach_detach_controller.go
...ontroller/volume/attachdetach/attach_detach_controller.go
+4
-0
volume_host.go
pkg/controller/volume/persistentvolume/volume_host.go
+4
-0
volume_host.go
pkg/kubelet/volume_host.go
+8
-0
plugins.go
pkg/volume/plugins.go
+3
-0
testing.go
pkg/volume/testing/testing.go
+4
-0
No files found.
pkg/controller/volume/attachdetach/attach_detach_controller.go
View file @
6ade5461
...
...
@@ -564,3 +564,7 @@ func (adc *attachDetachController) addNodeToDswp(node *v1.Node, nodeName types.N
adc
.
desiredStateOfWorld
.
AddNode
(
nodeName
,
keepTerminatedPodVolumes
)
}
}
func
(
adc
*
attachDetachController
)
GetNodeLabels
()
(
map
[
string
]
string
,
error
)
{
return
nil
,
fmt
.
Errorf
(
"GetNodeLabels() unsupported in Attach/Detach controller"
)
}
pkg/controller/volume/persistentvolume/volume_host.go
View file @
6ade5461
...
...
@@ -86,3 +86,7 @@ func (adc *PersistentVolumeController) GetSecretFunc() func(namespace, name stri
return
nil
,
fmt
.
Errorf
(
"GetSecret unsupported in PersistentVolumeController"
)
}
}
func
(
ctrl
*
PersistentVolumeController
)
GetNodeLabels
()
(
map
[
string
]
string
,
error
)
{
return
nil
,
fmt
.
Errorf
(
"GetNodeLabels() unsupported in PersistentVolumeController"
)
}
pkg/kubelet/volume_host.go
View file @
6ade5461
...
...
@@ -140,3 +140,11 @@ func (kvh *kubeletVolumeHost) GetNodeAllocatable() (v1.ResourceList, error) {
func
(
kvh
*
kubeletVolumeHost
)
GetSecretFunc
()
func
(
namespace
,
name
string
)
(
*
v1
.
Secret
,
error
)
{
return
kvh
.
secretManager
.
GetSecret
}
func
(
kvh
*
kubeletVolumeHost
)
GetNodeLabels
()
(
map
[
string
]
string
,
error
)
{
node
,
err
:=
kvh
.
kubelet
.
GetNode
()
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"error retrieving node: %v"
,
err
)
}
return
node
.
Labels
,
nil
}
pkg/volume/plugins.go
View file @
6ade5461
...
...
@@ -232,6 +232,9 @@ type VolumeHost interface {
// Returns a function that returns a secret.
GetSecretFunc
()
func
(
namespace
,
name
string
)
(
*
v1
.
Secret
,
error
)
// Returns the labels on the node
GetNodeLabels
()
(
map
[
string
]
string
,
error
)
}
// VolumePluginMgr tracks registered plugins.
...
...
pkg/volume/testing/testing.go
View file @
6ade5461
...
...
@@ -133,6 +133,10 @@ func (f *fakeVolumeHost) GetSecretFunc() func(namespace, name string) (*v1.Secre
}
}
func
(
f
*
fakeVolumeHost
)
GetNodeLabels
()
(
map
[
string
]
string
,
error
)
{
return
map
[
string
]
string
{
"test-label"
:
"test-value"
},
nil
}
func
ProbeVolumePlugins
(
config
VolumeConfig
)
[]
VolumePlugin
{
if
_
,
ok
:=
config
.
OtherAttributes
[
"fake-property"
];
ok
{
return
[]
VolumePlugin
{
...
...
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