Documentation ¶
Index ¶
- Constants
- type ApiECSClient
- func (client *ApiECSClient) CreateCluster(clusterName string) (string, error)
- func (client *ApiECSClient) CredentialProvider() credentials.AWSCredentialProvider
- func (client *ApiECSClient) DeregisterContainerInstance(containerInstanceArn string) error
- func (client *ApiECSClient) DiscoverPollEndpoint(containerInstanceArn string) (string, error)
- func (client *ApiECSClient) RegisterContainerInstance() (string, error)
- func (client *ApiECSClient) SubmitContainerStateChange(change ContainerStateChange) utils.RetriableError
- func (client *ApiECSClient) SubmitTaskStateChange(change ContainerStateChange) utils.RetriableError
- type ApplyingError
- type Container
- type ContainerOverrides
- type ContainerOverridesCopy
- type ContainerStateChange
- type ContainerStatus
- type DockerContainer
- type ECSClient
- type EmptyHostVolume
- type FSHostVolume
- type HostVolume
- type MountPoint
- type PortBinding
- type Resource
- type StateChangeError
- type Task
- func (task *Task) ContainerByName(name string) (*Container, bool)
- func (task *Task) DockerConfig(container *Container) (*docker.Config, error)
- func (task *Task) DockerHostConfig(container *Container, dockerContainerMap map[string]*DockerContainer) (*docker.HostConfig, error)
- func (task *Task) HostVolumeByName(name string) (HostVolume, bool)
- func (task *Task) InferContainerDesiredStatus()
- func (task *Task) Overridden() *Task
- func (task *Task) PostUnmarshalTask()
- func (t *Task) String() string
- func (task *Task) UpdateMountPoints(cont *Container, vols map[string]string)
- func (task *Task) UpdateTaskStatus() (newStatus TaskStatus)
- type TaskOverrides
- type TaskStatus
- type TaskVolume
- type VolumeFrom
Constants ¶
const DOCKER_MINIMUM_MEMORY = 4 * 1024 * 1024 // 4MB
const (
ECS_SERVICE = "ecs"
)
const EcsMaxReasonLength = 255
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApiECSClient ¶
type ApiECSClient struct {
// contains filtered or unexported fields
}
func (*ApiECSClient) CreateCluster ¶
func (client *ApiECSClient) CreateCluster(clusterName string) (string, error)
CreateCluster creates a cluster from a given name and returns its arn
func (*ApiECSClient) CredentialProvider ¶
func (client *ApiECSClient) CredentialProvider() credentials.AWSCredentialProvider
func (*ApiECSClient) DeregisterContainerInstance ¶
func (client *ApiECSClient) DeregisterContainerInstance(containerInstanceArn string) error
func (*ApiECSClient) DiscoverPollEndpoint ¶
func (client *ApiECSClient) DiscoverPollEndpoint(containerInstanceArn string) (string, error)
func (*ApiECSClient) RegisterContainerInstance ¶
func (client *ApiECSClient) RegisterContainerInstance() (string, error)
func (*ApiECSClient) SubmitContainerStateChange ¶
func (client *ApiECSClient) SubmitContainerStateChange(change ContainerStateChange) utils.RetriableError
func (*ApiECSClient) SubmitTaskStateChange ¶
func (client *ApiECSClient) SubmitTaskStateChange(change ContainerStateChange) utils.RetriableError
type ApplyingError ¶
type ApplyingError struct {
Err string `json:"error"`
}
ApplyingError is an error indicating something that went wrong transitioning from one state to another. For now it's very simple (and exists in part to ensure that there's a symetric marshal/unmarshal for the error).
func NewApplyingError ¶
func NewApplyingError(err error) *ApplyingError
func (*ApplyingError) Error ¶
func (ae *ApplyingError) Error() string
type Container ¶
type Container struct { Name string Image string Command []string Cpu uint Memory uint Links []string VolumesFrom []VolumeFrom `json:"volumesFrom"` MountPoints []MountPoint `json:"mountPoints"` Ports []PortBinding `json:"portMappings"` Essential bool EntryPoint *[]string Environment map[string]string `json:"environment"` Overrides ContainerOverrides `json:"overrides"` DesiredStatus ContainerStatus `json:"desiredStatus"` KnownStatus ContainerStatus // RunDependencies is a list of containers that must be run before // this one is created RunDependencies []string // 'Internal' containers are ones that are not directly specified by task definitions, but created by the agent IsInternal bool AppliedStatus ContainerStatus ApplyingError *ApplyingError SentStatus ContainerStatus KnownExitCode *int KnownPortBindings []PortBinding // Not upstream; todo move this out into a wrapper type StatusLock sync.Mutex }
func (*Container) DesiredTerminal ¶
func (*Container) KnownTerminal ¶
type ContainerOverrides ¶
type ContainerOverrides struct {
Command *[]string `json:"command"`
}
func (*ContainerOverrides) UnmarshalJSON ¶
func (overrides *ContainerOverrides) UnmarshalJSON(b []byte) error
This custom unmarshaller is needed because the json sent to us as a string rather than a fully typed object. We support both formats in the hopes that one day everything will be fully typed Note: the `json:",string"` tag DOES NOT apply here; it DOES NOT work with struct types, only ints/floats/etc. We're basically doing that though We also intentionally fail if there are any keys we were unable to unmarshal into our struct
type ContainerOverridesCopy ¶
type ContainerOverridesCopy ContainerOverrides
A type alias that doesn't have a custom unmarshaller so we can unmarshal into something without recursing
type ContainerStateChange ¶
type ContainerStateChange struct { TaskArn string ContainerName string Status ContainerStatus Reason string ExitCode *int PortBindings []PortBinding TaskStatus TaskStatus // TaskStatusNone if this does not result in a task state change Task *Task Container *Container }
type ContainerStatus ¶
type ContainerStatus int32
const ( ContainerStatusNone ContainerStatus = iota ContainerStatusUnknown ContainerPulled ContainerCreated ContainerRunning ContainerStopped ContainerDead ContainerZombie // Impossible status to use as a virtual 'max' )
func (*ContainerStatus) MarshalJSON ¶
func (cs *ContainerStatus) MarshalJSON() ([]byte, error)
func (*ContainerStatus) String ¶
func (cs *ContainerStatus) String() string
func (*ContainerStatus) TaskStatus ¶
func (cs *ContainerStatus) TaskStatus() TaskStatus
func (*ContainerStatus) Terminal ¶
func (cs *ContainerStatus) Terminal() bool
func (*ContainerStatus) UnmarshalJSON ¶
func (cs *ContainerStatus) UnmarshalJSON(b []byte) error
type DockerContainer ¶
type DockerContainer struct { DockerId string DockerName string // needed for linking Container *Container }
This is a mapping between containers-as-docker-knows-them and containers-as-we-know-them. This is primarily used in DockerState, but lives here such that tasks and containers know how to convert themselves into Docker's desired config format
func (*DockerContainer) String ¶
func (dc *DockerContainer) String() string
type ECSClient ¶
type ECSClient interface { CredentialProvider() credentials.AWSCredentialProvider RegisterContainerInstance() (string, error) SubmitTaskStateChange(change ContainerStateChange) utils.RetriableError SubmitContainerStateChange(change ContainerStateChange) utils.RetriableError DiscoverPollEndpoint(containerInstanceArn string) (string, error) DeregisterContainerInstance(containerInstanceArn string) error }
func NewECSClient ¶
func NewECSClient(credentialProvider credentials.AWSCredentialProvider, config *config.Config, insecureSkipVerify bool) ECSClient
type EmptyHostVolume ¶
type EmptyHostVolume struct {
// contains filtered or unexported fields
}
func (*EmptyHostVolume) SourcePath ¶
func (e *EmptyHostVolume) SourcePath() string
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) SourcePath ¶
func (fs *FSHostVolume) SourcePath() string
SourcePath returns the path on the host filesystem that should be mounted
type HostVolume ¶
type HostVolume interface {
SourcePath() string
}
HostVolume is an interface for something that may be used as the host half of a docker volume mount
type MountPoint ¶
type MountPoint struct { SourceVolume string `json:"sourceVolume"` ContainerPath string `json:"containerPath"` ReadOnly bool `json:"readOnly"` }
MountPoint describes the in-container location of a Volume and references that Volume by name.
type PortBinding ¶
func PortBindingFromDockerPortBinding ¶
func PortBindingFromDockerPortBinding(dockerPortBindings map[docker.Port][]docker.PortBinding) ([]PortBinding, error)
PortBindingFromDockerPortBinding constructs a PortBinding slice from a docker NetworkSettings.Ports map.
type StateChangeError ¶
type StateChangeError struct { Retriable bool // contains filtered or unexported fields }
Implements Error & Retriable
func NewStateChangeError ¶
func NewStateChangeError(err error) *StateChangeError
func (*StateChangeError) Error ¶
func (sce *StateChangeError) Error() string
func (*StateChangeError) Retry ¶
func (sce *StateChangeError) Retry() bool
type Task ¶
type Task struct { Arn string Overrides TaskOverrides `json:"-"` Family string Version string Containers []*Container Volumes []TaskVolume `json:"volumes"` DesiredStatus TaskStatus KnownStatus TaskStatus KnownTime time.Time SentStatus TaskStatus // contains filtered or unexported fields }
func RemoveFromTaskArray ¶
RemoveFromTaskArray removes the element at ndx from an array of task pointers, arr. If the ndx is out of bounds, it returns arr unchanged.
func (*Task) DockerConfig ¶
DockerConfig converts the given container in this task to the format of GoDockerClient's 'Config' struct
func (*Task) DockerHostConfig ¶
func (task *Task) DockerHostConfig(container *Container, dockerContainerMap map[string]*DockerContainer) (*docker.HostConfig, error)
func (*Task) HostVolumeByName ¶
func (task *Task) HostVolumeByName(name string) (HostVolume, bool)
HostVolumeByName returns the task Volume for the given a volume name in that task. The second return value indicates the presense of that volume
func (*Task) InferContainerDesiredStatus ¶
func (task *Task) InferContainerDesiredStatus()
InferContainerDesiredStatus ensures that all container's desired statuses are compatible with whatever status the task desires to be at or is at. This is used both to initialize container statuses of new tasks and to force auxilery containers into terminal states (e.g. the essential containers died already)
func (*Task) Overridden ¶
Overridden returns a copy of the task with all container's overridden and itself overridden as well
func (*Task) PostUnmarshalTask ¶
func (task *Task) PostUnmarshalTask()
PostUnmarshalTask is run after a task has been unmarshalled, but before it has been run. It is possible it will be subsequently called after that and should be able to handle such an occurrence appropriately (e.g. behave idempotently).
func (*Task) UpdateMountPoints ¶
func (*Task) UpdateTaskStatus ¶
func (task *Task) UpdateTaskStatus() (newStatus TaskStatus)
UpdateTaskState updates the given task's status based on its container's status. For example, if an essential container stops, it will set the task to stopped. It returns a TaskStatus indicating what change occured or TaskStatusNone if there was no change
type TaskOverrides ¶
type TaskOverrides struct{}
type TaskStatus ¶
type TaskStatus int32
const ( TaskStatusNone TaskStatus = iota TaskStatusUnknown TaskPulled TaskCreated TaskRunning TaskStopped TaskDead )
func (*TaskStatus) ContainerStatus ¶
func (ts *TaskStatus) ContainerStatus() ContainerStatus
func (*TaskStatus) MarshalJSON ¶
func (ts *TaskStatus) MarshalJSON() ([]byte, error)
func (*TaskStatus) String ¶
func (ts *TaskStatus) String() string
func (*TaskStatus) Terminal ¶
func (ts *TaskStatus) Terminal() bool
func (*TaskStatus) UnmarshalJSON ¶
func (ts *TaskStatus) UnmarshalJSON(b []byte) error
type TaskVolume ¶
type TaskVolume struct { Name string `json:"name"` Volume HostVolume }
TaskVolume is a definition of all the volumes available for containers to reference within a task. It must be named.
func (*TaskVolume) MarshalJSON ¶
func (tv *TaskVolume) MarshalJSON() ([]byte, error)
func (*TaskVolume) UnmarshalJSON ¶
func (tv *TaskVolume) UnmarshalJSON(b []byte) error
UnmarshalJSON for TaskVolume determines the name and volume type, and unmarshals it into the appropriate HostVolume fulfilling interfaces
type VolumeFrom ¶
type VolumeFrom struct { SourceContainer string `json:"sourceContainer"` ReadOnly bool `json:"readOnly"` }
VolumeFrom is a volume which references another container as its source.