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

Mesos tagging and generic container tagger #3375

Merged
merged 5 commits into from
Jun 12, 2017
Merged

Mesos tagging and generic container tagger #3375

merged 5 commits into from
Jun 12, 2017

Conversation

xvello
Copy link
Contributor

@xvello xvello commented Jun 6, 2017

What does this PR do?

Introduces a generic container tagger mechanism to support all orchestrators through a common interface instead of expanding SDDockerBackend.get_tags and DockerDaemon._get_tags once again.

This introduces three classes:

  • Orchestrator.BaseUtil: provides the common interface and the caching and container inspect logic
  • Orchestrator.MesosUtil: inherits BaseUtil and just implements _get_cacheable_tags and is_detected
  • Orchestrator.Tagger: triggers orchestrator detection and proxies calls to relevant BaseUtil classes

ECSUtil and NomadUtil will be moved to BaseUtil if this PR is approved.

Test

unit tests in the test_orchestrator.py file

@xvello xvello force-pushed the xvello/mesosutil branch 4 times, most recently from 88e6a5f to 91d57f3 Compare June 7, 2017 14:36
@xvello xvello changed the title WIP : Mesos tagging and generic container tagger Mesos tagging and generic container tagger Jun 7, 2017
@xvello xvello changed the title Mesos tagging and generic container tagger WIP: Mesos tagging and generic container tagger Jun 7, 2017
@xvello xvello force-pushed the xvello/mesosutil branch 5 times, most recently from b354caa to 42ca27a Compare June 8, 2017 13:21
@xvello xvello force-pushed the xvello/mesosutil branch from 42ca27a to 431aabd Compare June 8, 2017 14:14
@xvello xvello changed the title WIP: Mesos tagging and generic container tagger Mesos tagging and generic container tagger Jun 8, 2017
Copy link
Member

@hkaj hkaj left a comment

Choose a reason for hiding this comment

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

nice one, this will provide a good base for migrating the old orchestrator utils and building new ones.

if (self.needs_inspect or self.needs_env) and co is None:
co = self.docker_util.inspect_container(cid)
if self.needs_env and 'Env' not in co.get('Config', {}):
co = self.docker_util.inspect_container(cid)
Copy link
Member

Choose a reason for hiding this comment

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

this feels a bit clunky. Maybe if (self.needs_inspect or self.needs_env) and (co is None or 'Env' not in co.get('Config, {})) and remove the second if?

Copy link
Contributor Author

@xvello xvello Jun 9, 2017

Choose a reason for hiding this comment

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

The idea was to be able to accept the partial inspects (without the config section) that the docker_daemon currently gets (needs_inspect = true / needs_env = false), but it does feel clunky.

I could go with more explicit need_inspect_labels (they are found in the partial inspect) and need_inspect_config (needs a full inspect) instead of need_inspect

need_inspect_config need_inspect_labels
ECS N N
Mesos Y N
Nomad Y N
Rancher N Y

@xvello xvello force-pushed the xvello/mesosutil branch from 79916a5 to 364cc29 Compare June 9, 2017 11:38
Copy link
Member

@hkaj hkaj left a comment

Choose a reason for hiding this comment

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

👍 if the tests pass after your latest commit it's GTG.

@xvello xvello force-pushed the xvello/mesosutil branch from 9c10710 to bcdbb38 Compare June 12, 2017 09:34
@xvello xvello merged commit 34f3d17 into master Jun 12, 2017
@xvello xvello deleted the xvello/mesosutil branch June 12, 2017 10:01
@xvello xvello added this to the 5.15 milestone Jun 12, 2017
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.

2 participants