-
Notifications
You must be signed in to change notification settings - Fork 619
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
Refactor common ENI attachment functionality #3685
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chienhanlin
reviewed
May 10, 2023
sparrc
reviewed
May 10, 2023
5b893fa
to
2311df5
Compare
sparrc
previously approved these changes
May 10, 2023
2311df5
to
eb5e733
Compare
sparrc
previously approved these changes
May 11, 2023
YashdalfTheGray
previously approved these changes
May 11, 2023
eb5e733
to
e741926
Compare
YashdalfTheGray
approved these changes
May 12, 2023
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.
Approving after rebase
sparrc
approved these changes
May 12, 2023
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Refactor functionality common to handling/responding to attach instance ENI and attach task ENI messages from ACS and other associated code.
Prerequisite: Move arn and ttime utils from
agent/utils
to the ecs-agent module. These utils will be used by functionality being moved to ecs-agent module as part of this pull request.Implementation details
This pull request has been split into two commits for easier readability of separation between the prerequisite changes and main changes.
--- COMMIT 1 (click here to view associated changes) ---
agent/utils/arn.go
->ecs-agent/utils/arn/arn.go
agent/utils/ttime/generate_mocks.go
->ecs-agent/utils/ttime/generate_mocks.go
agent/utils/ttime/mocks/time_mocks.go
->ecs-agent/utils/ttime/mocks/time_mocks.go
agent/utils/ttime/ttime.go
->ecs-agent/utils/ttime/ttime.go
--- COMMIT 2 (click here to view associated changes) ---
agent/api/eni
and move toecs-agent/
agent/api/eni/eni.go
->ecs-agent/api/eni/eni.go
github.com/aws/amazon-ecs-agent/ecs-agent/logger
instead ofgithub.ghproxy.top/cihub/seelog
for loggingagent/api/eni/eni_test.go
->ecs-agent/api/eni/eni_test.go
agent/api/eni/enistatus.go
->ecs-agent/api/status/attachment_status.go
agent/api/eni/enistatus_test.go
->ecs-agent/api/status/attachment_status_test.go
agent/api/eni/eniattachment.go
->ecs-agent/api/eni/eniattachment.go
AttachmentInfo
struct inecs-agent/api/attachmentinfo/attachment_info.go
file, which contains general fields that can be common to other resource attachments (i.e., not specific to ENI attachments)AttachmentInfo
andENIAttachment
structs fromENIAttachment
struct, and then haveENIAttachment
struct embed theAttachmentInfo
structagent/api/eni/eniattachment_test.go
->ecs-agent/api/eni/eniattachment_test.go
AttachmentInfo
structagent/api/eni
to account for previous implementation detail's changesENIHandler
interface inecs-agent/acs/session/attach_eni_common.go
to abstract Agent state when handling ENI attachmentsagent/acs/handler
agent/acs/handler/attach_eni_handler_common.go
ackTimeoutHandler
struct toeniHandler
struct and refactorhandleENIAttachment()
andaddENIAttachmentToState()
functions intoeniHandler
struct methods, such thateniHandler
struct implementsENIHandler
interfaceENIHandler
interface and/oreniHandler
structagent/acs/handler/acs_handler.go
agent/acs/handler/attach_eni_handler_common_test.go
agent/acs/handler/attach_instance_eni_handler.go
agent/acs/handler/attach_instance_eni_handler_test.go
agent/acs/handler/attach_task_eni_handler.go
agent/acs/handler/attach_task_eni_handler_test.go
Testing
Unit, integration, and functional tests.
Description for the changelog
Refactor common ENI attachment functionality
Licensing
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.