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

Allow kustomize CLI to add/set labels with includeSelectors: false #4746

Open
margeaux-gendron opened this issue Aug 3, 2022 · 12 comments
Open
Assignees
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@margeaux-gendron
Copy link

Is your feature request related to a problem? Please describe.

Currently, kustomize edit add/set label only supports commonLabels

The introduction of the new label without selectors was intended to fix issues with dynamic labeling changes. However, I don't see a way to dynamically set these labels without selectors with the current CLI.

For example, I cannot dynamically update a version label via CI/CD, due to commonLabels updating selectors which are immutable.

Describe the solution you'd like

Update kustomize edit add/set label to use the new label format with a flag to enable/disable selectors

Describe alternatives you've considered

We are currently using a var in the labels which pulls from a version annotation, and using commonAnnotations instead to set the version dynamically, but vars are planned to be deprecated.

@margeaux-gendron margeaux-gendron added the kind/feature Categorizes issue or PR as related to a new feature. label Aug 3, 2022
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Aug 3, 2022
@GraemeF
Copy link

GraemeF commented Aug 11, 2022

I was say this is a bug because running kustomize edit set label version:bar on:

labels:
- includeSelectors: false
  pairs:
    version: foo

produces:

labels:
- includeSelectors: false
  pairs:
    version: foo
commonLabels:
  version: bar

which is of course invalid:

Error: label name 'version' exists in both commonLabels and labels

@margeaux-gendron
Copy link
Author

@natasha41575
Copy link
Contributor

/triage accepted

I will add reviewing the above PRs to my TODO list.

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Sep 28, 2022
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/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 27, 2022
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/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 26, 2023
@sudoforge
Copy link

@natasha41575 any chance you're able to prioritize those PRs?

i went hunting for why the CLI did not support editing labels (vs commonLabels) today and happened upon this issue. i think this is a fairly necessary feature, and its lack of inclusion when labels were added should be seen (in my opinion) as an oversight, and the current behavior as broken.

if there is anything that either PR needs changed that either author is unwilling or unavailable to change, i will happily take over. this is critical functionality for setting labels with dynamic values.

@AurimasNav
Copy link

still looking forward for this to get implemented

@stormqueen1990
Copy link
Member

stormqueen1990 commented Jul 18, 2024 via email

@stormqueen1990
Copy link
Member

/lifecycle frozen

@k8s-ci-robot k8s-ci-robot added lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. and removed lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. labels Jul 18, 2024
@stormqueen1990
Copy link
Member

My previous comment was incorrect. #4486 is released, I confused that PR for #5682 which allows including labels in templates via edit add label.

@AurimasNav
Copy link

AurimasNav commented Jul 18, 2024

It works for adding completely new label, but I don't see how to edit existing one.

labels:
- pairs:
    version: "1"

kustomize edit add label version:2 --without-selector

results in:

labels:
- pairs:
    version: "1"
- pairs:
    version: "2"

kustomize build will apply the bottom label in this case, but that is not ideal seeing how kustomization.yaml will grow with every label update

p.s. neither edit set label nor edit remove label implements --without-selector flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. lifecycle/frozen Indicates that an issue or PR should not be auto-closed due to staleness. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

No branches or pull requests

9 participants