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 common labels and annotations patching capabilities #817

Merged
merged 3 commits into from
Mar 29, 2023

Conversation

stefanprodan
Copy link
Member

This PR adds an optional field to the API called CommonMetadata for setting labels and/or annotations to all resources part of a Kustomization.

Example:

apiVersion: kustomize.toolkit.fluxcd.io/v1beta2
kind: Kustomization
metadata:
  name: my-app
  namespace: apps
spec:
  # ...omitted for brevity
  commonMetadata:
    labels:
      app.kubernetes.io/part-of: my-app
    annotations:
      a8r.io/owner: my-team

Note that any existing label or annotation will be overridden if its key matches a common one.

⚠️ The main difference to the Kustomize commonLabels and commonAnnotations, is that the controller sets the labels and annotations only to the top level metadata field, without patching the Kubernetes Deployment spec.template or the Service spec.selector.

Closes: #508

@stefanprodan stefanprodan added enhancement New feature or request area/kustomize Kustomize related issues and pull requests labels Mar 21, 2023
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
Signed-off-by: Stefan Prodan <stefan.prodan@gmail.com>
@stefanprodan stefanprodan added this to the Bootstrap GA milestone Mar 29, 2023
@stefanprodan stefanprodan merged commit 2f5d875 into main Mar 29, 2023
6 checks passed
@stefanprodan stefanprodan deleted the common-metadata branch March 29, 2023 08:42
@haarchri
Copy link

@transacid check this feature

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kustomize Kustomize related issues and pull requests enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow Common Labels and Common Annotations Transformers on Kustomization Apply
3 participants