volume

package
Version: v0.0.0-...-5027423 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2021 License: Apache-2.0 Imports: 19 Imported by: 6

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

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

GetDriverOptions returns the driver options for creating an EFS volume.

func UseECSVolumePlugin

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

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

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

EFSAuthConfig contains auth config for an efs volume.

type EFSVolumeConfig

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

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

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

func (fs *FSHostVolume) Source() string

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

type LocalDockerVolume

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

func (e *LocalDockerVolume) Source() string

SourcePath returns the generated host path for the volume

type Volume

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

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

func NewVolumeMountOptions(opts ...string) *VolumeMountOptions

NewVolumeMountOptions returns a new VolumeMountOptions with options from argument.

func NewVolumeMountOptionsFromString

func NewVolumeMountOptionsFromString(s string) *VolumeMountOptions

NewVolumeMountOptionsFromString returns a new VolumeMountOptions with options from argument.

func (*VolumeMountOptions) AddOption

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

AddOption adds a new option to the option list.

func (*VolumeMountOptions) String

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

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

ApplyTransition calls the function required to move to the specified status

func (*VolumeResource) BuildContainerDependency

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

func (vol *VolumeResource) DependOnTaskNetwork() bool

DependOnTaskNetwork shows whether the resource creation needs task network setup beforehand

func (*VolumeResource) DesiredTerminal

func (vol *VolumeResource) DesiredTerminal() bool

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

func (*VolumeResource) GetAppliedStatus

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

func (*VolumeResource) GetContainerDependencies

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

func (vol *VolumeResource) GetName() string

GetName returns the name of the volume resource

func (*VolumeResource) GetPauseContainerPID

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

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

func (*VolumeResource) KnownCreated

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

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

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

func (*VolumeResource) SetAppliedStatus

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

func (vol *VolumeResource) SetPauseContainerPID(pid string)

SetPauseContainerPID adds pause container pid to the resource.

func (*VolumeResource) SourcePath

func (vol *VolumeResource) SourcePath() string

SourcePath is fulfilling the HostVolume interface

func (*VolumeResource) StatusString

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

StatusString returns the string of the cgroup resource status

func (*VolumeResource) SteadyState

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

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

func (*VolumeResource) TerminalStatus

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
t or T : Toggle theme light dark auto
y or Y : Canonical URL