Introduce new kubelet volume manager

This commit adds a new volume manager in kubelet that synchronizes
volume mount/unmount (and attach/detach, if attach/detach controller
is not enabled).

This eliminates the race conditions between the pod creation loop
and the orphaned volumes loops. It also removes the unmount/detach
from the `syncPod()` path so volume clean up never blocks the
`syncPod` loop.
This commit is contained in:
saadali
2016-05-29 19:22:22 -07:00
parent 9b6a505f8a
commit 542f2dc708
85 changed files with 5547 additions and 2093 deletions

View File

@@ -18,6 +18,7 @@ package volume
import (
"fmt"
"net"
"strings"
"sync"
@@ -35,12 +36,6 @@ import (
// VolumeOptions contains option information about a volume.
type VolumeOptions struct {
// The rootcontext to use when performing mounts for a volume. This is a
// temporary measure in order to set the rootContext of tmpfs mounts
// correctly. it will be replaced and expanded on by future
// SecurityContext work.
RootContext string
// The attributes below are required by volume.Provisioner
// TODO: refactor all of this out of volumes when an admin can configure
// many kinds of provisioners.
@@ -86,6 +81,11 @@ type VolumePlugin interface {
// const.
CanSupport(spec *Spec) bool
// RequiresRemount returns true if this plugin requires mount calls to be
// reexecuted. Atomically updating volumes, like Downward API, depend on
// this to update the contents of the volume.
RequiresRemount() bool
// NewMounter creates a new volume.Mounter from an API specification.
// Ownership of the spec pointer in *not* transferred.
// - spec: The api.Volume spec
@@ -196,6 +196,15 @@ type VolumeHost interface {
// Returns the hostname of the host kubelet is running on
GetHostName() string
// Returns host IP or nil in the case of error.
GetHostIP() (net.IP, error)
// Returns the rootcontext to use when performing mounts for a volume.
// This is a temporary measure in order to set the rootContext of tmpfs
// mounts correctly. It will be replaced and expanded on by future
// SecurityContext work.
GetRootContext() string
}
// VolumePluginMgr tracks registered plugins.