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 CalculateTimeoutForVolume(minimumTimeout, timeoutIncrement int, pv *api.PersistentVolume) int64
- func NewFakeVolumeHost(rootDir string, kubeClient client.Interface, plugins []VolumePlugin) *fakeVolumeHost
- func NewPersistentVolumeRecyclerPodTemplate() *api.Pod
- func RecycleVolumeByWatchingPodUntilCompletion(pod *api.Pod, kubeClient client.Interface) error
- func RenameDirectory(oldPath, newName string) (string, error)
- type Builder
- type Cleaner
- type CreatableVolumePlugin
- type Creater
- type DeletableVolumePlugin
- type Deleter
- type FakeDeleter
- 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) (Builder, error)
- func (plugin *FakeVolumePlugin) NewCleaner(volName string, podUID types.UID) (Cleaner, error)
- func (plugin *FakeVolumePlugin) NewDeleter(spec *Spec) (Deleter, error)
- func (plugin *FakeVolumePlugin) NewRecycler(spec *Spec) (Recycler, error)
- type PersistentVolumePlugin
- type RecyclableVolumePlugin
- type Recycler
- type Spec
- type Volume
- type VolumeConfig
- type VolumeHost
- type VolumeOptions
- type VolumePlugin
- type VolumePluginMgr
- func (pm *VolumePluginMgr) FindCreatablePluginBySpec(spec *Spec) (CreatableVolumePlugin, error)
- func (pm *VolumePluginMgr) FindDeletablePluginBySpec(spec *Spec) (DeletableVolumePlugin, error)
- 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 CalculateTimeoutForVolume ¶ added in v1.1.0
func CalculateTimeoutForVolume(minimumTimeout, timeoutIncrement int, pv *api.PersistentVolume) int64
CalculateTimeoutForVolume calculates time for a Recycler pod to complete a recycle operation. The calculation and return value is either the minimumTimeout or the timeoutIncrement per Gi of storage size, whichever is greater.
func NewFakeVolumeHost ¶ added in v0.14.0
func NewFakeVolumeHost(rootDir string, kubeClient client.Interface, plugins []VolumePlugin) *fakeVolumeHost
func NewPersistentVolumeRecyclerPodTemplate ¶ added in v1.1.0
NewPersistentVolumeRecyclerPodTemplate creates a template for a recycler pod. By default, a recycler pod simply runs "rm -rf" on a volume and tests for emptiness. Most attributes of the template will be correct for most plugin implementations. The following attributes can be overridden per plugin via configuration:
1. pod.Spec.Volumes[0].VolumeSource must be overridden. Recycler implementations without a valid VolumeSource will fail. 2. pod.GenerateName helps distinguish recycler pods by name. Recommended. Default is "pv-recycler-". 3. pod.Spec.ActiveDeadlineSeconds gives the recycler pod a maximum timeout before failing. Recommended. Default is 60 seconds.
See HostPath and NFS for working recycler examples
func RecycleVolumeByWatchingPodUntilCompletion ¶ added in v1.1.0
RecycleVolumeByWatchingPodUntilCompletion 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 recycler pod is always attempted before returning.
pod - the pod designed by a volume plugin to recycle the volume client - kube client for API operations.
func RenameDirectory ¶ added in v0.14.0
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
// IsReadOnly is a flag that gives the builder's ReadOnly attribute.
// All persistent volumes have a private readOnly flag in their builders.
IsReadOnly() bool
}
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 CreatableVolumePlugin ¶ added in v1.1.0
type CreatableVolumePlugin interface {
VolumePlugin
// NewCreater creates a new volume.Creater which knows how to create PersistentVolumes in accordance with
// the plugin's underlying storage provider
NewCreater(options VolumeOptions) (Creater, error)
}
CreatableVolumePlugin is an extended interface of VolumePlugin and is used to create volumes for the cluster.
type Creater ¶ added in v1.1.0
type Creater interface {
Create() (*api.PersistentVolume, error)
}
Create adds a new resource in the storage provider and creates a PersistentVolume for the new resource. Calls to Create should block until complete.
type DeletableVolumePlugin ¶ added in v1.1.0
type DeletableVolumePlugin interface {
VolumePlugin
// NewDeleter creates a new volume.Deleter which knows how to delete this resource
// in accordance with the underlying storage provider after the volume's release from a claim
NewDeleter(spec *Spec) (Deleter, error)
}
DeletableVolumePlugin is an extended interface of VolumePlugin and is used by persistent volumes that want to be deleted from the cluster after their release from a PersistentVolumeClaim.
type Deleter ¶ added in v1.1.0
Delete removes the resource from the underlying storage provider. Calls to this method should block until the deletion is complete. Any error returned indicates the volume has failed to be reclaimed. A nil return indicates success.
type FakeDeleter ¶ added in v1.1.0
type FakeDeleter struct {
// contains filtered or unexported fields
}
func (*FakeDeleter) Delete ¶ added in v1.1.0
func (fd *FakeDeleter) Delete() error
func (*FakeDeleter) GetPath ¶ added in v1.1.0
func (fd *FakeDeleter) GetPath() string
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) IsReadOnly ¶ added in v1.1.0
func (fv *FakeVolume) IsReadOnly() bool
func (*FakeVolume) SetUp ¶ added in v0.14.0
func (fv *FakeVolume) SetUp() error