Documentation
¶
Index ¶
- Constants
- func GetDriverOptions(cfg *config.Config, efsVolCfg *EFSVolumeConfig, credsRelativeURI string) map[string]string
- func UseECSVolumePlugin(cfg *config.Config) bool
- type DockerVolumeConfig
- type EBSTaskVolumeConfig
- type EFSAuthConfig
- type EFSVolumeConfig
- type FSHostVolume
- type LocalDockerVolume
- type Volume
- type VolumeMountOptions
- type VolumeResource
- func (vol *VolumeResource) ApplyTransition(nextState resourcestatus.ResourceStatus) error
- func (vol *VolumeResource) BuildContainerDependency(containerName string, satisfied apicontainerstatus.ContainerStatus, ...)
- func (vol *VolumeResource) Cleanup() error
- func (vol *VolumeResource) Create() error
- func (vol *VolumeResource) DependOnTaskNetwork() bool
- func (vol *VolumeResource) DesiredTerminal() bool
- func (vol *VolumeResource) GetAppliedStatus() resourcestatus.ResourceStatus
- func (vol *VolumeResource) GetContainerDependencies(dependent resourcestatus.ResourceStatus) []apicontainer.ContainerDependency
- func (vol *VolumeResource) GetCreatedAt() time.Time
- func (vol *VolumeResource) GetDesiredStatus() resourcestatus.ResourceStatus
- func (vol *VolumeResource) GetKnownStatus() resourcestatus.ResourceStatus
- func (vol *VolumeResource) GetMountPoint() string
- func (vol *VolumeResource) GetName() string
- func (vol *VolumeResource) GetPauseContainerPID() string
- func (vol *VolumeResource) GetTerminalReason() string
- func (vol *VolumeResource) Initialize(resourceFields *taskresource.ResourceFields, taskKnownStatus status.TaskStatus, ...)
- func (vol *VolumeResource) KnownCreated() bool
- func (vol *VolumeResource) MarshalJSON() ([]byte, error)
- func (vol *VolumeResource) NextKnownState() resourcestatus.ResourceStatus
- func (vol *VolumeResource) SetAppliedStatus(status resourcestatus.ResourceStatus) bool
- func (vol *VolumeResource) SetCreatedAt(createdAt time.Time)
- func (vol *VolumeResource) SetDesiredStatus(status resourcestatus.ResourceStatus)
- func (vol *VolumeResource) SetKnownStatus(status resourcestatus.ResourceStatus)
- func (vol *VolumeResource) SetPauseContainerPID(pid string)
- func (vol *VolumeResource) SourcePath() string
- func (vol *VolumeResource) StatusString(status resourcestatus.ResourceStatus) string
- func (vol *VolumeResource) SteadyState() resourcestatus.ResourceStatus
- func (vol *VolumeResource) TerminalStatus() resourcestatus.ResourceStatus
- func (vol *VolumeResource) UnmarshalJSON(b []byte) error
- type VolumeStatus
Constants ¶
const ( // TaskScope indicates that the volume is created and deleted with task TaskScope = "task" SharedScope = "shared" // DockerLocalVolumeDriver is the name of the docker default volume driver DockerLocalVolumeDriver = "local" EFSVolumeType = "efs" EBSVolumeType = "ebs" DockerVolumeType = "docker" FSHostVolumeType = "fshost" )
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" )
const ( TestAttachmentType = "amazonebs" TestVolumeId = "vol-12345" TestVolumeSizeGib = "10" TestSourceVolumeHostPath = "taskarn_vol-12345" TestVolumeName = "test-volume" TestFileSystem = "ext4" TestDeviceName = "/dev/nvme1n1" )
This file contains constants that are commonly used when testing with EBS volumes for tasks. These constants should only be called in test files.
const (
EBSSourcePrefix = "/mnt/ecs/ebs/"
)
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 ¶
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) GetType ¶
func (cfg *DockerVolumeConfig) GetType() string
func (*DockerVolumeConfig) GetVolumeId ¶
func (cfg *DockerVolumeConfig) GetVolumeId() string
func (*DockerVolumeConfig) GetVolumeName ¶
func (cfg *DockerVolumeConfig) GetVolumeName() string
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 EBSTaskVolumeConfig ¶
type EBSTaskVolumeConfig struct { VolumeId string `json:"volumeId"` VolumeName string `json:"volumeName"` VolumeSizeGib string `json:"volumeSizeGib"` SourceVolumeHostPath string `json:"sourceVolumeHostPath"` DeviceName string `json:"deviceName"` // FileSystem is optional and will be present if customers explicitly set this in their task definition FileSystem string `json:"fileSystem"` // DockerVolumeName is internal docker name for this volume. DockerVolumeName string `json:"dockerVolumeName"` }
func ParseEBSTaskVolumeAttachment ¶
func ParseEBSTaskVolumeAttachment(ebsAttachment *ecsacs.Attachment) (*EBSTaskVolumeConfig, error)
ParseEBSTaskVolumeAttachment parses the ebs task volume config value from the given attachment.
func (*EBSTaskVolumeConfig) GetType ¶
func (cfg *EBSTaskVolumeConfig) GetType() string
func (*EBSTaskVolumeConfig) GetVolumeId ¶
func (cfg *EBSTaskVolumeConfig) GetVolumeId() string
func (*EBSTaskVolumeConfig) GetVolumeName ¶
func (cfg *EBSTaskVolumeConfig) GetVolumeName() string
func (*EBSTaskVolumeConfig) Source ¶
func (cfg *EBSTaskVolumeConfig) Source() string
Source returns the source volume host mount point for an EBS volume
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) GetType ¶
func (cfg *EFSVolumeConfig) GetType() string
func (*EFSVolumeConfig) GetVolumeId ¶
func (cfg *EFSVolumeConfig) GetVolumeId() string
func (*EFSVolumeConfig) GetVolumeName ¶
func (cfg *EFSVolumeConfig) GetVolumeName() string
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) GetVolumeId ¶
func (fs *FSHostVolume) GetVolumeId() string
Currently not meant for use
func (*FSHostVolume) GetVolumeName ¶
func (fs *FSHostVolume) GetVolumeName() string
Currently not meant for use
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) GetType ¶
func (e *LocalDockerVolume) GetType() string
Currently not meant for use
func (*LocalDockerVolume) GetVolumeId ¶
func (e *LocalDockerVolume) GetVolumeId() string
Currently not meant for use
func (*LocalDockerVolume) GetVolumeName ¶
func (e *LocalDockerVolume) GetVolumeName() string
Currently not meant for use
func (*LocalDockerVolume) Source ¶
func (e *LocalDockerVolume) Source() string
SourcePath returns the generated host path for the volume
type Volume ¶
type Volume interface { Source() string GetType() string GetVolumeId() string GetVolumeName() 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