volume

package
v1.50.2 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TaskScope indicates that the volume is created and deleted with task
	TaskScope = "task"
	// SharedScope indicates that the volume's lifecycle is outside the scope of task
	SharedScope = "shared"
	// DockerLocalVolumeDriver is the name of the docker default volume driver
	DockerLocalVolumeDriver = "local"

	EFSVolumeType = "efs"
)
View Source
const (
	// ECSVolumePlugin is the driver name of the ECS volume plugin.
	ECSVolumePlugin = "amazon-ecs-volume-plugin"
	// DockerLocalDriverName is the name of Docker's local volume driver.
	DockerLocalDriverName = "local"
)

Variables

This section is empty.

Functions

func GetDriverOptions added in v1.38.0

func GetDriverOptions(cfg *config.Config, efsVolCfg *EFSVolumeConfig, credsRelativeURI string) map[string]string

GetDriverOptions returns the driver options for creating an EFS volume.

func UseECSVolumePlugin added in v1.38.0

func UseECSVolumePlugin(cfg *config.Config) bool

UseECSVolumePlugin checks whether we should use the ECS volume plugin.

Types

type DockerVolumeConfig

type DockerVolumeConfig struct {
	// Scope represents lifetime of the volume: "task" or "shared"
	Scope string `json:"scope"`
	// Autoprovision is true if agent needs to create the volume,
	// false if it is pre-provisioned outside of ECS
	Autoprovision bool `json:"autoprovision"`
	// Mountpoint is a read-only field returned from docker
	Mountpoint string            `json:"mountPoint"`
	Driver     string            `json:"driver"`
	DriverOpts map[string]string `json:"driverOpts"`
	Labels     map[string]string `json:"labels"`
	// DockerVolumeName is internal docker name for this volume.
	DockerVolumeName string `json:"dockerVolumeName"`
}

DockerVolumeConfig represents docker volume configuration See https://tinyurl.com/zmexdw2

func (*DockerVolumeConfig) Source added in v1.20.0

func (cfg *DockerVolumeConfig) Source() string

Source returns the name of the volume resource which is used as the source of the volume mount

type EFSAuthConfig added in v1.38.0

type EFSAuthConfig struct {
	AccessPointId string `json:"accessPointId,omitempty"`
	Iam           string `json:"iam,omitempty"`
}

EFSAuthConfig contains auth config for an efs volume.

type EFSVolumeConfig added in v1.35.0

type EFSVolumeConfig struct {
	AuthConfig            EFSAuthConfig `json:"authorizationConfig,omitempty"`
	FileSystemID          string        `json:"fileSystemId,omitempty"`
	RootDirectory         string        `json:"rootDirectory,omitempty"`
	TransitEncryption     string        `json:"transitEncryption,omitempty"`
	TransitEncryptionPort int64         `json:"transitEncryptionPort,omitempty"`
	// DockerVolumeName is internal docker name for this volume.
	DockerVolumeName string `json:"dockerVolumeName"`
}

EFSVolumeConfig represents efs volume configuration.

func (*EFSVolumeConfig) Source added in v1.35.0

func (cfg *EFSVolumeConfig) Source() string

Source returns the name of the volume resource which is used as the source of the volume mount

type FSHostVolume added in v1.20.0

type FSHostVolume struct {
	FSSourcePath string `json:"sourcePath"`
}

FSHostVolume is a simple type of HostVolume which references an arbitrary location on the host as the Volume.

func (*FSHostVolume) Source added in v1.20.0

func (fs *FSHostVolume) Source() string

SourcePath returns the path on the host filesystem that should be mounted

type LocalDockerVolume added in v1.20.0

type LocalDockerVolume struct {
	HostPath string `json:"hostPath"`
}

LocalDockerVolume represents a volume without a specified host path This is essentially DockerVolume with only the name specified; however, for backward compatibility we can't directly map to DockerVolume.

func (*LocalDockerVolume) Source added in v1.20.0

func (e *LocalDockerVolume) Source() string

SourcePath returns the generated host path for the volume

type Volume added in v1.20.0

type Volume interface {
	Source() string
}

Volume is an interface for something that may be used as the host half of a docker volume mount

type VolumeMountOptions added in v1.38.0

type VolumeMountOptions struct {
	// contains filtered or unexported fields
}

VolumeMountOptions contains a list of mount options for mounting a volume. This struct exists mainly to make serializing/deserializing a list of options easier.

func NewVolumeMountOptions added in v1.38.0

func NewVolumeMountOptions(opts ...string) *VolumeMountOptions

NewVolumeMountOptions returns a new VolumeMountOptions with options from argument.

func NewVolumeMountOptionsFromString added in v1.38.0

func NewVolumeMountOptionsFromString(s string) *VolumeMountOptions

NewVolumeMountOptionsFromString returns a new VolumeMountOptions with options from argument.

func (*VolumeMountOptions) AddOption added in v1.38.0

func (mo *VolumeMountOptions) AddOption(key, val string)

AddOption adds a new option to the option list.

func (*VolumeMountOptions) String added in v1.38.0

func (mo *VolumeMountOptions) String() string

String serializes a list of options joined by comma.

type VolumeResource

type VolumeResource struct {
	// Name is the name of the docker volume
	Name       string
	VolumeType string
	// VolumeConfig contains docker specific volume fields
	VolumeConfig DockerVolumeConfig
	// contains filtered or unexported fields
}

VolumeResource represents volume resource

func NewVolumeResource

func NewVolumeResource(ctx context.Context,
	name string,
	volumeType string,
	dockerVolumeName string,
	scope string,
	autoprovision bool,
	driver string,
	driverOptions map[string]string,
	labels map[string]string,
	client dockerapi.DockerClient) (*VolumeResource, error)

NewVolumeResource returns a docker volume wrapper object

func (*VolumeResource) ApplyTransition added in v1.20.0

func (vol *VolumeResource) ApplyTransition(nextState resourcestatus.ResourceStatus) error

ApplyTransition calls the function required to move to the specified status

func (*VolumeResource) BuildContainerDependency added in v1.38.0

func (vol *VolumeResource) BuildContainerDependency(containerName string, satisfied apicontainerstatus.ContainerStatus,
	dependent resourcestatus.ResourceStatus)

BuildContainerDependency sets the container dependencies of the resource.

func (*VolumeResource) Cleanup

func (vol *VolumeResource) Cleanup() error

Cleanup performs resource cleanup

func (*VolumeResource) Create

func (vol *VolumeResource) Create() error

Create performs resource creation

func (*VolumeResource) DependOnTaskNetwork added in v1.38.0

func (vol *VolumeResource) DependOnTaskNetwork() bool

DependOnTaskNetwork shows whether the resource creation needs task network setup beforehand

func (*VolumeResource) DesiredTerminal added in v1.20.0

func (vol *VolumeResource) DesiredTerminal() bool

DesiredTerminal returns true if the cgroup's desired status is REMOVED

func (*VolumeResource) GetAppliedStatus added in v1.38.0

func (vol *VolumeResource) GetAppliedStatus() resourcestatus.ResourceStatus

func (*VolumeResource) GetContainerDependencies added in v1.38.0

func (vol *VolumeResource) GetContainerDependencies(dependent resourcestatus.ResourceStatus) []apicontainer.ContainerDependency

GetContainerDependencies returns the container dependencies of the resource.

func (*VolumeResource) GetCreatedAt

func (vol *VolumeResource) GetCreatedAt() time.Time

GetCreatedAt sets the timestamp for resource's creation time

func (*VolumeResource) GetDesiredStatus

func (vol *VolumeResource) GetDesiredStatus() resourcestatus.ResourceStatus

GetDesiredStatus safely returns the desired status of the task

func (*VolumeResource) GetKnownStatus

func (vol *VolumeResource) GetKnownStatus() resourcestatus.ResourceStatus

GetKnownStatus safely returns the currently known status of the task

func (*VolumeResource) GetMountPoint

func (vol *VolumeResource) GetMountPoint() string

GetMountPoint gets the mountpoint of the created volume.

func (*VolumeResource) GetName added in v1.20.0

func (vol *VolumeResource) GetName() string

GetName returns the name of the volume resource

func (*VolumeResource) GetPauseContainerPID added in v1.38.0

func (vol *VolumeResource) GetPauseContainerPID() string

GetPauseContainerPID returns the pause container pid.

func (*VolumeResource) GetTerminalReason

func (vol *VolumeResource) GetTerminalReason() string

GetTerminalReason returns an error string to propagate up through to task state change messages

func (*VolumeResource) Initialize added in v1.20.0

func (vol *VolumeResource) Initialize(resourceFields *taskresource.ResourceFields,
	taskKnownStatus status.TaskStatus,
	taskDesiredStatus status.TaskStatus)

func (*VolumeResource) KnownCreated added in v1.20.0

func (vol *VolumeResource) KnownCreated() bool

KnownCreated returns true if the volume's known status is CREATED

func (*VolumeResource) MarshalJSON

func (vol *VolumeResource) MarshalJSON() ([]byte, error)

MarshalJSON marshals VolumeResource object using duplicate struct VolumeResourceJSON

func (*VolumeResource) NextKnownState added in v1.20.0

func (vol *VolumeResource) NextKnownState() resourcestatus.ResourceStatus

NextKnownState returns the state that the resource should progress to based on its `KnownState`.

func (*VolumeResource) SetAppliedStatus added in v1.20.0

func (vol *VolumeResource) SetAppliedStatus(status resourcestatus.ResourceStatus) bool

SetAppliedStatus sets the applied status of resource and returns whether the resource is already in a transition

func (*VolumeResource) SetCreatedAt

func (vol *VolumeResource) SetCreatedAt(createdAt time.Time)

SetCreatedAt sets the timestamp for resource's creation time

func (*VolumeResource) SetDesiredStatus

func (vol *VolumeResource) SetDesiredStatus(status resourcestatus.ResourceStatus)

SetDesiredStatus safely sets the desired status of the resource

func (*VolumeResource) SetKnownStatus

func (vol *VolumeResource) SetKnownStatus(status resourcestatus.ResourceStatus)

SetKnownStatus safely sets the currently known status of the resource

func (*VolumeResource) SetPauseContainerPID added in v1.38.0

func (vol *VolumeResource) SetPauseContainerPID(pid string)

SetPauseContainerPID adds pause container pid to the resource.

func (*VolumeResource) SourcePath added in v1.20.0

func (vol *VolumeResource) SourcePath() string

SourcePath is fulfilling the HostVolume interface

func (*VolumeResource) StatusString added in v1.20.0

func (vol *VolumeResource) StatusString(status resourcestatus.ResourceStatus) string

StatusString returns the string of the cgroup resource status

func (*VolumeResource) SteadyState added in v1.20.0

func (vol *VolumeResource) SteadyState() resourcestatus.ResourceStatus

SteadyState returns the transition state of the resource defined as "ready"

func (*VolumeResource) TerminalStatus added in v1.20.0

func (vol *VolumeResource) TerminalStatus() resourcestatus.ResourceStatus

TerminalStatus returns the last transition state of volume

func (*VolumeResource) UnmarshalJSON

func (vol *VolumeResource) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals VolumeResource object using duplicate struct VolumeResourceJSON

type VolumeStatus

type VolumeStatus resourcestatus.ResourceStatus

VolumeStatus defines resource statuses for docker volume

const (
	// VolumeStatusNone is the zero state of a task resource
	VolumeStatusNone VolumeStatus = iota
	// VolumeCreated represents a task resource which has been created
	VolumeCreated
	// VolumeRemoved represents a task resource which has been Removed
	VolumeRemoved
)

func (*VolumeStatus) MarshalJSON

func (vs *VolumeStatus) MarshalJSON() ([]byte, error)

MarshalJSON overrides the logic for JSON-encoding the ResourceStatus type

func (VolumeStatus) String

func (vs VolumeStatus) String() string

StatusString returns a human readable string representation of this object

func (*VolumeStatus) UnmarshalJSON

func (vs *VolumeStatus) UnmarshalJSON(b []byte) error

UnmarshalJSON overrides the logic for parsing the JSON-encoded ResourceStatus data

Jump to

Keyboard shortcuts

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