Skip to content

Adding Platforms field to TaskSpec Placement#33144

Merged
cpuguy83 merged 1 commit intomoby:masterfrom
nishanttotla:update-swarmkit-platform-structs
May 16, 2017
Merged

Adding Platforms field to TaskSpec Placement#33144
cpuguy83 merged 1 commit intomoby:masterfrom
nishanttotla:update-swarmkit-platform-structs

Conversation

@nishanttotla
Copy link
Contributor

@nishanttotla nishanttotla commented May 10, 2017

The Platforms field contains an array of all platforms supported by the Task. This PR is part of adding multi-arch support for Swarm Mode (#31348).

The platform filter was introduced in SwarmKit in moby/swarmkit#1981 and vendored into moby/moby with #33059.

// Placement represents orchestration parameters.
type Placement struct {
	Constraints []string              `json:",omitempty"`
	Preferences []PlacementPreference `json:",omitempty"`

	// Platforms stores all the platforms that the image can run on.
	// This field is used in the platform filter for scheduling. If empty,
	// then the platform filter is off, meaning there are no scheduling restrictions.
	Platforms []Platform `json:",omitempty"`
}

The follow-up for this PR will actually add the platform information to the Spec when a service is created. That part depends on #32388.

@nishanttotla nishanttotla force-pushed the update-swarmkit-platform-structs branch from a44caad to 1b8e97d Compare May 10, 2017 18:52
@nishanttotla nishanttotla changed the title Adding Platforms field to TaskSpec Adding Platforms field to TaskSpec Placement May 10, 2017
api/swagger.yaml Outdated
Copy link
Contributor

Choose a reason for hiding this comment

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

Thinking of the ARM folks here -- do you want to include a variant as well?

Copy link
Contributor Author

@nishanttotla nishanttotla May 11, 2017

Choose a reason for hiding this comment

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

@clnperez I'm not familiar with what a variant is, could you clarify? Also, Swarm currently only has Architecture and OS fields, which is why this structure has only those (see moby/swarmkit#1981).

We could certainly add more in the future to make the comparison finer.

Copy link
Contributor

Choose a reason for hiding this comment

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

@nishanttotla Hopefully I'll get this all straight, but as far as I'm understanding, ARM has a specific need for architecture variants -- but they haven't completely ironed out what they'll call them. I've seen things like arm64_ilp32_variant8 and arm32_variant6, as examples. The real point is that the arch isn't always the whole story when choosing the image to pull. Right now the engine only looks at $GOARCH + $GOOS to decide which image to pull in the case of multi-arch, but I believe that in the future it will need to also consider the variant.

@stevvooe can correct anything I've gotten wrong here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@clnperez thanks for the info. It sounds like we should consider this once the details are well-defined. Right now, the basic platform comparison should suffice IMO.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, this should brought into line with the OCI fields.

Copy link
Contributor Author

@nishanttotla nishanttotla May 12, 2017

Choose a reason for hiding this comment

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

The OCI platform struct seems identical to manifestlist.PlatformSpec, which is what this is meant to consume.

We should do this for 17.07, given that the filter isn't going to change right now.

Copy link
Contributor

Choose a reason for hiding this comment

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

The OCI platform struct seems identical to manifestlist.PlatformSpec, which is what this is meant to consume.

It is slightly different. You should err on using the OCI version, where possible.

The only thing to keep in line here is that Architecture should always use a GOARCH value.

Copy link
Member

Choose a reason for hiding this comment

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

@stevvooe @nishanttotla we can make those changes in 17.07 without causing backward compatibility issues?

Copy link
Member

Choose a reason for hiding this comment

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

@nishanttotla just told me it would only be adding fields, so no issue there ^^

@cpuguy83
Copy link
Member

Why wouldn't this be read from the image manifest?

@nishanttotla
Copy link
Contributor Author

@cpuguy83 this will be retrieved from the image manifest when the client creates the service spec. It will then be used by the Swarm scheduler.

@aaronlehmann
Copy link

This is just bringing the engine's REST API in sync with a field that already exists in swarmkit's gRPC API.

LGTM

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

@nishanttotla nishanttotla force-pushed the update-swarmkit-platform-structs branch 3 times, most recently from 8376a47 to 64d5fc1 Compare May 15, 2017 21:53
Signed-off-by: Nishant Totla <nishanttotla@gmail.com>
@nishanttotla nishanttotla force-pushed the update-swarmkit-platform-structs branch from 64d5fc1 to 1efbe6e Compare May 15, 2017 21:58
@nishanttotla
Copy link
Contributor Author

Ping @thaJeztah addressed your concerns.

cc @aaronlehmann updated the relevant functions in daemon/convert.

@thaJeztah
Copy link
Member

Looks like theres an issue with the swagger.yml. If I render the docs, and go to the "service create" endpoint http://localhost:9000/#operation/ServiceCreate, I can no longer expand the TaskTemplate node

@nishanttotla
Copy link
Contributor Author

nishanttotla commented May 16, 2017

I confirmed that the swagger issues are unrelated, and are present in master. Filed #33231

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

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

LGTM

@nishanttotla if you have time, could you (as follow-up) also update the example-request for service create?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants