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

api: add Hostname, ExtraHosts for pause container #1278

Merged
merged 1 commit into from
Mar 20, 2018

Conversation

adnxn
Copy link
Contributor

@adnxn adnxn commented Mar 6, 2018

Summary

This change adds Hostname and ExtraHosts to the pause container's docker
config and host config respectively. This allows awsvpc tasks to have
/etc/hosts entries for the ENI private IPs

Implementation details

Testing

  • Builds on Linux (make release)
  • Builds on Windows (go build -out amazon-ecs-agent.exe ./agent)
  • Unit tests on Linux (make test) pass
  • Unit tests on Windows (go test -timeout=25s ./agent/...) pass
  • Integration tests on Linux (make run-integ-tests) pass
  • Integration tests on Windows (.\scripts\run-integ-tests.ps1) pass
  • Functional tests on Linux (make run-functional-tests) pass
  • Functional tests on Windows (.\scripts\run-functional-tests.ps1) pass

New tests cover the changes:

Description for the changelog

Licensing

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@adnxn adnxn force-pushed the hostname-private-ip branch 2 times, most recently from 90d2e00 to 88f892a Compare March 8, 2018 17:12
@adnxn adnxn added this to the 1.18.0 milestone Mar 8, 2018
@adnxn adnxn force-pushed the hostname-private-ip branch 2 times, most recently from 4a152ed to 51a456a Compare March 17, 2018 18:03
@adnxn adnxn changed the title [wip] api: add Hostname, ExtraHosts for pause container api: add Hostname, ExtraHosts for pause container Mar 19, 2018
Copy link

@richardpen richardpen left a comment

Choose a reason for hiding this comment

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

Code LGTM, can you add a functional test for this.

Copy link
Contributor

@aaithal aaithal left a comment

Choose a reason for hiding this comment

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

apart from the functional test modification, you're also missing a bump to the state file version.

agent/api/eni.go Outdated
@@ -38,6 +38,9 @@ type ENI struct {
// DomainNameSearchList specifies the search list for the domain
// name lookup, for the eni
DomainNameSearchList []string `json:",omitempty"`

// PrivateDnsName is the dns name assigned by the vpc to this eni
PrivateDnsName string `json:",omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: PrivateDNSName

agent/api/eni.go Outdated
"eni id:%s, mac: %s, ipv4addresses: [%s], ipv6addresses: [%s], dns: [%s], dns search: [%s]",
eni.ID, eni.MacAddress, strings.Join(ipv4Addresses, ","), strings.Join(ipv6Addresses, ","),
"eni id:%s, mac: %s, hostname: %s, ipv4addresses: [%s], ipv6addresses: [%s], dns: [%s], dns search: [%s]",
eni.ID, eni.MacAddress, eni.PrivateDnsName, strings.Join(ipv4Addresses, ","), strings.Join(ipv6Addresses, ","),
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't you use GetHostName() here?

@adnxn
Copy link
Contributor Author

adnxn commented Mar 19, 2018

@aaithal @richardpen, sgtm, will add(update?) functional test for this. tracking here #1307

@adnxn adnxn force-pushed the hostname-private-ip branch 4 times, most recently from 86afcd0 to 9f2032c Compare March 19, 2018 22:31
agent/api/eni.go Outdated
@@ -38,6 +38,9 @@ type ENI struct {
// DomainNameSearchList specifies the search list for the domain
// name lookup, for the eni
DomainNameSearchList []string `json:",omitempty"`

// PrivateDnsName is the dns name assigned by the vpc to this eni
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: PrivateDNSName

@aaithal aaithal modified the milestones: 1.18.0, 1.17.3 Mar 19, 2018
This change adds Hostname and ExtraHosts to the pause container's docker
config and host config respectively. This allows awsvpc tasks to have
/etc/hosts entries for the ENI private ips
@adnxn adnxn merged commit ee83b9b into aws:dev Mar 20, 2018
adnxn added a commit to adnxn/amazon-ecs-agent that referenced this pull request Mar 22, 2018
@adnxn adnxn mentioned this pull request Mar 22, 2018
8 tasks
adnxn added a commit to adnxn/amazon-ecs-agent that referenced this pull request Mar 23, 2018
adnxn added a commit to adnxn/amazon-ecs-agent that referenced this pull request Mar 23, 2018
adnxn added a commit that referenced this pull request Mar 23, 2018
@adnxn adnxn deleted the hostname-private-ip branch October 19, 2018 17:35
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