Skip to content

Commit

Permalink
Adding PartOf Docker Service in ECS Service file (aws#4277)
Browse files Browse the repository at this point in the history
  • Loading branch information
hozkaya2000 authored and singholt committed Aug 13, 2024
1 parent 1333a7d commit bd23a3c
Show file tree
Hide file tree
Showing 26 changed files with 208 additions and 203 deletions.
5 changes: 3 additions & 2 deletions agent/acs/session/payload_responder.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
loggerfield "github.com/aws/amazon-ecs-agent/ecs-agent/logger/field"
nlappmesh "github.com/aws/amazon-ecs-agent/ecs-agent/netlib/model/appmesh"
ni "github.com/aws/amazon-ecs-agent/ecs-agent/netlib/model/networkinterface"

"github.com/aws/aws-sdk-go/aws"
"github.com/pkg/errors"
)
Expand Down Expand Up @@ -109,8 +110,8 @@ func (pmHandler *payloadMessageHandler) addPayloadTasks(payload *ecsacs.PayloadM
continue
}

// Note: If we receive an EBS-backed task, we'll also received an incomplete volume configuration in the list of Volumes
// To accomodate this, we'll first check if the task IS EBS-backed then we'll mark the corresponding Volume object to be
// Note: If we receive an EBS-backed task, we'll also receive an incomplete volume configuration in the list of Volumes
// To accommodate this, we'll first check if the task IS EBS-backed then we'll mark the corresponding Volume object to be
// of type "attachment". This volume object will be replaced by the newly created EBS volume configuration when we parse
// through the task attachments.
volName, ok := hasEBSAttachment(task)
Expand Down
1 change: 1 addition & 0 deletions agent/acs/session/payload_responder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import (
"github.com/aws/amazon-ecs-agent/ecs-agent/credentials"
ni "github.com/aws/amazon-ecs-agent/ecs-agent/netlib/model/networkinterface"
"github.com/aws/amazon-ecs-agent/ecs-agent/wsclient"

"github.com/aws/aws-sdk-go/aws"
"github.com/golang/mock/gomock"
"github.com/pkg/errors"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
apitaskstatus "github.com/aws/amazon-ecs-agent/ecs-agent/api/task/status"
"github.com/aws/amazon-ecs-agent/ecs-agent/metrics"
"github.com/aws/amazon-ecs-agent/ecs-agent/wsclient"

"github.com/aws/aws-sdk-go/aws"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/assert"
Expand Down
22 changes: 11 additions & 11 deletions agent/api/container/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const (
// v4 metadata endpoint
MetadataURIEnvVarNameV4 = "ECS_CONTAINER_METADATA_URI_V4"

// MetadataURIFormat defines the URI format for v4 metadata endpoint
// MetadataURIFormatV4 defines the URI format for v4 metadata endpoint
MetadataURIFormatV4 = "http://169.254.170.2/v4/%s"

// AgentURIEnvVarName defines the name of the environment variable
Expand All @@ -85,7 +85,7 @@ const (
// SecretTypeEnv is to show secret type being ENVIRONMENT_VARIABLE
SecretTypeEnv = "ENVIRONMENT_VARIABLE"

// TargetLogDriver is to show secret target being "LOG_DRIVER", the default will be "CONTAINER"
// SecretTargetLogDriver is to show secret target being "LOG_DRIVER", the default will be "CONTAINER"
SecretTargetLogDriver = "LOG_DRIVER"

// neuronVisibleDevicesEnvVar is the env which indicates that the container wants to use inferentia devices.
Expand Down Expand Up @@ -237,15 +237,15 @@ type Container struct {
// NOTE: Do not access DesiredStatusUnsafe directly. Instead, use `GetDesiredStatus`
// and `SetDesiredStatus`.
// TODO DesiredStatusUnsafe should probably be private with appropriately written
// setter/getter. When this is done, we need to ensure that the UnmarshalJSON
// 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 apicontainerstatus.ContainerStatus `json:"desiredStatus"`

// KnownStatusUnsafe represents the state where the container is.
// NOTE: Do not access `KnownStatusUnsafe` directly. Instead, use `GetKnownStatus`
// and `SetKnownStatus`.
// TODO KnownStatusUnsafe should probably be private with appropriately written
// setter/getter. When this is done, we need to ensure that the UnmarshalJSON
// 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 apicontainerstatus.ContainerStatus `json:"KnownStatus"`

Expand Down Expand Up @@ -291,7 +291,7 @@ type Container struct {
MetadataFileUpdated bool `json:"metadataFileUpdated"`

// KnownExitCodeUnsafe specifies the exit code for the container.
// It is exposed outside of the package so that it's marshalled/unmarshalled in
// It is exposed outside the package so that it's marshalled/unmarshalled in
// the JSON body while saving the state.
// NOTE: Do not access KnownExitCodeUnsafe directly. Instead, use `GetKnownExitCode`
// and `SetKnownExitCode`.
Expand All @@ -312,8 +312,8 @@ type Container struct {
// SteadyStateStatusUnsafe specifies the steady state status for the container
// If uninitialized, it's assumed to be set to 'ContainerRunning'. Even though
// it's not only supposed to be set when the container is being created, it's
// exposed outside of the package so that it's marshalled/unmarshalled in the
// the JSON body while saving the state
// exposed outside the package so that it's marshalled/unmarshalled in the
// JSON body while saving the state
SteadyStateStatusUnsafe *apicontainerstatus.ContainerStatus `json:"SteadyStateStatus,omitempty"`

// ContainerArn is the Arn of this container.
Expand Down Expand Up @@ -420,7 +420,7 @@ func (s *Secret) GetSecretResourceCacheKey() string {
return s.ValueFrom + "_" + s.Region
}

// String returns a human readable string representation of DockerContainer
// String returns a human-readable string representation of DockerContainer
func (dc *DockerContainer) String() string {
if dc == nil {
return "nil"
Expand Down Expand Up @@ -533,7 +533,7 @@ func (c *Container) ShouldPullWithExecutionRole() bool {
c.RegistryAuthentication.ECRAuthData.UseExecutionRole
}

// String returns a human readable string representation of this object
// String returns a human-readable string representation of this object
func (c *Container) String() string {
ret := fmt.Sprintf("%s(%s) (%s->%s)", c.Name, c.Image,
c.GetKnownStatus().String(), c.GetDesiredStatus().String())
Expand Down Expand Up @@ -561,7 +561,7 @@ func (c *Container) Fields() logger.Fields {
// Container.steadyState is not initialized, the default steady state status
// defined by `defaultContainerSteadyStateStatus` is returned. In awsvpc, the 'pause'
// container's steady state differs from that of other containers, as the
// 'pause' container can reach its teady state once networking resources
// 'pause' container can reach its steady state once networking resources
// have been provisioned for it, which is done in the `ContainerResourcesProvisioned`
// state. In bridge mode, pause containers are currently used exclusively for
// supporting service-connect tasks. Those pause containers will have steady state
Expand Down Expand Up @@ -1114,7 +1114,7 @@ func (c *Container) MergeEnvironmentVariablesFromEnvfiles(envVarsList []map[stri
c.lock.Lock()
defer c.lock.Unlock()

// create map if does not exist
// create map if it does not exist
if c.Environment == nil {
c.Environment = make(map[string]string)
}
Expand Down
Loading

0 comments on commit bd23a3c

Please sign in to comment.