task

package
v0.0.0-...-b702281 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 51 Imported by: 67

Documentation

Index

Constants

View Source
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"

	// specifies bridge type mode for a task
	BridgeNetworkMode = "bridge"

	// specifies awsvpc type mode for a task
	AWSVPCNetworkMode = "awsvpc"

	// specifies host type mode for a task
	HostNetworkMode = "host"
)
View Source
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

type Option func(*Task) error

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`, `SetDesiredStatus`, 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 the 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(samuelkarp) SentStatusUnsafe needs a lock and setters/getters.
	// 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"`
	// contains filtered or unexported fields
}

Task is the internal representation of a task in the ECS agent

func RemoveFromTaskArray

func RemoveFromTaskArray(arr []*Task, ndx int) []*Task

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

func TaskFromACS(acsTask *ecsacs.Task, envelope *ecsacs.PayloadMessage) (*Task, error)

TaskFromACS translates ecsacs.Task to apitask.Task by first marshaling the received ecsacs.Task to json and unmarshaling 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 genereated 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

func (task *Task) AssociationsByTypeAndContainer(associationType, containerName string) []string

AssociationByTypeAndContainer 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

func (task *Task) BuildCgroupRoot() (string, error)

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

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

func (task *Task) GetAllCredentialSpecRequirements() map[string]string

getAllCredentialSpecRequirements is used to build all the credential spec requirements for the task

func (*Task) GetAppMesh

func (task *Task) GetAppMesh() *nlappmesh.AppMesh

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

func (task *Task) GetContainerIndex(containerName string) int

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

func (task *Task) GetCredentialsID() string

GetCredentialsID gets the credentials ID for the task

func (*Task) GetCredentialsRelativeURI

func (task *Task) GetCredentialsRelativeURI() string

GetCredentialsRelativeURI returns the credentials relative uri for the task

func (*Task) GetDesiredStatus

func (task *Task) GetDesiredStatus() apitaskstatus.TaskStatus

GetDesiredStatus gets the desired status of the task

func (*Task) GetExecutionCredentialsID

func (task *Task) GetExecutionCredentialsID() string

GetExecutionCredentialsID gets the credentials ID for the task

func (*Task) GetExecutionStoppedAt

func (task *Task) GetExecutionStoppedAt() time.Time

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

func (task *Task) GetID() string

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

func (task *Task) GetKnownStatusTime() time.Time

GetKnownStatusTime gets the KnownStatusTime of the task

func (*Task) GetLocalIPAddress

func (task *Task) GetLocalIPAddress() string

GetLocalIPAddress returns the local IP address of the task.

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

func (task *Task) GetPullStartedAt() time.Time

GetPullStartedAt returns the PullStartedAt timestamp

func (*Task) GetPullStoppedAt

func (task *Task) GetPullStoppedAt() time.Time

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

func (task *Task) GetTerminalReason() string

GetTerminalReason retrieves the terminalReason string

func (*Task) HasActiveContainers

func (task *Task) HasActiveContainers() bool

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

func (task *Task) IsContainerServiceConnectPause(containerName string) bool

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

func (task *Task) IsEBSTaskAttachEnabled() bool

Is EBS Task Attach enabled 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) IsLaunchTypeFargate

func (task *Task) IsLaunchTypeFargate() bool

func (*Task) IsManagedDaemonTask

func (task *Task) IsManagedDaemonTask() (string, bool)

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

func (task *Task) IsNetworkModeAWSVPC() bool

IsNetworkModeAWSVPC checks if the task is configured to use the AWSVPC task networking feature.

func (*Task) IsNetworkModeBridge

func (task *Task) IsNetworkModeBridge() bool

IsNetworkModeBridge checks if the task is configured to use the bridge network mode.

func (*Task) IsNetworkModeHost

func (task *Task) IsNetworkModeHost() bool

IsNetworkModeHost checks if the task is configured to use the host network mode.

func (*Task) IsRunning

func (task *Task) IsRunning() bool

func (*Task) IsServiceConnectBridgeModeApplicationContainer

func (task *Task) IsServiceConnectBridgeModeApplicationContainer(container *apicontainer.Container) bool

func (*Task) IsServiceConnectConnectionDraining

func (task *Task) IsServiceConnectConnectionDraining() bool

func (*Task) IsServiceConnectEnabled

func (task *Task) IsServiceConnectEnabled() bool

IsServiceConnectEnabled returns true if Service Connect is enabled for this task.

func (*Task) MarshalJSON

func (task *Task) MarshalJSON() ([]byte, error)

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

func (task *Task) PopulateServiceConnectContainerMappingEnvVar() error

PopulateServiceConnectContainerMappingEnvVar populates APPNET_CONTAINER_IP_MAPPING env var for AppNet Agent container aka SC container

func (*Task) PopulateServiceConnectNetworkConfig

func (task *Task) PopulateServiceConnectNetworkConfig(ipv4Addr string, ipv6Addr string)

PopulateServiceConnectPauseIPConfig 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 *Task) RemoveVolume(index int)

func (*Task) RequiresDomainlessCredentialSpecResource

func (task *Task) RequiresDomainlessCredentialSpecResource() bool

RequiresDomainlessCredentialSpecResource returns true if at least one container in the task needs a valid domainless credentialspec resource

func (*Task) SetAppMesh

func (task *Task) SetAppMesh(appMesh *nlappmesh.AppMesh)

SetAppMesh sets the app mesh config of the task

func (*Task) SetCredentialsID

func (task *Task) SetCredentialsID(id string)

SetCredentialsID sets the credentials ID for the task

func (*Task) SetCredentialsRelativeURI

func (task *Task) SetCredentialsRelativeURI(uri string)

SetCredentialsRelativeURI sets the credentials relative uri for the task

func (*Task) SetDesiredStatus

func (task *Task) SetDesiredStatus(status apitaskstatus.TaskStatus)

SetDesiredStatus sets the desired status of the task

func (*Task) SetExecutionRoleCredentialsID

func (task *Task) SetExecutionRoleCredentialsID(id string)

SetExecutionRoleCredentialsID sets the ID for the task execution role credentials

func (*Task) SetExecutionStoppedAt

func (task *Task) SetExecutionStoppedAt(timestamp time.Time) bool

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

func (task *Task) SetLocalIPAddress(addr string)

SetLocalIPAddress sets the local IP address of the task.

func (*Task) SetPausePIDInVolumeResources

func (task *Task) SetPausePIDInVolumeResources(pid string)

SetPausePIDInVolumeResources sets the pause container pid field in each volume resource.

func (*Task) SetPullStartedAt

func (task *Task) SetPullStartedAt(timestamp time.Time) bool

SetPullStartedAt sets the task pullstartedat timestamp and returns whether this field was updated or not

func (*Task) SetPullStoppedAt

func (task *Task) SetPullStoppedAt(timestamp time.Time)

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 *Task) SetServiceConnectConnectionDraining(draining bool)

func (*Task) SetTerminalReason

func (task *Task) SetTerminalReason(reason string)

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) String

func (task *Task) String() string

String returns a human readable string representation of this object

func (*Task) ToHostResources

func (task *Task) ToHostResources() map[string]*ecs.Resource

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 known status of the task

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

func (task *Task) UpdateStatus() bool

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

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

func (taskENIs *TaskENIs) UnmarshalJSON(b []byte) error

type TaskOverrides

type TaskOverrides struct{}

TaskOverrides are the overrides applied to a task

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL