volume

package
v0.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 9, 2014 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package volume includes internal representations of external volume types as well as utility methods required to mount/unmount volumes to kubelets.

Index

Constants

View Source
const MOUNT_MS_BIND = syscall.MS_BIND
View Source
const MOUNT_MS_RDONLY = syscall.MS_RDONLY

Variables

View Source
var ErrUnsupportedVolumeType = errors.New("unsupported volume type")

Functions

func GetCurrentVolumes

func GetCurrentVolumes(rootDirectory string) map[string]Cleaner

GetCurrentVolumes examines directory structure to determine volumes that are presently active and mounted. Returns a map of Cleaner types.

Types

type Builder

type Builder interface {
	// Uses Interface to provide the path for Docker binds.
	Interface
	// SetUp prepares and mounts/unpacks the volume to a directory path.
	SetUp() error
}

Builder interface provides method to set up/mount the volume.

func CreateVolumeBuilder

func CreateVolumeBuilder(volume *api.Volume, podID string, rootDir string) (Builder, error)

CreateVolumeBuilder returns a Builder capable of mounting a volume described by an *api.Volume, or an error.

type Cleaner

type Cleaner interface {
	// TearDown unmounts the volume and removes traces of the SetUp procedure.
	TearDown() error
}

Cleaner interface provides method to cleanup/unmount the volumes.

func CreateVolumeCleaner

func CreateVolumeCleaner(kind string, name string, podID string, rootDir string) (Cleaner, error)

CreateVolumeCleaner returns a Cleaner capable of tearing down a volume.

type DiskMounter

type DiskMounter struct{}

func (*DiskMounter) Mount

func (mounter *DiskMounter) Mount(source string, target string, fstype string, flags uintptr, data string) error

Wraps syscall.Mount()

func (*DiskMounter) RefCount

func (mounter *DiskMounter) RefCount(mount Interface) (string, int, error)

Examines /proc/mounts to find the source device of the PD resource and the number of references to that device. Returns both the full device path under the /dev tree and the number of references.

func (*DiskMounter) Unmount

func (mounter *DiskMounter) Unmount(target string, flags int) error

Wraps syscall.Unmount()

type EmptyDir

type EmptyDir struct {
	Name    string
	PodID   string
	RootDir string
}

EmptyDir volumes are temporary directories exposed to the pod. These do not persist beyond the lifetime of a pod.

func (*EmptyDir) GetPath

func (emptyDir *EmptyDir) GetPath() string

func (*EmptyDir) SetUp

func (emptyDir *EmptyDir) SetUp() error

SetUp creates new directory.

func (*EmptyDir) TearDown

func (emptyDir *EmptyDir) TearDown() error

TearDown simply deletes everything in the directory.

type GCEDiskUtil

type GCEDiskUtil struct{}

func (*GCEDiskUtil) AttachDisk

func (util *GCEDiskUtil) AttachDisk(GCEPD *GCEPersistentDisk) error

Attaches a disk specified by a volume.GCEPersistentDisk to the current kubelet. Mounts the disk to it's global path.

func (*GCEDiskUtil) DetachDisk

func (util *GCEDiskUtil) DetachDisk(GCEPD *GCEPersistentDisk, devicePath string) error

Unmounts the device and detaches the disk from the kubelet's host machine. Expects a GCE device path symlink. Ex: /dev/disk/by-id/google-mydisk-part1

type GCEPersistentDisk

type GCEPersistentDisk struct {
	Name    string
	PodID   string
	RootDir string
	// Unique identifier of the PD, used to find the disk resource in the provider.
	PDName string
	// Filesystem type, optional.
	FSType string
	// Specifies the partition to mount
	Partition string
	// Specifies whether the disk will be attached as ReadOnly.
	ReadOnly bool
	// contains filtered or unexported fields
}

GCEPersistentDisk volumes are disk resources provided by Google Compute Engine that are attached to the kubelet's host machine and exposed to the pod.

func (*GCEPersistentDisk) GetPath

func (PD *GCEPersistentDisk) GetPath() string

func (*GCEPersistentDisk) SetUp

func (PD *GCEPersistentDisk) SetUp() error

Attaches the disk and bind mounts to the volume path.

func (*GCEPersistentDisk) TearDown

func (PD *GCEPersistentDisk) TearDown() error

Unmounts the bind mount, and detaches the disk only if the PD resource was the last reference to that disk on the kubelet.

type GitDir added in v0.5.1

type GitDir struct {
	Source   string
	Revision string
	PodID    string
	RootDir  string
	Name     string
	// contains filtered or unexported fields
}

func (*GitDir) ExecCommand added in v0.5.1

func (g *GitDir) ExecCommand(command string, args []string, dir string) ([]byte, error)

func (*GitDir) GetPath added in v0.5.1

func (g *GitDir) GetPath() string

func (*GitDir) SetUp added in v0.5.1

func (g *GitDir) SetUp() error

func (*GitDir) TearDown added in v0.5.1

func (g *GitDir) TearDown() error

TearDown simply deletes everything in the directory.

type HostDir

type HostDir struct {
	Path string
}

HostDir volumes represent a bare host directory mount. The directory in Path will be directly exposed to the container.

func (*HostDir) GetPath

func (hostVol *HostDir) GetPath() string

func (*HostDir) SetUp

func (hostVol *HostDir) SetUp() error

SetUp implements interface definitions, even though host directory mounts don't require any setup or cleanup.

type Interface

type Interface interface {
	// GetPath returns the directory path the volume is mounted to.
	GetPath() string
}

Interface is a directory used by pods or hosts. All method implementations of methods in the volume interface must be idempotent.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL