cloudnative-pg / cloudnative-pg/charts
cluster: ObjectStore helm hook breaks backups under ArgoCD
- Dominant language
- Go Template
- Stars
- 621
- Forks
- 265
- Avg merge
- 7d 12h
- Merged PRs (30d)
- 7
Description
### What's wrong
With the plugin backup method, the chart renders the `ObjectStore` with: `"helm.sh/hook": pre-install,pre-upgrade,pre-rollback`
(in `backup-objectstore.yaml` and `recovery-objectstore.yaml`, from #924).
Fine in plain Helm, it jsut orders the ObjectStore before the Cluster. But under ArgoCD a Helm hook becomes an ephemeral PreSync resource, so ArgoCD creates it once and then prunes it. It never comes back: WAL archiving stops and the Cluster goes `Ready=False` with `ContinuousArchivingFailing: ObjectStore ... not found`, wedging the whole app sync.
### Repro
`backups.method: plugin` synced by ArgoCD (auto-sync + prune) -> ObjectStore applied as a PreSync hook, then pruned, and archiving breaks.
For now, I've worked around it by rendering the CNPG CRs myself instead of using this chart directly, so the ObjectStore has no helm hook and ArgoCD keeps it as a normal tracked resource, wtih an `argocd.argoproj.io/sync-wave: "-1"` for ordering.
### Suggested fix
Make the hook optional, (default enabled, to not causea BC break of course)
```yaml
backups:
objectStore:
helmHook: true # set false for ArgoCD/Flux
annotations: {} # e.g. argocd.argoproj.io/sync-wave: "-1"
```
When `false`, drop the hook annotation. The `annotations` map lets GitOps users add their own ordering without leaking it onto the Cluster like the existing `cluster.annotations` passthrough would. I'd apply it to both the backup and recovery ObjectStores.
Happy to open a PR (templates + values + schema + docs + chainsaw test) if the approach works for you. just wanted to check the approach first.
// Edit: it was kindof a small change, so I already created the PR. No hard feelings if you reject it or prefer a different approach :)
https://github.com/cloudnative-pg/charts/pull/965
Contributor guide
Research direction
Start with backup-objectstore.yaml and recovery-objectstore.yaml, then review the related values, schema, documentation, and chainsaw test changes proposed in PR #965. Reproduce the plugin backup flow under ArgoCD with auto-sync and prune; done means the ObjectStore remains tracked and WAL archiving continues without the Cluster entering Ready=False.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- helm
- Domain
- devops
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 20/100