Skip to content

add custom labels and annotations for crds#812

Open
UndeadDemidov wants to merge 1 commit intocloudnative-pg:mainfrom
UndeadDemidov:main
Open

add custom labels and annotations for crds#812
UndeadDemidov wants to merge 1 commit intocloudnative-pg:mainfrom
UndeadDemidov:main

Conversation

@UndeadDemidov
Copy link

Add custom labels and annotations support for CRDs

Summary

This PR adds the ability to configure custom labels and annotations for CloudNativePG CRDs through Helm values. This enhancement is particularly useful for ArgoCD users who need to enable server-side apply for CRDs managed by ArgoCD.

Changes

  • Added crds.labels and crds.annotations configuration options in values.yaml
  • Updated values.schema.json to include validation for the new fields
  • Modified CRD templates to apply custom labels and annotations to all CRDs:
    • backups.postgresql.cnpg.io
    • clusterimagecatalogs.postgresql.cnpg.io
    • clusters.postgresql.cnpg.io
    • databases.postgresql.cnpg.io
    • failoverquorums.postgresql.cnpg.io
    • imagecatalogs.postgresql.cnpg.io
    • poolers.postgresql.cnpg.io

Use Case

This feature enables ArgoCD users to add annotations like argocd.argoproj.io/sync-options: ServerSideApply=true to CRDs, which is required for proper CRD management in ArgoCD environments.

Example Usage

crds:
create: true
labels:
app.kubernetes.io/managed-by: argocd
annotations:
argocd.argoproj.io/sync-options: ServerSideApply=true

Tests

This commit locally tested in k3d+argocd

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. chart( operator ) Related to the operator (cloudnative-pg) chart labels Feb 17, 2026
Signed-off-by: UndeadDemidov <nikolay.demidov@gmail.com>
@itay-grudev
Copy link
Collaborator

itay-grudev commented Feb 18, 2026

I can accept this if you modify the RELEASE.md to include a command(s) that automatically adds the new yaml. Otherwise, with the current release procedure, the moment we do another release, your changes will be lost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chart( operator ) Related to the operator (cloudnative-pg) chart size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments