Skip to content

Add common labels and annotations patching capabilities #817

Merged
stefanprodan merged 3 commits intomainfrom
common-metadata
Mar 29, 2023
Merged

Add common labels and annotations patching capabilities #817
stefanprodan merged 3 commits intomainfrom
common-metadata

Conversation

@stefanprodan
Copy link
Copy Markdown
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
@stefanprodan stefanprodan requested a review from hiddeco March 21, 2023 18:32
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
@stefanprodan stefanprodan deleted the common-metadata branch March 29, 2023 08:42
@haarchri
Copy link
Copy Markdown

@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