Documentation ¶
Overview ¶
Package volume includes internal representations of external volume types as well as utility methods required to mount/unmount volumes to kubelets.
Index ¶
- func GetAccessModesAsString(modes []api.PersistentVolumeAccessMode) string
- func NewFakeVolumeHost(rootDir string, kubeClient client.Interface, plugins []VolumePlugin) *fakeVolumeHost
- func RenameDirectory(oldPath, newName string) (string, error)
- func ScrubPodVolumeAndWatchUntilCompletion(pod *api.Pod, kubeClient client.Interface) error
- type Builder
- type Cleaner
- type FakeRecycler
- type FakeVolume
- type FakeVolumePlugin
- func (plugin *FakeVolumePlugin) CanSupport(spec *Spec) bool
- func (plugin *FakeVolumePlugin) GetAccessModes() []api.PersistentVolumeAccessMode
- func (plugin *FakeVolumePlugin) Init(host VolumeHost)
- func (plugin *FakeVolumePlugin) Name() string
- func (plugin *FakeVolumePlugin) NewBuilder(spec *Spec, pod *api.Pod, opts VolumeOptions, mounter mount.Interface) (Builder, error)
- func (plugin *FakeVolumePlugin) NewCleaner(volName string, podUID types.UID, mounter mount.Interface) (Cleaner, error)
- func (plugin *FakeVolumePlugin) NewRecycler(spec *Spec) (Recycler, error)
- type PersistentVolumePlugin
- type RecyclableVolumePlugin
- type Recycler
- type Spec
- type Volume
- type VolumeHost
- type VolumeOptions
- type VolumePlugin
- type VolumePluginMgr
- func (pm *VolumePluginMgr) FindPersistentPluginByName(name string) (PersistentVolumePlugin, error)
- func (pm *VolumePluginMgr) FindPersistentPluginBySpec(spec *Spec) (PersistentVolumePlugin, error)
- func (pm *VolumePluginMgr) FindPluginByName(name string) (VolumePlugin, error)
- func (pm *VolumePluginMgr) FindPluginBySpec(spec *Spec) (VolumePlugin, error)
- func (pm *VolumePluginMgr) FindRecyclablePluginBySpec(spec *Spec) (RecyclableVolumePlugin, error)
- func (pm *VolumePluginMgr) InitPlugins(plugins []VolumePlugin, host VolumeHost) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAccessModesAsString ¶ added in v0.15.0
func GetAccessModesAsString(modes []api.PersistentVolumeAccessMode) string
func NewFakeVolumeHost ¶ added in v0.14.0
func NewFakeVolumeHost(rootDir string, kubeClient client.Interface, plugins []VolumePlugin) *fakeVolumeHost
func RenameDirectory ¶ added in v0.14.0
func ScrubPodVolumeAndWatchUntilCompletion ¶ added in v0.19.0
ScrubPodVolumeAndWatchUntilCompletion is intended for use with volume Recyclers. This function will save the given Pod to the API and watch it until it completes, fails, or the pod's ActiveDeadlineSeconds is exceeded, whichever comes first. An attempt to delete a scrubber pod is always attempted before returning.
pod - the pod designed by a volume plugin to scrub the volume's contents client - kube client for API operations.
Types ¶
type Builder ¶
type Builder interface { // Uses Interface to provide the path for Docker binds. Volume // SetUp prepares and mounts/unpacks the volume to a self-determined // directory path. This may be called more than once, so // implementations must be idempotent. SetUp() error // SetUpAt prepares and mounts/unpacks the volume to the specified // directory path, which may or may not exist yet. This may be called // more than once, so implementations must be idempotent. SetUpAt(dir string) error }
Builder interface provides methods to set up/mount the volume.
type Cleaner ¶
type Cleaner interface { Volume // TearDown unmounts the volume from a self-determined directory and // removes traces of the SetUp procedure. TearDown() error // TearDown unmounts the volume from the specified directory and // removes traces of the SetUp procedure. TearDownAt(dir string) error }
Cleaner interface provides methods to cleanup/unmount the volumes.
type FakeRecycler ¶ added in v0.19.0
type FakeRecycler struct {
// contains filtered or unexported fields
}
func (*FakeRecycler) GetPath ¶ added in v0.19.0
func (fr *FakeRecycler) GetPath() string
func (*FakeRecycler) Recycle ¶ added in v0.19.0
func (fr *FakeRecycler) Recycle() error
type FakeVolume ¶ added in v0.14.0
type FakeVolume struct { PodUID types.UID VolName string Plugin *FakeVolumePlugin }
func (*FakeVolume) GetPath ¶ added in v0.14.0
func (fv *FakeVolume) GetPath() string
func (*FakeVolume) SetUp ¶ added in v0.14.0
func (fv *FakeVolume) SetUp() error
func (*FakeVolume) SetUpAt ¶ added in v0.14.0
func (fv *FakeVolume) SetUpAt(dir string) error
func (*FakeVolume) TearDown ¶ added in v0.14.0
func (fv *FakeVolume) TearDown() error
func (*FakeVolume) TearDownAt ¶ added in v0.14.0
func (fv *FakeVolume) TearDownAt(dir string) error
type FakeVolumePlugin ¶ added in v0.14.0
type FakeVolumePlugin struct { PluginName string Host VolumeHost }
FakeVolumePlugin is useful for testing. It tries to be a fully compliant plugin, but all it does is make empty directories. Use as:
volume.RegisterPlugin(&FakePlugin{"fake-name"})
func (*FakeVolumePlugin) CanSupport ¶ added in v0.14.0
func (plugin *FakeVolumePlugin) CanSupport(spec *Spec) bool
func (*FakeVolumePlugin) GetAccessModes ¶ added in v0.14.0
func (plugin *FakeVolumePlugin) GetAccessModes() []api.PersistentVolumeAccessMode
func (*FakeVolumePlugin) Init ¶ added in v0.14.0
func (plugin *FakeVolumePlugin) Init(host VolumeHost)
func (*FakeVolumePlugin) Name ¶ added in v0.14.0
func (plugin *FakeVolumePlugin) Name() string
func (*FakeVolumePlugin) NewBuilder ¶ added in v0.14.0
func (plugin *FakeVolumePlugin) NewBuilder(spec *Spec, pod *api.Pod, opts VolumeOptions, mounter mount.Interface) (Builder, error)
func (*FakeVolumePlugin) NewCleaner ¶ added in v0.14.0
func (*FakeVolumePlugin) NewRecycler ¶ added in v0.19.0
func (plugin *FakeVolumePlugin) NewRecycler(spec *Spec) (Recycler, error)
type PersistentVolumePlugin ¶ added in v0.14.0
type PersistentVolumePlugin interface { VolumePlugin // GetAccessModes describes the ways a given volume can be accessed/mounted. GetAccessModes() []api.PersistentVolumeAccessMode }
PersistentVolumePlugin is an extended interface of VolumePlugin and is used by volumes that want to provide long term persistence of data
type RecyclableVolumePlugin ¶ added in v0.19.0
type RecyclableVolumePlugin interface { VolumePlugin // NewRecycler creates a new volume.Recycler which knows how to reclaim this resource // after the volume's release from a PersistentVolumeClaim NewRecycler(spec *Spec) (Recycler, error) }
RecyclableVolumePlugin is an extended interface of VolumePlugin and is used by persistent volumes that want to be recycled before being made available again to new claims
type Recycler ¶ added in v0.19.0
type Recycler interface { Volume // Recycle reclaims the resource. Calls to this method should block until the recycling task is complete. // Any error returned indicates the volume has failed to be reclaimed. A nil return indicates success. Recycle() error }
Recycler provides methods to reclaim the volume resource.
type Spec ¶ added in v0.16.0
type Spec struct { Name string VolumeSource api.VolumeSource PersistentVolumeSource api.PersistentVolumeSource }
Spec is an internal representation of a volume. All API volume types translate to Spec.
func NewSpecFromPersistentVolume ¶ added in v0.16.0
func NewSpecFromPersistentVolume(pv *api.PersistentVolume) *Spec
NewSpecFromPersistentVolume creates an Spec from an api.PersistentVolume
func NewSpecFromVolume ¶ added in v0.16.0
NewSpecFromVolume creates an Spec from an api.Volume
type Volume ¶ added in v0.14.0
type Volume interface { // GetPath returns the directory path the volume is mounted to. GetPath() string }
Volume represents a directory used by pods or hosts on a node. All method implementations of methods in the volume interface must be idempotent.
type VolumeHost ¶ added in v0.14.0
type VolumeHost interface { // GetPluginDir returns the absolute path to a directory under which // a given plugin may store data. This directory might not actually // exist on disk yet. For plugin data that is per-pod, see // GetPodPluginDir(). GetPluginDir(pluginName string) string // GetPodVolumeDir returns the absolute path a directory which // represents the named volume under the named plugin for the given // pod. If the specified pod does not exist, the result of this call // might not exist. GetPodVolumeDir(podUID types.UID, pluginName string, volumeName string) string // GetPodPluginDir returns the absolute path to a directory under which // a given plugin may store data for a given pod. If the specified pod // does not exist, the result of this call might not exist. This // directory might not actually exist on disk yet. GetPodPluginDir(podUID types.UID, pluginName string) string // GetKubeClient returns a client interface GetKubeClient() client.Interface // NewWrapperBuilder finds an appropriate plugin with which to handle // the provided spec. This is used to implement volume plugins which // "wrap" other plugins. For example, the "secret" volume is // implemented in terms of the "emptyDir" volume. NewWrapperBuilder(spec *Spec, pod *api.Pod, opts VolumeOptions, mounter mount.Interface) (Builder, error) // NewWrapperCleaner finds an appropriate plugin with which to handle // the provided spec. See comments on NewWrapperBuilder for more // context. NewWrapperCleaner(spec *Spec, podUID types.UID, mounter mount.Interface) (Cleaner, error) }
VolumeHost is an interface that plugins can use to access the kubelet.
type VolumeOptions ¶ added in v0.15.0
type VolumeOptions struct { // The rootcontext to use when performing mounts for a volume. RootContext string }
VolumeOptions contains option information about a volume.
Currently, this struct containers only a single field for the rootcontext of the 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.
type VolumePlugin ¶ added in v0.14.0
type VolumePlugin interface { // Init initializes the plugin. This will be called exactly once // before any New* calls are made - implementations of plugins may // depend on this. Init(host VolumeHost) // Name returns the plugin's name. Plugins should use namespaced names // such as "example.com/volume". The "kubernetes.io" namespace is // reserved for plugins which are bundled with kubernetes. Name() string // CanSupport tests whether the plugin supports a given volume // specification from the API. The spec pointer should be considered // const. CanSupport(spec *Spec) bool // NewBuilder creates a new volume.Builder from an API specification. // Ownership of the spec pointer in *not* transferred. // - spec: The api.Volume spec // - pod: The enclosing pod NewBuilder(spec *Spec, podRef *api.Pod, opts VolumeOptions, mounter mount.Interface) (Builder, error) // NewCleaner creates a new volume.Cleaner from recoverable state. // - name: The volume name, as per the api.Volume spec. // - podUID: The UID of the enclosing pod NewCleaner(name string, podUID types.UID, mounter mount.Interface) (Cleaner, error) }
VolumePlugin is an interface to volume plugins that can be used on a kubernetes node (e.g. by kubelet) to instantiate and manage volumes.
type VolumePluginMgr ¶ added in v0.14.0
type VolumePluginMgr struct {
// contains filtered or unexported fields
}
VolumePluginMgr tracks registered plugins.
func (*VolumePluginMgr) FindPersistentPluginByName ¶ added in v0.14.0
func (pm *VolumePluginMgr) FindPersistentPluginByName(name string) (PersistentVolumePlugin, error)
FindPersistentPluginByName fetches a persistent volume plugin by name. If no plugin is found, returns error.
func (*VolumePluginMgr) FindPersistentPluginBySpec ¶ added in v0.19.0
func (pm *VolumePluginMgr) FindPersistentPluginBySpec(spec *Spec) (PersistentVolumePlugin, error)
FindPersistentPluginBySpec looks for a persistent volume plugin that can support a given volume specification. If no plugin is found, return an error
func (*VolumePluginMgr) FindPluginByName ¶ added in v0.14.0
func (pm *VolumePluginMgr) FindPluginByName(name string) (VolumePlugin, error)
FindPluginByName fetches a plugin by name or by legacy name. If no plugin is found, returns error.
func (*VolumePluginMgr) FindPluginBySpec ¶ added in v0.14.0
func (pm *VolumePluginMgr) FindPluginBySpec(spec *Spec) (VolumePlugin, error)
FindPluginBySpec looks for a plugin that can support a given volume specification. If no plugins can support or more than one plugin can support it, return error.
func (*VolumePluginMgr) FindRecyclablePluginBySpec ¶ added in v0.19.0
func (pm *VolumePluginMgr) FindRecyclablePluginBySpec(spec *Spec) (RecyclableVolumePlugin, error)
FindRecyclablePluginByName fetches a persistent volume plugin by name. If no plugin is found, returns error.
func (*VolumePluginMgr) InitPlugins ¶ added in v0.14.0
func (pm *VolumePluginMgr) InitPlugins(plugins []VolumePlugin, host VolumeHost) error
InitPlugins initializes each plugin. All plugins must have unique names. This must be called exactly once before any New* methods are called on any plugins.
Directories ¶
Path | Synopsis |
---|---|
Package aws_ebs contains the internal representation of AWS Elastic Block Store volumes.
|
Package aws_ebs contains the internal representation of AWS Elastic Block Store volumes. |
Package empty_dir contains the internal representation of emptyDir volumes.
|
Package empty_dir contains the internal representation of emptyDir volumes. |
Package gce_pd contains the internal representation of GCE PersistentDisk volumes.
|
Package gce_pd contains the internal representation of GCE PersistentDisk volumes. |
Package git_repo contains the internal representation of git repo volumes.
|
Package git_repo contains the internal representation of git repo volumes. |
Package glusterfs contains the internal representation of glusterfs volumes.
|
Package glusterfs contains the internal representation of glusterfs volumes. |
Package host_path contains the internal representation of hostPath volumes.
|
Package host_path contains the internal representation of hostPath volumes. |
Package iscsi contains the internal representation of Internet Small Computer System Interface (iSCSI) volumes.
|
Package iscsi contains the internal representation of Internet Small Computer System Interface (iSCSI) volumes. |
Package nfs contains the internal representation of network file system (NFS) volumes.
|
Package nfs contains the internal representation of network file system (NFS) volumes. |
Package persistent_claim contains the internal representation of persistent volume claims.
|
Package persistent_claim contains the internal representation of persistent volume claims. |
Package rbd contains the internal representation of Rados Block Store (Ceph) volumes.
|
Package rbd contains the internal representation of Rados Block Store (Ceph) volumes. |
Package secret contains the internal representation of secret volumes.
|
Package secret contains the internal representation of secret volumes. |
Contains utility code for use by volume plugins.
|
Contains utility code for use by volume plugins. |