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 Container
- type ContainerOverrides
- type ContainerOverridesCopy
- type ContainerStateChange
- type ContainerStatus
- type DockerContainer
- type ECSClient
- type PortBinding
- type Resource
- type StateChangeError
- type Task
- func (task *Task) ContainerByName(name string) (*Container, bool)
- func (task *Task) ContainersByName() map[string]*Container
- func (task *Task) DockerHostConfig(container *Container, dockerContainerMap map[string]*DockerContainer) (*docker.HostConfig, error)
- func (task *Task) InferContainerDesiredStatus()
- func (task *Task) Overridden() *Task
- func (t *Task) String() string
- type TaskOverrides
- type TaskStatus
Constants ¶
const ( ECS_SERVICE = "ecs" DEFAULT_CLUSTER_NAME = "default" )
const DOCKER_MINIMUM_MEMORY = 4 * 1024 * 1024 // 4MB
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 Container ¶
type Container struct { Name string Image string Command []string Cpu uint Memory uint Links []string BindMounts []string VolumesFrom []string Ports []PortBinding `json:"portMappings"` Essential bool EntryPoint *[]string Environment map[string]string `json:"environment"` Overrides ContainerOverrides `json:"overrides"` DesiredStatus ContainerStatus `json:"desiredStatus"` AppliedStatus ContainerStatus KnownStatus ContainerStatus KnownExitCode *int KnownPortBindings []PortBinding // Not upstream; todo move this out into a wrapper type StatusLock sync.Mutex }
func (*Container) DockerConfig ¶
DockerConfig converts the given container in this task to the format of GoDockerClient's 'Config' struct
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 }
type ContainerStatus ¶
type ContainerStatus int32
const ( ContainerStatusNone ContainerStatus = iota ContainerStatusUnknown ContainerPulled ContainerCreated ContainerRunning ContainerStopped ContainerDead )
func (*ContainerStatus) String ¶
func (cs *ContainerStatus) String() string
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
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 PortBinding ¶
func PortBindingFromDockerPortBinding ¶
func PortBindingFromDockerPortBinding(dockerPortBindings map[docker.Port][]docker.PortBinding) ([]PortBinding, error)
PortBindingFromDockerPortBinding constructs a PortBinding slice from a docker NetworkSettings.Ports map. It prefers to fail-hard rather than report incorrect information, so any issues in docker's data will result in an error
type StateChangeError ¶
type StateChangeError struct { Retriable bool // contains filtered or unexported fields }
Implements Error & Retriable
func NewStateChangeError ¶
func NewStateChangeError(message string, retriable bool) *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:"ignore"` // No taskOverrides right now Family string Version string Containers []*Container DesiredStatus TaskStatus KnownStatus 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) ContainersByName ¶
func (*Task) DockerHostConfig ¶
func (task *Task) DockerHostConfig(container *Container, dockerContainerMap map[string]*DockerContainer) (*docker.HostConfig, error)
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
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) String ¶
func (ts *TaskStatus) String() string
func (*TaskStatus) UnmarshalJSON ¶
func (ts *TaskStatus) UnmarshalJSON(b []byte) error