Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Task Metadata Endpoint v3 #17

Merged
merged 28 commits into from
Apr 17, 2019
Merged

Conversation

hayajo
Copy link
Contributor

@hayajo hayajo commented Apr 9, 2019

Supported Task Metadata Endpoint v3.

@astj
Copy link
Contributor

astj commented Apr 10, 2019

Automatically resolves the startup type ('ec2' or 'fargate')

Does Fargate supports task metadata endpoint v3? According to AWS doc Fargate seems to support only v2 currently, but I haven't check actual behavior yet.

}

func isRunning(status string) bool {
return strings.EqualFold("running", status)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which value does this "status" take actually?
If it's guaranteed to be exact a constant value like "running", "Running", "RUNNING", etc…, we can simply use status == "SOMEVAL" instead of strings.EqualFold("SOMEVAL", status).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -29,6 +30,11 @@ func NewPlatform(ctx context.Context, ignoreContainer *regexp.Regexp) (platform.
case platform.ECSAwsvpc:
return ecsawsvpc.NewECSAwsvpcPlatform(false, ignoreContainer)

case platform.ECSv3:
metadataURI := os.Getenv("ECS_CONTAINER_METADATA_URI")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if users mistakingly specify ECSv3 at unsupported environments like old container instances (or Fargate)?
Maybe it doesn't cause disaster 💥 with current implementation, but users will be happy if they can get feedback to know the container-agent is in unsupported environments.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the current implementation, the connection error to the endpoint is output in the log and the agent terminates.
Fix to give the user appropriate feedback.

@@ -0,0 +1,11 @@
package provider
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently provider is used only inside platform/ecsv3, therefore it seems we don't have to place top-level of container-agent.
Is there any future plan to use this provider elsewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was also planned to be used on the Kubernetes platform, but it seems that just the platform package is enough.
Move to the ecsv3 package.

platform/ecsv3/ecs.go Outdated Show resolved Hide resolved
Co-Authored-By: hayajo <hayato.imai@gmail.com>
@hayajo
Copy link
Contributor Author

hayajo commented Apr 17, 2019

Thank you for the review.

@hayajo hayajo merged commit 48f7dcf into master Apr 17, 2019
@hayajo hayajo deleted the support-task-metadata-endpoint-v3 branch April 17, 2019 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants