Skip to content

Regenerate ACS model for GPU sharingStrategy and validate it - #5071

Merged
harishxr merged 1 commit into
aws:devfrom
harishxr:mps-acs-sharing-strategy
Jul 30, 2026
Merged

harishxr merged 1 commit into
aws:devfrom
harishxr:mps-acs-sharing-strategy

Conversation

@harishxr

Copy link
Copy Markdown
Contributor

Summary

Regenerates the agent's ACS model to carry the new GPU sharingStrategy on container resourceRequirements, and adds a validator that enforces the strategy is well-formed before a task is acted on. This change lets the agent receive MPS GPU-sharing config.

Implementation details

  • ecs-agent/acs/model/api/api-2.json - adds resourceRequirements to Container plus four shapes mirroring the upstream model: ResourceRequirementList, ResourceRequirement (value, type, sharingStrategy), SharingStrategy, and NvidiaMpsAllocation (memory required, maxComputePercent optional).
  • ecs-agent/acs/model/ecsacs/api.go - regenerated from the model via go generate; re-vendored into agent/.
  • agent/api/task/task.go - validateResourceRequirements(acsTask), called from TaskFromACS alongside the existing attachment validation. Upstream, sharingStrategy is a union (exactly one member), but the agent's ACS model is generated by the aws-sdk-go v1 generator, which has no union type and emits a plain struct with optional members. An empty strategy, an unknown future strategy (its member dropped on unmarshal), or a missing required field would otherwise deserialize silently and be misread as a whole-GPU request. The validator re-imposes the union guarantee at the point wire data enters the agent. Exactly one known strategy with its required fields, or the task payload is rejected. It reads the wire acsTask directly and mirrors the existing addGPUResource validation style.

Testing

New tests cover the changes: yes

Description for the changelog

Enhancement - Regenerate ACS model for GPU sharingStrategy and validate it

Additional Information

Does this PR include breaking model changes? If so, Have you added transformation functions?

No

Does this PR include the addition of new environment variables in the README? No

Licensing

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

@harishxr
harishxr requested a review from a team as a code owner July 29, 2026 22:43
@harishxr
harishxr enabled auto-merge (rebase) July 29, 2026 22:44
@harishxr
harishxr merged commit 8a1745b into aws:dev Jul 30, 2026
45 checks passed
@harishxr
harishxr deleted the mps-acs-sharing-strategy branch August 4, 2026 00:50
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.

4 participants