Skip to content
This repository has been archived by the owner on Feb 1, 2021. It is now read-only.

store constraints and affinities as labels #673

Merged
merged 2 commits into from
Apr 30, 2015
Merged

store constraints and affinities as labels #673

merged 2 commits into from
Apr 30, 2015

Conversation

vieux
Copy link
Contributor

@vieux vieux commented Apr 25, 2015

With this PR, you still use -e to pass constraints or affinities, but swarm store those inside a labels com.docker.swarm.affinities and com.docker.swarm.constraints on the container.

The code is much simpler and we don't leak those constraints/affinities inside the container's env anymore.

@vieux vieux added this to the 0.3.0 milestone Apr 25, 2015
@vieux vieux self-assigned this Apr 25, 2015
@abronan abronan changed the title store constaints and affinities as labels store constraints and affinities as labels Apr 25, 2015
@vieux
Copy link
Contributor Author

vieux commented Apr 28, 2015

@abronan @aluzzardi please take a look.

@thaJeztah
Copy link
Member

I suggested the same in docker-compose; perhaps also add a label for the version of swarm that's used to set the labels; this allows for migrating existing labels/containers in case the format changes in future.

(Reading on my phone, so it's possible its in there already, but I overlooked)

@abronan
Copy link
Contributor

abronan commented Apr 28, 2015

LGTM

@thaJeztah Yes that would be a good idea, overall I like the idea of interfering with ContainerConfig creation to inject labels needed by Swarm. This way we can inject a label for the Swarm version, one for the container Virtual ID, etc..

@aluzzardi
Copy link
Contributor

I think the store (RequestedState) should be using a cluster.ContainerConfig so we serialize any extra data we might have

@abronan
Copy link
Contributor

abronan commented Apr 30, 2015

I think the store (RequestedState) should be using a cluster.ContainerConfig so we serialize any extra data we might have

And

ClusterConfig is a superset of dockerclient.ContainerConfig.
It contains everything the standard docker configuration contains plus additional fields such as constraints.
ClusterConfig manages to translation to/from dockerclient.ContainerConfig and handles backward compatibility.

👍

Signed-off-by: Victor Vieux <victorvieux@gmail.com>
@vieux
Copy link
Contributor Author

vieux commented Apr 30, 2015

I switched to 2 keys com.docker.swarm.affinities and com.docker.swarm.constraints and added a bunch of tests

@vieux
Copy link
Contributor Author

vieux commented Apr 30, 2015

@aluzzardi can you please take another look and comment on the PR if I forgot something ?

@aluzzardi
Copy link
Contributor

LGTM

There's just a tiny golint error

Signed-off-by: Victor Vieux <victorvieux@gmail.com>
aluzzardi added a commit that referenced this pull request Apr 30, 2015
store constraints and affinities as labels
@aluzzardi aluzzardi merged commit b39e023 into docker-archive:master Apr 30, 2015
@aluzzardi aluzzardi deleted the labels_storage branch April 30, 2015 21:36
@aanm
Copy link

aanm commented May 2, 2015

Is there any docs on this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants