-
Notifications
You must be signed in to change notification settings - Fork 814
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
Conversation
88e6a5f
to
91d57f3
Compare
b354caa
to
42ca27a
Compare
There was a problem hiding this 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.
utils/orchestrator/baseutil.py
Outdated
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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 |
There was a problem hiding this 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.
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
andDockerDaemon._get_tags
once again.This introduces three classes:
Orchestrator.BaseUtil
: provides the common interface and the caching and container inspect logicOrchestrator.MesosUtil
: inherits BaseUtil and just implements_get_cacheable_tags
andis_detected
Orchestrator.Tagger
: triggers orchestrator detection and proxies calls to relevant BaseUtil classesECSUtil and NomadUtil will be moved to BaseUtil if this PR is approved.
Test
unit tests in the test_orchestrator.py file