-
Notifications
You must be signed in to change notification settings - Fork 207
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
Add scrapping ECS_CONTAINER_METADATA_URI_V4 for ECS #453
Changes from 14 commits
41bcb1a
771ab69
4a3d227
dc97cff
13ca933
bb5ec63
39d79d1
8302a6e
a080fcd
16d8af8
8713b5b
d750aed
5644636
d77b840
50c4774
e28fef6
a483a6f
90ab672
e013ce1
a5737cc
84f36d8
5d6f694
866f1b5
38845aa
1bbd660
c3bfe4e
b328b91
30098af
9d414c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,18 +25,12 @@ const ( | |
|
||
var DetectRegion func(mode string, credsConfig map[string]string) string = detectRegion | ||
var DetectCredentialsPath func() string = detectCredentialsPath | ||
var runInAws = os.Getenv(config.RUN_IN_AWS) | ||
|
||
func DetectAgentMode(configuredMode string) string { | ||
if configuredMode != "auto" { | ||
return configuredMode | ||
} | ||
|
||
if runInAws == config.RUN_IN_AWS_TRUE { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you explain why you are removing this? From what I recall, this was a pretty impactful bug for running ECS where the agent couldn't determine that it's running on an EC2 but should have. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes I believe the issue was the agent was not able to scrap There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I would keep this until a integration tests is built for this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On second though, should not delete this since EKS Fargate does not know how to detect |
||
fmt.Println("I! Detected from ENV instance is EC2") | ||
return config.ModeEC2 | ||
} | ||
|
||
|
||
if defaultEC2Region() != "" { | ||
fmt.Println("I! Detected the instance is EC2") | ||
return config.ModeEC2 | ||
|
@@ -93,15 +87,13 @@ func detectRegion(mode string, credsConfig map[string]string) (region string) { | |
|
||
// For ec2, fallback to metadata when no region info found in credential profile. | ||
if region == "" && mode == config.ModeEC2 { | ||
region = defaultEC2Region() | ||
} | ||
|
||
// try to get region from ecs metadata | ||
if region == "" && mode == config.ModeEC2 { | ||
fmt.Println("I! detect region from ecs") | ||
region = defaultECSRegion() | ||
fmt.Println("I! Detect region from EC2/ECS") | ||
if region = defaultEC2Region(); region == "" { | ||
// Try to get region from ecs metadata | ||
region = defaultECSRegion() | ||
} | ||
} | ||
SaxyPandaBear marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
return | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need to support v2 and v3? If endpoint is there but get metadata fails should we fall back?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IDC either way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we still need to support v2 and v3 so long as people can create ECS clusters that still rely on them. I think we'd have to investigate further where the drop off points are for v2 and v3 before we could take out support for them.