Documentation ¶
Index ¶
- Constants
- func NewAttachmentHandlers() map[string]AttachmentHandler
- type Association
- type AttachmentHandler
- type EncodedString
- type Option
- type PlatformFields
- type ServiceConnectAttachmentHandler
- type Task
- func (task *Task) AddFirelensContainerBindMounts(firelensConfig *apicontainer.FirelensConfig, ...) *apierrors.HostConfigError
- func (task *Task) AddResource(resourceType string, resource taskresource.TaskResource)
- func (task *Task) AddTaskENI(eni *ni.NetworkInterface)
- func (task *Task) ApplyExecutionRoleLogsAuth(hostConfig *dockercontainer.HostConfig, credentialsManager credentials.Manager) *apierrors.HostConfigError
- func (task *Task) AssociationByTypeAndName(associationType, associationName string) (*Association, bool)
- func (task *Task) AssociationsByTypeAndContainer(associationType, containerName string) []string
- func (task *Task) BuildCNIConfigAwsvpc(includeIPAMConfig bool, cniConfig *ecscni.Config) (*ecscni.Config, error)
- func (task *Task) BuildCNIConfigBridgeMode(cniConfig *ecscni.Config, containerName string) (*ecscni.Config, error)
- func (task *Task) BuildCgroupRoot() (string, error)
- func (task *Task) BuildLinuxResourceSpec(cGroupCPUPeriod time.Duration, taskPidsLimit int) (specs.LinuxResources, error)
- func (task *Task) ContainerByName(name string) (*apicontainer.Container, bool)
- func (task *Task) DockerConfig(container *apicontainer.Container, apiVersion dockerclient.DockerVersion) (*dockercontainer.Config, *apierrors.DockerClientConfigError)
- func (task *Task) DockerHostConfig(container *apicontainer.Container, ...) (*dockercontainer.HostConfig, *apierrors.HostConfigError)
- func (task *Task) GetAllCredentialSpecRequirements() map[string]string
- func (task *Task) GetAppMesh() *nlappmesh.AppMesh
- func (task *Task) GetBridgeModePauseContainerForTaskContainer(container *apicontainer.Container) (*apicontainer.Container, error)
- func (task *Task) GetContainerIndex(containerName string) int
- func (task *Task) GetCredentialSpecResource() ([]taskresource.TaskResource, bool)
- func (task *Task) GetCredentialsID() string
- func (task *Task) GetCredentialsRelativeURI() string
- func (task *Task) GetDefaultIfname() string
- func (task *Task) GetDesiredStatus() apitaskstatus.TaskStatus
- func (task *Task) GetExecutionCredentialsID() string
- func (task *Task) GetExecutionStoppedAt() time.Time
- func (task *Task) GetFirelensContainer() *apicontainer.Container
- func (task *Task) GetID() string
- func (task *Task) GetKnownStatus() apitaskstatus.TaskStatus
- func (task *Task) GetKnownStatusTime() time.Time
- func (task *Task) GetLocalIPAddress() string
- func (task *Task) GetNetworkMode() string
- func (task *Task) GetNetworkNamespace() string
- func (task *Task) GetPrimaryENI() *ni.NetworkInterface
- func (task *Task) GetPullStartedAt() time.Time
- func (task *Task) GetPullStoppedAt() time.Time
- func (task *Task) GetResources() []taskresource.TaskResource
- func (task *Task) GetSentStatus() apitaskstatus.TaskStatus
- func (task *Task) GetServiceConnectContainer() *apicontainer.Container
- func (task *Task) GetServiceConnectNetworkConfig() serviceconnect.NetworkConfig
- func (task *Task) GetServiceConnectRuntimeConfig() serviceconnect.RuntimeConfig
- func (task *Task) GetTaskENIs() []*ni.NetworkInterface
- func (task *Task) GetTerminalReason() string
- func (task *Task) HasAContainerWithResolvedDigest() bool
- func (task *Task) HasActiveContainers() bool
- func (task *Task) HostVolumeByName(name string) (taskresourcevolume.Volume, bool)
- func (task *Task) InitializeResources(resourceFields *taskresource.ResourceFields)
- func (task *Task) IsContainerServiceConnectPause(containerName string) bool
- func (task *Task) IsEBSTaskAttachEnabled() bool
- func (task *Task) IsFaultInjectionEnabled() bool
- func (task *Task) IsLaunchTypeFargate() bool
- func (task *Task) IsManagedDaemonTask() (string, bool)
- func (task *Task) IsNetworkModeAWSVPC() bool
- func (task *Task) IsNetworkModeBridge() bool
- func (task *Task) IsNetworkModeHost() bool
- func (task *Task) IsRunning() bool
- func (task *Task) IsServiceConnectBridgeModeApplicationContainer(container *apicontainer.Container) bool
- func (task *Task) IsServiceConnectConnectionDraining() bool
- func (task *Task) IsServiceConnectEnabled() bool
- func (task *Task) MarshalJSON() ([]byte, error)
- func (task *Task) MergeEnvVarsFromEnvfiles(container *apicontainer.Container) *apierrors.ResourceInitError
- func (task *Task) PopulateASMAuthData(container *apicontainer.Container) error
- func (task *Task) PopulateSecretLogOptionsToFirelensContainer(firelensContainer *apicontainer.Container) *apierrors.DockerClientConfigError
- func (task *Task) PopulateSecrets(hostConfig *dockercontainer.HostConfig, container *apicontainer.Container) *apierrors.DockerClientConfigError
- func (task *Task) PopulateServiceConnectContainerMappingEnvVar() error
- func (task *Task) PopulateServiceConnectNetworkConfig(ipv4Addr string, ipv6Addr string)
- func (task *Task) PopulateServiceConnectRuntimeConfig(serviceConnectConfig serviceconnect.RuntimeConfig)
- func (task *Task) PostUnmarshalTask(cfg *config.Config, credentialsManager credentials.Manager, ...) error
- func (task *Task) RecordExecutionStoppedAt(container *apicontainer.Container)
- func (task *Task) RemoveVolume(index int)
- func (task *Task) RequiresDomainlessCredentialSpecResource() bool
- func (task *Task) SetAppMesh(appMesh *nlappmesh.AppMesh)
- func (task *Task) SetCredentialsID(id string)
- func (task *Task) SetCredentialsRelativeURI(uri string)
- func (task *Task) SetDefaultIfname(ifname string)
- func (task *Task) SetDesiredStatus(status apitaskstatus.TaskStatus)
- func (task *Task) SetExecutionRoleCredentialsID(id string)
- func (task *Task) SetExecutionStoppedAt(timestamp time.Time) bool
- func (task *Task) SetKnownStatus(status apitaskstatus.TaskStatus)
- func (task *Task) SetLocalIPAddress(addr string)
- func (task *Task) SetNetworkNamespace(netNs string)
- func (task *Task) SetPausePIDInVolumeResources(pid string)
- func (task *Task) SetPullStartedAt(timestamp time.Time) bool
- func (task *Task) SetPullStoppedAt(timestamp time.Time)
- func (task *Task) SetSentStatus(status apitaskstatus.TaskStatus)
- func (task *Task) SetServiceConnectConnectionDraining(draining bool)
- func (task *Task) SetTerminalReason(reason string)
- func (task *Task) String() string
- func (task *Task) ToHostResources() map[string]*ecs.Resource
- func (task *Task) UpdateDesiredStatus()
- func (task *Task) UpdateMountPoints(cont *apicontainer.Container, vols []types.MountPoint)
- func (task *Task) UpdateStatus() bool
- func (task *Task) UpdateTaskENIsLinkName()
- type TaskENIs
- type TaskOverrides
- type TaskVolume
- Bugs
Constants ¶
const ( // NetworkPauseContainerName is the internal name for the pause container NetworkPauseContainerName = "~internal~ecs~pause" // ServiceConnectPauseContainerNameFormat is the naming format for SC pause containers ServiceConnectPauseContainerNameFormat = "~internal~ecs~pause-%s" // NamespacePauseContainerName is the internal name for the IPC resource namespace and/or // PID namespace sharing pause container NamespacePauseContainerName = "~internal~ecs~pause~namespace" NvidiaVisibleDevicesEnvVar = "NVIDIA_VISIBLE_DEVICES" GPUAssociationType = "gpu" ContainerOrderingCreateCondition = "CREATE" ContainerOrderingStartCondition = "START" ContainerOrderingHealthyCondition = "HEALTHY" // FirelensLogDriverBufferLimitOption is the option for customers who want to specify the buffer limit size in FireLens. FirelensLogDriverBufferLimitOption = "log-driver-buffer-limit" // BridgeNetworkMode specifies bridge type mode for a task BridgeNetworkMode = "bridge" // AWSVPCNetworkMode specifies awsvpc type mode for a task AWSVPCNetworkMode = "awsvpc" // HostNetworkMode specifies host type mode for a task HostNetworkMode = "host" )
const ( HostVolumeType = "host" DockerVolumeType = "docker" EFSVolumeType = "efs" FSxWindowsFileServerVolumeType = "fsxWindowsFileServer" AttachmentType = "attachment" )
Variables ¶
This section is empty.
Functions ¶
func NewAttachmentHandlers ¶
func NewAttachmentHandlers() map[string]AttachmentHandler
NewAttachmentHandlers returns all type of handlers to handle different types of attachment.
Types ¶
type Association ¶
type Association struct { // Containers are the container names that can use this association. Containers []string `json:"containers"` // Content describes this association. Content EncodedString `json:"content"` // Name is a unique identifier of the association within a task. Name string `json:"name"` // Type specifies the type of this association. Type string `json:"type"` }
Association is a definition of a device (or other potential things) that is associated with a task.
type AttachmentHandler ¶
type AttachmentHandler interface {
// contains filtered or unexported methods
}
AttachmentHandler defines an interface to handle attachment received from ACS.
type EncodedString ¶
type EncodedString struct { // Encoding is the encoding type of the value. Encoding string `json:"encoding"` // Value is the content of the encoded string. Value string `json:"value"` }
EncodedString is used to describe an association, the consumer of the association data should be responsible to decode it. We don't model it in Agent, or check the value of the encoded string, we just pass whatever we get from ACS, because we don't want Agent to be coupled with a specific association.
type Option ¶
Option defines a function that can be executed in some task API methods in order to perform custom configurations of the task
type PlatformFields ¶
type PlatformFields struct{}
PlatformFields consists of fields specific to Linux for a task
type ServiceConnectAttachmentHandler ¶
type ServiceConnectAttachmentHandler struct {
// contains filtered or unexported fields
}
ServiceConnectAttachmentHandler defines a service connect type attachment handler.
type Task ¶
type Task struct { // Arn is the unique identifier for the task Arn string // Overrides are the overrides applied to a task Overrides TaskOverrides `json:"-"` // Family is the name of the task definition family Family string // Version is the version of the task definition Version string // ServiceName is the name of the service to which the task belongs. // It is empty if the task does not belong to any service. ServiceName string // Containers are the containers for the task Containers []*apicontainer.Container // Associations are the available associations for the task. Associations []Association `json:"associations"` // ResourcesMapUnsafe is the map of resource type to corresponding resources ResourcesMapUnsafe resourcetype.ResourcesMap `json:"resources"` // Volumes are the volumes for the task Volumes []TaskVolume `json:"volumes"` // CPU is a task-level limit for compute resources. A value of 1 means that // the task may access 100% of 1 vCPU on the instance CPU float64 `json:"Cpu,omitempty"` // Memory is a task-level limit for memory resources in bytes Memory int64 `json:"Memory,omitempty"` // DesiredStatusUnsafe represents the state where the task should go. Generally, // the desired status is informed by the ECS backend as a result of either // API calls made to ECS or decisions made by the ECS service scheduler. // The DesiredStatusUnsafe is almost always either apitaskstatus.TaskRunning or apitaskstatus.TaskStopped. // NOTE: Do not access DesiredStatusUnsafe directly. // Instead, use `UpdateStatus`, `UpdateDesiredStatus`, and `SetDesiredStatus`. // TODO DesiredStatusUnsafe should probably be private with appropriately written // setter/getter. When this is done, we need to ensure that the UnmarshalJSON // is handled properly so that the state storage continues to work. DesiredStatusUnsafe apitaskstatus.TaskStatus `json:"DesiredStatus"` // KnownStatusUnsafe represents the state where the task is. This is generally // the minimum of equivalent status types for the containers in the task; // if one container is at ContainerRunning and another is at ContainerPulled, // the task KnownStatusUnsafe would be TaskPulled. // NOTE: Do not access KnownStatusUnsafe directly. Instead, use `UpdateStatus`, // and `GetKnownStatus`. // TODO KnownStatusUnsafe should probably be private with appropriately written // setter/getter. When this is done, we need to ensure that the UnmarshalJSON // is handled properly so that the state storage continues to work. KnownStatusUnsafe apitaskstatus.TaskStatus `json:"KnownStatus"` // KnownStatusTimeUnsafe captures the time when the KnownStatusUnsafe was last updated. // NOTE: Do not access KnownStatusTime directly, instead use `GetKnownStatusTime`. KnownStatusTimeUnsafe time.Time `json:"KnownTime"` // PullStartedAtUnsafe is the timestamp when the task start pulling the first container, // it won't be set if the pull never happens PullStartedAtUnsafe time.Time `json:"PullStartedAt"` // PullStoppedAtUnsafe is the timestamp when the task finished pulling the last container, // it won't be set if the pull never happens PullStoppedAtUnsafe time.Time `json:"PullStoppedAt"` // ExecutionStoppedAtUnsafe is the timestamp when the task desired status moved to stopped, // which is when any of the essential containers stopped ExecutionStoppedAtUnsafe time.Time `json:"ExecutionStoppedAt"` // SentStatusUnsafe represents the last KnownStatusUnsafe that was sent to the ECS SubmitTaskStateChange API. // TODO SentStatusUnsafe should probably be private with appropriately written // setter/getter. When this is done, we need to ensure that the UnmarshalJSON // is handled properly so that the state storage continues to work. SentStatusUnsafe apitaskstatus.TaskStatus `json:"SentStatus"` // ExecutionCredentialsID is the ID of credentials that are used by agent to // perform some action at the task level, such as pulling image from ECR ExecutionCredentialsID string `json:"executionCredentialsID"` // ENIs is the list of Elastic Network Interfaces assigned to this task. The // TaskENIs type is helpful when decoding state files which might have stored // ENIs as a single ENI object instead of a list. ENIs TaskENIs `json:"ENI"` // AppMesh is the service mesh specified by the task AppMesh *nlappmesh.AppMesh // MemoryCPULimitsEnabled to determine if task supports CPU, memory limits MemoryCPULimitsEnabled bool `json:"MemoryCPULimitsEnabled,omitempty"` // PlatformFields consists of fields specific to linux/windows for a task PlatformFields PlatformFields `json:"PlatformFields,omitempty"` // PIDMode is used to determine how PID namespaces are organized between // containers of the Task PIDMode string `json:"PidMode,omitempty"` // IPCMode is used to determine how IPC resources should be shared among // containers of the Task IPCMode string `json:"IpcMode,omitempty"` // NvidiaRuntime is the runtime to pass Nvidia GPU devices to containers NvidiaRuntime string `json:"NvidiaRuntime,omitempty"` // LocalIPAddressUnsafe stores the local IP address allocated to the bridge that connects the task network // namespace and the host network namespace, for tasks in awsvpc network mode (tasks in other network mode won't // have a value for this). This field should be accessed via GetLocalIPAddress and SetLocalIPAddress. LocalIPAddressUnsafe string `json:"LocalIPAddress,omitempty"` // LaunchType is the launch type of this task. LaunchType string `json:"LaunchType,omitempty"` ServiceConnectConfig *serviceconnect.Config `json:"ServiceConnectConfig,omitempty"` ServiceConnectConnectionDrainingUnsafe bool `json:"ServiceConnectConnectionDraining,omitempty"` NetworkMode string `json:"NetworkMode,omitempty"` IsInternal bool `json:"IsInternal,omitempty"` NetworkNamespace string `json:"NetworkNamespace,omitempty"` EnableFaultInjection bool `json:"enableFaultInjection,omitempty"` // DefaultIfname is used to reference the default network interface name on the task network namespace // For AWSVPC mode, it can be eth0 which corresponds to the interface name on the task ENI // For Host mode, it can vary based on the hardware/network config on the host instance (e.g. eth0, ens5, etc.) and will need to be obtained on the host. // For all other network modes (i.e. bridge, none, etc.), DefaultIfname is currently not being initialized/set. In order to use this task field for these // network modes, changes will need to be made in the corresponding task provisioning workflows. DefaultIfname string `json:"DefaultIfname,omitempty"` // contains filtered or unexported fields }
Task is the internal representation of a task in the ECS agent
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 TaskFromACS ¶
TaskFromACS translates ecsacs.Task to apitask.Task by first marshaling the received ecsacs.Task to json and unmarshalling it as apitask.Task
func (*Task) AddFirelensContainerBindMounts ¶
func (task *Task) AddFirelensContainerBindMounts(firelensConfig *apicontainer.FirelensConfig, hostConfig *dockercontainer.HostConfig, config *config.Config) *apierrors.HostConfigError
AddFirelensContainerBindMounts adds config file bind mount and socket directory bind mount to the firelens container's host config.
func (*Task) AddResource ¶
func (task *Task) AddResource(resourceType string, resource taskresource.TaskResource)
AddResource adds a resource to ResourcesMap
func (*Task) AddTaskENI ¶
func (task *Task) AddTaskENI(eni *ni.NetworkInterface)
AddTaskENI adds ENI information to the task.
func (*Task) ApplyExecutionRoleLogsAuth ¶
func (task *Task) ApplyExecutionRoleLogsAuth(hostConfig *dockercontainer.HostConfig, credentialsManager credentials.Manager) *apierrors.HostConfigError
ApplyExecutionRoleLogsAuth will check whether the task has execution role credentials, and add the generated credentials endpoint to the associated HostConfig
func (*Task) AssociationByTypeAndName ¶
func (task *Task) AssociationByTypeAndName(associationType, associationName string) (*Association, bool)
AssociationByTypeAndName gets an association of a certain type and name
func (*Task) AssociationsByTypeAndContainer ¶
AssociationsByTypeAndContainer gets a list of names of all the associations associated with a container and of a certain type
func (*Task) BuildCNIConfigAwsvpc ¶
func (task *Task) BuildCNIConfigAwsvpc(includeIPAMConfig bool, cniConfig *ecscni.Config) (*ecscni.Config, error)
BuildCNIConfigAwsvpc builds a list of CNI network configurations for the task. If includeIPAMConfig is set to true, the list also includes the bridge IPAM configuration.
func (*Task) BuildCNIConfigBridgeMode ¶
func (task *Task) BuildCNIConfigBridgeMode(cniConfig *ecscni.Config, containerName string) (*ecscni.Config, error)
BuildCNIConfigBridgeMode builds a list of CNI network configurations for a task in docker bridge mode. Currently the only plugin in available is for Service Connect
func (*Task) BuildCgroupRoot ¶
BuildCgroupRoot helps build the task cgroup prefix Example v1: /ecs/task-id Example v2: ecstasks-$TASKID.slice
func (*Task) BuildLinuxResourceSpec ¶
func (task *Task) BuildLinuxResourceSpec(cGroupCPUPeriod time.Duration, taskPidsLimit int) (specs.LinuxResources, error)
BuildLinuxResourceSpec returns a linuxResources object for the task cgroup
func (*Task) ContainerByName ¶
func (task *Task) ContainerByName(name string) (*apicontainer.Container, bool)
ContainerByName returns the *Container for the given name
func (*Task) DockerConfig ¶
func (task *Task) DockerConfig(container *apicontainer.Container, apiVersion dockerclient.DockerVersion) (*dockercontainer.Config, *apierrors.DockerClientConfigError)
DockerConfig converts the given container in this task to the format of the Docker SDK 'Config' struct
func (*Task) DockerHostConfig ¶
func (task *Task) DockerHostConfig(container *apicontainer.Container, dockerContainerMap map[string]*apicontainer.DockerContainer, apiVersion dockerclient.DockerVersion, cfg *config.Config) (*dockercontainer.HostConfig, *apierrors.HostConfigError)
DockerHostConfig construct the configuration recognized by docker
func (*Task) GetAllCredentialSpecRequirements ¶
GetAllCredentialSpecRequirements is used to build all the credential spec requirements for the task
func (*Task) GetAppMesh ¶
GetAppMesh returns the app mesh config of the task
func (*Task) GetBridgeModePauseContainerForTaskContainer ¶
func (task *Task) GetBridgeModePauseContainerForTaskContainer(container *apicontainer.Container) (*apicontainer.Container, error)
GetBridgeModePauseContainerForTaskContainer retrieves the associated pause container for a task container (SC container or customer-defined containers) in a bridge-mode SC-enabled task. For a container with name "abc", the pause container will always be named "~internal~ecs~pause-abc"
func (*Task) GetContainerIndex ¶
GetContainerIndex returns the index of the container in the container list. This doesn't count internal container.
func (*Task) GetCredentialSpecResource ¶
func (task *Task) GetCredentialSpecResource() ([]taskresource.TaskResource, bool)
GetCredentialSpecResource retrieves credentialspec resource from resource map
func (*Task) GetCredentialsID ¶
GetCredentialsID gets the credentials ID for the task
func (*Task) GetCredentialsRelativeURI ¶
GetCredentialsRelativeURI returns the credentials relative uri for the task
func (*Task) GetDefaultIfname ¶
func (*Task) GetDesiredStatus ¶
func (task *Task) GetDesiredStatus() apitaskstatus.TaskStatus
GetDesiredStatus gets the desired status of the task
func (*Task) GetExecutionCredentialsID ¶
GetExecutionCredentialsID gets the credentials ID for the task
func (*Task) GetExecutionStoppedAt ¶
GetExecutionStoppedAt returns the task executionStoppedAt timestamp
func (*Task) GetFirelensContainer ¶
func (task *Task) GetFirelensContainer() *apicontainer.Container
GetFirelensContainer returns the firelens container in the task, if there is one.
func (*Task) GetID ¶
GetID is used to retrieve the taskID from taskARN Reference: http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-ecs
func (*Task) GetKnownStatus ¶
func (task *Task) GetKnownStatus() apitaskstatus.TaskStatus
GetKnownStatus gets the KnownStatus of the task
func (*Task) GetKnownStatusTime ¶
GetKnownStatusTime gets the KnownStatusTime of the task
func (*Task) GetLocalIPAddress ¶
GetLocalIPAddress returns the local IP address of the task.
func (*Task) GetNetworkMode ¶
func (*Task) GetNetworkNamespace ¶
func (*Task) GetPrimaryENI ¶
func (task *Task) GetPrimaryENI() *ni.NetworkInterface
GetPrimaryENI returns the primary ENI of the task. Since ACS can potentially send multiple ENIs to the agent, the first ENI in the list is considered as the primary ENI.
func (*Task) GetPullStartedAt ¶
GetPullStartedAt returns the PullStartedAt timestamp
func (*Task) GetPullStoppedAt ¶
GetPullStoppedAt returns the PullStoppedAt timestamp
func (*Task) GetResources ¶
func (task *Task) GetResources() []taskresource.TaskResource
GetResources returns the list of task resources from ResourcesMap
func (*Task) GetSentStatus ¶
func (task *Task) GetSentStatus() apitaskstatus.TaskStatus
GetSentStatus safely returns the SentStatus of the task
func (*Task) GetServiceConnectContainer ¶
func (task *Task) GetServiceConnectContainer() *apicontainer.Container
func (*Task) GetServiceConnectNetworkConfig ¶
func (task *Task) GetServiceConnectNetworkConfig() serviceconnect.NetworkConfig
func (*Task) GetServiceConnectRuntimeConfig ¶
func (task *Task) GetServiceConnectRuntimeConfig() serviceconnect.RuntimeConfig
func (*Task) GetTaskENIs ¶
func (task *Task) GetTaskENIs() []*ni.NetworkInterface
GetTaskENIs returns the list of ENIs for the task.
func (*Task) GetTerminalReason ¶
GetTerminalReason retrieves the terminalReason string
func (*Task) HasAContainerWithResolvedDigest ¶
HasAContainerWithResolvedDigest checks if the task has at least one container with a successfully resolved image manifest digest.
func (*Task) HasActiveContainers ¶
func (*Task) HostVolumeByName ¶
func (task *Task) HostVolumeByName(name string) (taskresourcevolume.Volume, bool)
HostVolumeByName returns the task Volume for the given a volume name in that task. The second return value indicates the presence of that volume
func (*Task) InitializeResources ¶
func (task *Task) InitializeResources(resourceFields *taskresource.ResourceFields)
InitializeResources initializes the required field in the task on agent restart Some of the fields in task isn't saved in the agent state file, agent needs to initialize these fields before processing the task, eg: docker client in resource
func (*Task) IsContainerServiceConnectPause ¶
IsContainerServiceConnectPause checks whether a given container name is the name of the task service connect pause container. We construct the name of SC pause container by taking SC container name from SC config, and using the pause container naming pattern.
func (*Task) IsEBSTaskAttachEnabled ¶
IsEBSTaskAttachEnabled returns true if this task has EBS volume configuration in its ACS payload. TODO: as more daemons come online, we'll want a generic handler these bool checks and payload handling
func (*Task) IsFaultInjectionEnabled ¶
func (*Task) IsLaunchTypeFargate ¶
func (*Task) IsManagedDaemonTask ¶
IsManagedDaemonTask will check if a task is a non-stopped managed daemon task TODO: Somehow track this on a task level (i.e. obtain the managed daemon image name from task arn and then find the corresponding container with the image name)
func (*Task) IsNetworkModeAWSVPC ¶
IsNetworkModeAWSVPC checks if the task is configured to use the AWSVPC task networking feature.
func (*Task) IsNetworkModeBridge ¶
IsNetworkModeBridge checks if the task is configured to use the bridge network mode.
func (*Task) IsNetworkModeHost ¶
IsNetworkModeHost checks if the task is configured to use the host network mode.
func (*Task) IsServiceConnectBridgeModeApplicationContainer ¶
func (task *Task) IsServiceConnectBridgeModeApplicationContainer(container *apicontainer.Container) bool
func (*Task) IsServiceConnectConnectionDraining ¶
func (*Task) IsServiceConnectEnabled ¶
IsServiceConnectEnabled returns true if Service Connect is enabled for this task.
func (*Task) MarshalJSON ¶
MarshalJSON wraps Go's marshalling logic with a necessary read lock.
func (*Task) MergeEnvVarsFromEnvfiles ¶
func (task *Task) MergeEnvVarsFromEnvfiles(container *apicontainer.Container) *apierrors.ResourceInitError
MergeEnvVarsFromEnvfiles should be called when creating a container - this method reads the environment variables specified in the environment files that was downloaded to disk and merges it with existing environment variables
func (*Task) PopulateASMAuthData ¶
func (task *Task) PopulateASMAuthData(container *apicontainer.Container) error
PopulateASMAuthData sets docker auth credentials for a container
func (*Task) PopulateSecretLogOptionsToFirelensContainer ¶
func (task *Task) PopulateSecretLogOptionsToFirelensContainer(firelensContainer *apicontainer.Container) *apierrors.DockerClientConfigError
PopulateSecretLogOptionsToFirelensContainer collects secret log option values for awsfirelens log driver from task resource and specified then as envs of firelens container. Firelens container will use the envs to resolve config file variables constructed for secret log options when loading the config file.
func (*Task) PopulateSecrets ¶
func (task *Task) PopulateSecrets(hostConfig *dockercontainer.HostConfig, container *apicontainer.Container) *apierrors.DockerClientConfigError
PopulateSecrets appends secrets to container's env var map and hostconfig section
func (*Task) PopulateServiceConnectContainerMappingEnvVar ¶
PopulateServiceConnectContainerMappingEnvVar populates APPNET_CONTAINER_IP_MAPPING env var for AppNet Agent container aka SC container
func (*Task) PopulateServiceConnectNetworkConfig ¶
PopulateServiceConnectNetworkConfig is called once we've started SC pause container and retrieved its container IPs.
func (*Task) PopulateServiceConnectRuntimeConfig ¶
func (task *Task) PopulateServiceConnectRuntimeConfig(serviceConnectConfig serviceconnect.RuntimeConfig)
func (*Task) PostUnmarshalTask ¶
func (task *Task) PostUnmarshalTask(cfg *config.Config, credentialsManager credentials.Manager, resourceFields *taskresource.ResourceFields, dockerClient dockerapi.DockerClient, ctx context.Context, options ...Option) error
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) RecordExecutionStoppedAt ¶
func (task *Task) RecordExecutionStoppedAt(container *apicontainer.Container)
RecordExecutionStoppedAt checks if this is an essential container stopped and set the task executionStoppedAt timestamps
func (*Task) RemoveVolume ¶
func (*Task) RequiresDomainlessCredentialSpecResource ¶
RequiresDomainlessCredentialSpecResource returns true if at least one container in the task needs a valid domainless credentialspec resource
func (*Task) SetAppMesh ¶
SetAppMesh sets the app mesh config of the task
func (*Task) SetCredentialsID ¶
SetCredentialsID sets the credentials ID for the task
func (*Task) SetCredentialsRelativeURI ¶
SetCredentialsRelativeURI sets the credentials relative uri for the task
func (*Task) SetDefaultIfname ¶
func (*Task) SetDesiredStatus ¶
func (task *Task) SetDesiredStatus(status apitaskstatus.TaskStatus)
SetDesiredStatus sets the desired status of the task
func (*Task) SetExecutionRoleCredentialsID ¶
SetExecutionRoleCredentialsID sets the ID for the task execution role credentials
func (*Task) SetExecutionStoppedAt ¶
SetExecutionStoppedAt sets the ExecutionStoppedAt timestamp of the task
func (*Task) SetKnownStatus ¶
func (task *Task) SetKnownStatus(status apitaskstatus.TaskStatus)
SetKnownStatus sets the known status of the task
func (*Task) SetLocalIPAddress ¶
SetLocalIPAddress sets the local IP address of the task.
func (*Task) SetNetworkNamespace ¶
func (*Task) SetPausePIDInVolumeResources ¶
SetPausePIDInVolumeResources sets the pause container pid field in each volume resource.
func (*Task) SetPullStartedAt ¶
SetPullStartedAt sets the task pullstartedat timestamp and returns whether this field was updated or not
func (*Task) SetPullStoppedAt ¶
SetPullStoppedAt sets the task pullstoppedat timestamp
func (*Task) SetSentStatus ¶
func (task *Task) SetSentStatus(status apitaskstatus.TaskStatus)
SetSentStatus safely sets the SentStatus of the task
func (*Task) SetServiceConnectConnectionDraining ¶
func (*Task) SetTerminalReason ¶
SetTerminalReason sets the terminalReason string and this can only be set once per the task's lifecycle. This field does not accept updates.
func (*Task) ToHostResources ¶
ToHostResources will convert a task to a map of resources which ECS takes into account when scheduling tasks on instances * CPU
- If task level CPU is set, use that
- Else add up container CPUs
* Memory
- If task level memory is set, use that
- Else add up container level
- If memoryReservation field is set, use that
- Else use memory field
* Ports (TCP/UDP)
- Only account for hostPort
- Don't need to account for awsvpc mode, each task gets its own namespace
* GPU
- Concatenate each container's gpu ids
func (*Task) UpdateDesiredStatus ¶
func (task *Task) UpdateDesiredStatus()
UpdateDesiredStatus sets the desired status of the task, and its containers and resources.
func (*Task) UpdateMountPoints ¶
func (task *Task) UpdateMountPoints(cont *apicontainer.Container, vols []types.MountPoint)
UpdateMountPoints updates the mount points of volumes that were created without specifying a host path. This is used as part of the empty host volume feature.
func (*Task) UpdateStatus ¶
UpdateStatus updates a task's known and desired statuses to be compatible with all of its containers. It will return a bool indicating if there was a change in the task's known status.
func (*Task) UpdateTaskENIsLinkName ¶
func (task *Task) UpdateTaskENIsLinkName()
UpdateTaskENIsLinkName updates the link name of all the enis associated with the task.
type TaskENIs ¶
type TaskENIs []*ni.NetworkInterface
TaskENIs type enumerates the list of ENI objects as a type. It is used for implementing a custom unmarshaler. The unmarshaler is capable of unmarshaling both a list of ENI objects into the TaskENIs type (the new scheme) or a single ENI object into the TaskENIs type (the old scheme before this object was introduced).
The 'task' package is deemed to be a better home for this than the 'eni' package since this is only required for unmarshaling 'Task' object. None of the functionality/types in the 'eni' package themselves have any dependencies on this type.
func (*TaskENIs) UnmarshalJSON ¶
type TaskVolume ¶
type TaskVolume struct { Type string `json:"type"` Name string `json:"name"` Volume taskresourcevolume.Volume }
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)
MarshalJSON overrides the logic for JSON-encoding a TaskVolume object
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
Notes ¶
Bugs ¶
On Windows, volumes with names that differ only by case will collide