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

Addition of pod labels without modifying selectors #4546

Closed
rob8714 opened this issue Mar 28, 2022 · 4 comments
Closed

Addition of pod labels without modifying selectors #4546

rob8714 opened this issue Mar 28, 2022 · 4 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@rob8714
Copy link
Contributor

rob8714 commented Mar 28, 2022

Currently the labels field does not add pod labels if includeSelectors is set to false. It seems that the options available to add pod labels are by either setting includeSelectors to true or using commonLabels, but I would like to be able to do this without updating selectors. It's also possible to add the labels with a patch, but it would be nice if the labels field could handle it

For example:

# kustomization.yaml
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

labels:
  - pairs:
      someName: someValue
      owner: alice
      app: bingo
    includeSelectors: false


resources:
- deploy.yaml
- service.yaml


# deploy.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: example

# service.yaml
apiVersion: v1
kind: Service
metadata:
  name: example

Requested build output:

apiVersion: v1
kind: Service
metadata:
  labels:
    app: bingo
    owner: alice
    someName: someValue
  name: example
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: bingo
    owner: alice
    someName: someValue
spec:
  template:
    metadata:
      labels:
        app: bingo
        owner: alice
        someName: someValue
@rob8714 rob8714 added the kind/feature Categorizes issue or PR as related to a new feature. label Mar 28, 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 Mar 28, 2022
@KnVerey
Copy link
Contributor

KnVerey commented Apr 13, 2022

/triage accepted

@natasha41575 what are your thoughts on what the syntax for this could be?

@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 Apr 13, 2022
@natasha41575
Copy link
Contributor

natasha41575 commented Apr 13, 2022

@KnVerey Completely my bad for losing track of it, there is an open PR that I was reviewing for this feature #4209, which I thought was reasonable syntax. If you agree, I can do another review and merge it this week.

Otherwise, there is another open PR from an active contributor #4486 that we can iterate on. EDIT: This second PR actually is something else, I misinterpreted the title. But the first PR should resolve this issue.

@gaeljw
Copy link

gaeljw commented Apr 19, 2022

I observed the same behavior and thought it was deliberate for some reason but I'd like this to be fixed if this is actually a bug. It's confusing that labels without includeSelectors are not propagated to Deployments.

@KnVerey
Copy link
Contributor

KnVerey commented Jul 15, 2022

@KnVerey KnVerey closed this as completed Jul 15, 2022
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. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

No branches or pull requests

5 participants