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

Added support for os-family attribute to be advertised by the agent for fine grained task placement #3044

Merged
merged 1 commit into from
Sep 29, 2021

Conversation

rawahars
Copy link
Contributor

Summary

A new attribute is being introduced in the ECS Control plane called ecs.os-family which defines the os family to which the instance belongs. For Linux based instances, the OS family would be advertised as linux and for Windows based instances, the attribute would have a value of format - WINDOWS_SERVER_<Windows Version>_<Installation Type>

This would allow the customers to achieve fine grained task placement especially in a mixed cluster.

Example- If a cluster runs instances running on different Windows versions, and a task definition specifies the OS family as WINDOWS_SERVER_2019_FULL then this task would only be placed on the instances which broadcasted their os-family as WINDOWS_SERVER_2019_FULL.

Implementation details

A new attribute has been introduced ecs.os-family. The values for Linux based instances is linux.
For Windows instances, the value can be-
WINDOWS_SERVER_2019_FULL, WINDOWS_SERVER_2019_CORE, WINDOWS_SERVER_2016_FULL, WINDOWS_SERVER_2022_FULL, WINDOWS_SERVER_2022_CORE, WINDOWS_SERVER_2004_CORE, WINDOWS_SERVER_20H2_CORE

Testing

Unit tests have been added and existing tests were updated.
Additionally, custom AMIs with custom agent built from this branch was tested to ensure that the instance can register itself to the cluster.

New tests cover the changes:
Yes

Description for the changelog

Added support for OS Family to the agent.

Licensing

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

Copy link
Contributor

@fenxiong fenxiong left a comment

Choose a reason for hiding this comment

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

looks good few nits

@rawahars rawahars force-pushed the feature/osFamily branch 3 times, most recently from db8e572 to 59b7019 Compare September 28, 2021 20:47
…ol plane

In order to allow fine grain task placement, a new attribute "os-family" is being added which will allow the customers to place their task on specific instances running in a mixed mode cluster.

For Windows, the value of this attribute would be similar to WINDOWS_SERVER_2019_FULL. The same can be specified by the customer in their task definition. Now, if a cluster runs instances running on different Windows versions, this task would only be placed on the instances which broadcasted their os-family as WINDOWS_SERVER_2019_FULL.
Copy link
Member

@fierlion fierlion left a comment

Choose a reason for hiding this comment

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

good overall test coverage!

@singholt
Copy link
Contributor

singholt commented Sep 29, 2021

Just curious - What happens if a customer tries to use both os-type and os-family attributes at once, and they conflict? Example - os-type = "linux" and os-family = "windows-2019...". Do we want to add checks for such a scenario, even if it may be accidental?

not sure if agent is the right place for such validation. thinking out loud

@rawahars
Copy link
Contributor Author

@singholt With respect to the conflicting task placement constraints such as-

"placementConstraints": [
    {
      "type": "memberOf",
      "expression": "attribute:ecs.os-type == linux"
    },
   {
      "type": "memberOf",
      "expression": "attribute:ecs.os-family == WINDOWS_SERVER_2019_FULL"
    }
  ]

The run task call itself will fail with an error message such as Reasons : ["MemberOf placement constraint unsatisfied.","AGENT"]. Learn more

This is the existing behavior with any task placement constraint using the custom attribute tags. If there isn't any instance which matches both the constraints, the task would fail.

@singholt
Copy link
Contributor

@singholt With respect to the conflicting task placement constraints such as-

"placementConstraints": [
    {
      "type": "memberOf",
      "expression": "attribute:ecs.os-type == linux"
    },
   {
      "type": "memberOf",
      "expression": "attribute:ecs.os-family == WINDOWS_SERVER_2019_FULL"
    }
  ]

The run task call itself will fail with an error message such as Reasons : ["MemberOf placement constraint unsatisfied.","AGENT"]. Learn more

This is the existing behavior with any task placement constraint using the custom attribute tags. If there isn't any instance which matches both the constraints, the task would fail.

I agree. I'm thinking around whether we want to fail early, at register-task call?

@rawahars
Copy link
Contributor Author

rawahars commented Sep 29, 2021

ECS doesn't fail the register-task call even if we specify any random value for the task placement constraint attribute. For example, we can register a task definition with say the below placement constraint. The task would be failed during run-task.

"placementConstraints": [
    {
      "type": "memberOf",
      "expression": "attribute:ecs.os-type == invalidOS"
    }
  ]

The same is applicable for any conflicting attributes.

@singholt
Copy link
Contributor

ECS doesn't fail the register-task call even if we specify any random value for the task placement constraint attribute. For example, we can register a task definition with say the below placement constraint. The task would be failed during run-task.

"placementConstraints": [
    {
      "type": "memberOf",
      "expression": "attribute:ecs.os-type == invalidOS"
    }
  ]

The same is applicable for any conflicting attributes.

thanks, makes sense

@fierlion fierlion merged commit 17a7b03 into aws:dev Sep 29, 2021
@fierlion fierlion added this to the 1.55.4 milestone Sep 29, 2021
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.

7 participants