Skip to content

Conversation

@xmj
Copy link

@xmj xmj commented Aug 28, 2025

We want to be able to pass annotations to all CustomResourceDefinitions.

This is helpful in that it allows passing an annotation to ArgoCD to enable ServerSideApply:

crds:
  annotations:
    argocd.argoproj.io/sync-options: ServerSideApply=true

Fixes #656

@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 Aug 28, 2025
We want to be able to pass annotations to all CustomResourceDefinitions.

This is helpful in that it allows passing an annotation to ArgoCD to
enable ServerSideApply:

```
crds:
  annotations:
    argocd.argoproj.io/sync-options: ServerSideApply=true
```

Fixes cloudnative-pg#656

Signed-off-by: Johannes Meixner <xmj@chaot.net>
@xmj xmj force-pushed the crd-annotations branch from 7edcf3e to fd6cd46 Compare August 28, 2025 04:17
@kastl-ars
Copy link

What is missing for this to be merged?

@kastl-ars
Copy link

What is missing for this to be merged?

Sorry for bringing this up again, but why is this simple PR still open? What is missing?

@wizardist
Copy link

@xmj while the patch would technically solve the issue, it wouldn't work well with the current release procedure for the chart.

The crds.yaml is generated before every release with kustomize build on https://github.com/cloudnative-pg/cloudnative-pg/blob/main/config/helm/kustomization.yaml.

Something would need to change in the release procedure, or it becomes a release hell. I would guess from 3a0c7df that @sxd is running the command manually or with a script. In any case, the with block with annotations is best to be injected automatically as part of the build.

@sxd
Copy link
Member

sxd commented Nov 25, 2025

Hi,

Why you need to do this at CRDs level and not at ArgoCD Application level? I've been doing a lot of work and installed the CRDs with ArgoCD using the application and managing all the possible and required changes there, from my point of view, this is not required at all.

Regards,

@xmj
Copy link
Author

xmj commented Nov 25, 2025

Hi

I want an interface to pass arbitrary annotations, which is not present so far.

That I use them to pass ServerSideApply is just an example, and mostly due to the way we use ApplicationSets to install all our operators. And I really do not want to change it for any other operator.

Thanks
johannes

@wizardist
Copy link

Hi @sxd,

Thanks a lot for taking a look. I agree that having a server-side apply on the Application would work just fine.

What I thought was a server-side / client-side apply difference issue (apparent drift in an ESO ClusterExternalSecret resource), turned out to be likely an issue in ESO.

I tried to solve it by adding an annotation to the drifting resource:

metadata:
  annotations:
    argocd.argoproj.io/sync-options: ServerSideApply=false

But it proved to be the wrong tree I barked at.

All this without prejudice to the need of annotations in the original issue. I wouldn't go as far as to say nobody needs it, but my immediate need is resolved.

Thanks

@xy2
Copy link

xy2 commented Nov 26, 2025

Hi @sxd

The problem with server-side apply for the entire ArgoCD application is that with full SSA, ArgoCD can only add or modify keys in resources, but not delete them. So, if someone "temporarily" added a key to the live resource but didn't remove it later, ArgoCD will be unable to detect the drift because it doesn't manage this field.

The annotation allows to narrow down the problem from the entire chart to CRDs only, which usually only grow and aren't touched by itchy fingers.

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.

CRD annotations through values.yaml

6 participants