Use strongly-typed types.NodeName for a node name

We had another bug where we confused the hostname with the NodeName.

To avoid this happening again, and to make the code more
self-documenting, we use types.NodeName (a typedef alias for string)
whenever we are referring to the Node.Name.

A tedious but mechanical commit therefore, to change all uses of the
node name to use types.NodeName

Also clean up some of the (many) places where the NodeName is referred
to as a hostname (not true on AWS), or an instanceID (not true on GCE),
etc.
This commit is contained in:
Justin Santa Barbara
2016-07-16 02:10:29 -04:00
parent 294c9aa630
commit 54195d590f
78 changed files with 998 additions and 777 deletions

View File

@@ -24,6 +24,7 @@ import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/types"
)
// Volume represents a directory used by pods or hosts on a node. All method
@@ -140,10 +141,10 @@ type Deleter interface {
// Attacher can attach a volume to a node.
type Attacher interface {
// Attaches the volume specified by the given spec to the given host.
// Attaches the volume specified by the given spec to the node with the given Name.
// On success, returns the device path where the device was attached on the
// node.
Attach(spec *Spec, hostName string) (string, error)
Attach(spec *Spec, nodeName types.NodeName) (string, error)
// WaitForAttach blocks until the device is attached to this
// node. If it successfully attaches, the path to the device
@@ -163,8 +164,8 @@ type Attacher interface {
// Detacher can detach a volume from a node.
type Detacher interface {
// Detach the given device from the given host.
Detach(deviceName, hostName string) error
// Detach the given device from the node with the given Name.
Detach(deviceName string, nodeName types.NodeName) error
// WaitForDetach blocks until the device is detached from this
// node. If the device does not detach within the given timeout