-
Notifications
You must be signed in to change notification settings - Fork 612
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
Adding support for ebs volumes within task handler #3917
Conversation
5e3f264
to
2cda585
Compare
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.
b285695
to
8481805
Compare
bd970b3
to
5d94a03
Compare
"github.com/aws/amazon-ecs-agent/ecs-agent/acs/model/ecsacs" | ||
acssession "github.com/aws/amazon-ecs-agent/ecs-agent/acs/session" | ||
"github.com/aws/amazon-ecs-agent/ecs-agent/acs/session/testconst" | ||
"github.com/aws/amazon-ecs-agent/ecs-agent/api/eni" | ||
apira "github.com/aws/amazon-ecs-agent/ecs-agent/api/resource" |
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.
nit: Should we name it apiresource instead of apira ?
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.
good call out, that makes it more clearer. thanks Utsa!
5d94a03
to
ff5187d
Compare
if property == nil { | ||
return nil, fmt.Errorf("failed to parse task ebs attachment, encountered nil property") | ||
} | ||
if aws.StringValue(property.Value) == "" { |
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.
Discussed offline. By design, an initial validation for non-empty property value is done here. The required properties will be validate again in func validateEBSTaskVolumeAttachment
.
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.
thanks!
Summary
The goal of this PR is to add functionality to handle and process task payload with EBS volume attachments. Once the payload has been processed, agent will spin up the task docker container and mount the EBS volume within the host instance.
Implementation details
task.go
task_attachment_handler.go
handleTaskAttachments
: The functionality will now be parsing the list of attachment that's within the task payload (in the form of the shared Task struct). If there are any attachments of typeAmazonElasticBlockStorage
then we'll parse + validate it into an object of typeEBSTaskVolumeConfig
via theParseEBSTaskVolumeAttachment
function. At the end, we'll append each newEBSTaskVolumeConfig
object to the list of volumes for the managed task.taskvolume.go
unmarshalEBSVolume
: This function will unmarshal raw data (in JSON form) and convert into an object of typeEBSTaskVolumeConfig
. This is used for saving to state.dockervolume.go
:Source
: Returns the complete source host path that's used to bind mount with the task docker containerdockervolume_ebs.go
totaskresource/volume
ParseEBSTaskVolumeAttachment
: Parses and validates an EBS volume attachment from the task payload sent from ACS. Returns a new object of typedEBSTaskVolumeConfig
validateEBSTaskVolumeAttachment
: Validates that the parsedEBSTaskVolumeConfig
has VolumeId, VolumeName, and SourceVolumeHostPath set and non-empty which is required for task start and stop.EBSTaskVolumeConfig
which is used to store all of the attachment information of the EBS volume for a managed taskTesting
Unit tests
New tests cover the changes: Yes
Description for the changelog
Add support to handle task payload with EBS volume attachments.
Licensing
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.