kubernetes-sigs / kustomize

Customization of kubernetes YAML configurations
Apache License 2.0
10.7k stars 2.22k forks source link

Per configMap defined labels in configMapGenerator #5724

Open aschaber1 opened 5 days ago

aschaber1 commented 5 days ago

Eschewed features

What would you like to have added?

I'd like to set labels on a configMap level and not only on a generatorOptions level, which causes all configMaps to have these labels.

Why is this needed?

I'd like to use this to add configMaps containing Grafana Dashboards. These need a label: grafana_dashboard: 1. But I don't want this on all configMaps I'm generating with this kustomization. For instance I regularly create a configMap for Flux' Helm values.yaml. This configMap should not have that label.

Can you accomplish the motivating task without this feature, and if so, how?

Yes, by manually generating configMaps like this and adding the result to the resources:

kubectl create configmap --dry-run=client -o yaml --from-file 13768_rev4.json grafana-dashboard > grafana-dashboard.yaml

What other solutions have you considered?

Above manual configmap solution.

Anything else we should know?

Here's an example of how it could look:

configMapGenerator:
  - name: grafana-dashboard-13768
    labels:
      grafana_dashboard: "1"
    files:
      - grafana_dashboard.json=13768_rev4.json

Feature ownership

k8s-ci-robot commented 5 days ago

This issue is currently awaiting triage.

SIG CLI takes a lead on issue triage for this repo, but any Kubernetes member can accept issues by applying the triage/accepted label.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.