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

Adding labels only to .metadata.labels #330

Closed
mikebryant opened this issue Sep 7, 2018 · 11 comments
Closed

Adding labels only to .metadata.labels #330

mikebryant opened this issue Sep 7, 2018 · 11 comments
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@mikebryant
Copy link

I'd like to be able to add labels to the metadata of all objects, without them being part of the selectors.

One use case would be in our deployment pipeline, adding a label of the current git commit hash, so we can easily see which pipeline actually ran, trace back issues, stuff like that.

Currently commonLabels applies to selectors as well, which makes it unsuitable (As we don't want to force a rollout of all Deployments on every change, for example)

Is this something kustomize can/should support? Presumably using a different field name to commonLabels.

@Liujingfang1
Copy link
Contributor

We will consider supporting this use case when design #91. It should provide an approach for users to add or remove different fields that they want to kustomize by transformers.

@Liujingfang1
Copy link
Contributor

@mikebryant I'm thinking if annotations work for this case. Any ideas?

@mikebryant
Copy link
Author

@Liujingfang1 I think that would work for the use-case I mentioned.

@Benjamintf1
Copy link
Contributor

I don't think that would work for our use-case.

Specifically, we are deploying based on some labels, this includes a common label that is un-applied via patch from specific resources(to prevent from deleting certain resources).

@mylokin
Copy link

mylokin commented Jul 11, 2019

Supporting this kind of functionality would be really neat. I was going to implement dangling resources cleanup (that were left after prev. deployments) using commonLabels, but found this to be impossible because labels are propagated into selectors.

@jbrette
Copy link
Contributor

jbrette commented Sep 4, 2019

@mylokin @Benjamintf1 @mikebryant

Please have a look at:

@fejta-bot
Copy link

Issues go stale after 90d of inactivity.
Mark the issue as fresh with /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 3, 2019
@sebastiansirch
Copy link

Just in case someone is looking for a workaround: Here is an example of a transformer to add labels only to the metadata block. https://github.com/viadee/kustomize-examples/tree/master/overlays/custom-metadata-labels

@fejta-bot
Copy link

Stale issues rot after 30d of inactivity.
Mark the issue as fresh with /remove-lifecycle rotten.
Rotten issues close after an additional 30d of inactivity.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jan 2, 2020
@fejta-bot
Copy link

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

@k8s-ci-robot
Copy link
Contributor

@fejta-bot: Closing this issue.

In response to this:

Rotten issues close after 30d of inactivity.
Reopen the issue with /reopen.
Mark the issue as fresh with /remove-lifecycle rotten.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta.
/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

No branches or pull requests

8 participants