mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-04 09:49:50 +00:00
VolumeHost.GetNodeName method added for CSI fix
This commit is contained in:
parent
8c1ee761d2
commit
7405159558
@ -603,3 +603,7 @@ func (adc *attachDetachController) addNodeToDswp(node *v1.Node, nodeName types.N
|
|||||||
func (adc *attachDetachController) GetNodeLabels() (map[string]string, error) {
|
func (adc *attachDetachController) GetNodeLabels() (map[string]string, error) {
|
||||||
return nil, fmt.Errorf("GetNodeLabels() unsupported in Attach/Detach controller")
|
return nil, fmt.Errorf("GetNodeLabels() unsupported in Attach/Detach controller")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (adc *attachDetachController) GetNodeName() types.NodeName {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
@ -277,3 +277,7 @@ func (expc *expandController) GetConfigMapFunc() func(namespace, name string) (*
|
|||||||
func (expc *expandController) GetNodeLabels() (map[string]string, error) {
|
func (expc *expandController) GetNodeLabels() (map[string]string, error) {
|
||||||
return nil, fmt.Errorf("GetNodeLabels unsupported in expandController")
|
return nil, fmt.Errorf("GetNodeLabels unsupported in expandController")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (expc *expandController) GetNodeName() types.NodeName {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
@ -108,3 +108,7 @@ func (adc *PersistentVolumeController) GetExec(pluginName string) mount.Exec {
|
|||||||
func (ctrl *PersistentVolumeController) GetNodeLabels() (map[string]string, error) {
|
func (ctrl *PersistentVolumeController) GetNodeLabels() (map[string]string, error) {
|
||||||
return nil, fmt.Errorf("GetNodeLabels() unsupported in PersistentVolumeController")
|
return nil, fmt.Errorf("GetNodeLabels() unsupported in PersistentVolumeController")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ctrl *PersistentVolumeController) GetNodeName() types.NodeName {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
@ -188,6 +188,10 @@ func (kvh *kubeletVolumeHost) GetNodeLabels() (map[string]string, error) {
|
|||||||
return node.Labels, nil
|
return node.Labels, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (kvh *kubeletVolumeHost) GetNodeName() types.NodeName {
|
||||||
|
return kvh.kubelet.nodeName
|
||||||
|
}
|
||||||
|
|
||||||
func (kvh *kubeletVolumeHost) GetExec(pluginName string) mount.Exec {
|
func (kvh *kubeletVolumeHost) GetExec(pluginName string) mount.Exec {
|
||||||
exec, err := kvh.getMountExec(pluginName)
|
exec, err := kvh.getMountExec(pluginName)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -303,6 +303,9 @@ type VolumeHost interface {
|
|||||||
|
|
||||||
// Returns the labels on the node
|
// Returns the labels on the node
|
||||||
GetNodeLabels() (map[string]string, error)
|
GetNodeLabels() (map[string]string, error)
|
||||||
|
|
||||||
|
// Returns the name of the node
|
||||||
|
GetNodeName() types.NodeName
|
||||||
}
|
}
|
||||||
|
|
||||||
// VolumePluginMgr tracks registered plugins.
|
// VolumePluginMgr tracks registered plugins.
|
||||||
|
@ -53,6 +53,7 @@ type fakeVolumeHost struct {
|
|||||||
exec mount.Exec
|
exec mount.Exec
|
||||||
writer io.Writer
|
writer io.Writer
|
||||||
nodeLabels map[string]string
|
nodeLabels map[string]string
|
||||||
|
nodeName string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewFakeVolumeHost(rootDir string, kubeClient clientset.Interface, plugins []VolumePlugin) *fakeVolumeHost {
|
func NewFakeVolumeHost(rootDir string, kubeClient clientset.Interface, plugins []VolumePlugin) *fakeVolumeHost {
|
||||||
@ -69,6 +70,12 @@ func NewFakeVolumeHostWithNodeLabels(rootDir string, kubeClient clientset.Interf
|
|||||||
return volHost
|
return volHost
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func NewFakeVolumeHostWithNodeName(rootDir string, kubeClient clientset.Interface, plugins []VolumePlugin, nodeName string) *fakeVolumeHost {
|
||||||
|
volHost := newFakeVolumeHost(rootDir, kubeClient, plugins, nil)
|
||||||
|
volHost.nodeName = nodeName
|
||||||
|
return volHost
|
||||||
|
}
|
||||||
|
|
||||||
func newFakeVolumeHost(rootDir string, kubeClient clientset.Interface, plugins []VolumePlugin, cloud cloudprovider.Interface) *fakeVolumeHost {
|
func newFakeVolumeHost(rootDir string, kubeClient clientset.Interface, plugins []VolumePlugin, cloud cloudprovider.Interface) *fakeVolumeHost {
|
||||||
host := &fakeVolumeHost{rootDir: rootDir, kubeClient: kubeClient, cloud: cloud}
|
host := &fakeVolumeHost{rootDir: rootDir, kubeClient: kubeClient, cloud: cloud}
|
||||||
host.mounter = &mount.FakeMounter{}
|
host.mounter = &mount.FakeMounter{}
|
||||||
@ -177,6 +184,10 @@ func (f *fakeVolumeHost) GetNodeLabels() (map[string]string, error) {
|
|||||||
return f.nodeLabels, nil
|
return f.nodeLabels, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (f *fakeVolumeHost) GetNodeName() types.NodeName {
|
||||||
|
return types.NodeName(f.nodeName)
|
||||||
|
}
|
||||||
|
|
||||||
func ProbeVolumePlugins(config VolumeConfig) []VolumePlugin {
|
func ProbeVolumePlugins(config VolumeConfig) []VolumePlugin {
|
||||||
if _, ok := config.OtherAttributes["fake-property"]; ok {
|
if _, ok := config.OtherAttributes["fake-property"]; ok {
|
||||||
return []VolumePlugin{
|
return []VolumePlugin{
|
||||||
|
Loading…
Reference in New Issue
Block a user