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

add labels to containers from job definition #414

Merged
merged 5 commits into from
Nov 18, 2015

Conversation

fernandezvara
Copy link

Since labels on containers are a power tool, Nomad must allow to set labels on docker containers if required.

This is a POC for add those labels without make any modification that could break job definition and located only on the docker driver.

Sometimes some environment variables need to be hidden for the user (by security or something), or are just meaningless.

@cbednarski
Copy link
Contributor

Thanks for the PR. I think it is cleaner to provide these via the driver config instead of munging the meta property for the job. For instance, we might be able to do something like:

task "flask" {
    driver = "docker"
    config {
         image = "cbednarski/commento"
         labels = {
              "environment" = "production"
              "segment" = "green"
         }
    }
}

Also, I'm planning to add some basic labels based on the job name, task, etc. so these are already setup for monitoring tools.

@fernandezvara
Copy link
Author

Yes, adding metadata is a bit annoying, but I though that the main idea was to try to have a common structure for all drivers, and since config is a map[string]string I couldn't figure something like labels.

So, would be allowed to change Task.Config to map[string]interface{} ? that would allow us to add another map inside, but don't know if you allow that (thinking in performance or future driver design.

@diptanu
Copy link
Contributor

diptanu commented Nov 14, 2015

@fernandezvara There is already a PR [ #415 ] in motion which introduces map[string]interface{} as the type of the config. I think you can implement this once that PR is merged into main.

@fernandezvara
Copy link
Author

Yes, @diptanu, will wait until final merge, nice addition the config on its own struct.

@fernandezvara fernandezvara changed the title POC: allow to add labels for docker containers from job metadata add labels to containers from job definition Nov 17, 2015
@cbednarski cbednarski merged commit e42f083 into hashicorp:master Nov 18, 2015
@fernandezvara fernandezvara deleted the docker-allow-to-add-labels branch November 20, 2015 13:32
@github-actions
Copy link

github-actions bot commented May 2, 2023

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants