Ignore defaulted StatefulSet volumeClaimTemplates TypeMeta #350

Merged
benvin merged 1 commits from benvin/sts-vct-typemeta-ignorediff into main 2026-08-09 20:53:50 +10:00
Owner

Why

Kubernetes defaults apiVersion: v1 and kind: PersistentVolumeClaim onto every StatefulSet volumeClaimTemplates entry, but neither the raw manifests nor the rendered helm charts in this repo emit those fields. Live StatefulSets therefore carry TypeMeta that git lacks, and ArgoCD reports a diff that removes it.

volumeClaimTemplates are immutable on an existing StatefulSet, so ArgoCD can never apply the removal. The affected StatefulSets stay perpetually OutOfSync and the un-appliable diff can contribute to sync failures.

Rendering the overlays confirms this is a chronic render-vs-live mismatch, not a regression: the source manifests/charts have never emitted the TypeMeta. Affected StatefulSets (render lacks TypeMeta, live defaults it in):

  • consul-server (consul, helm render)
  • nats (logging, helm render)
  • kanidm (kanidm, raw manifest)

vault and the woodpecker StatefulSets already emit TypeMeta from their charts and are unaffected.

How

  • Add a fleet-wide resource.customizations.ignoreDifferences.apps_StatefulSet to the argocd-cm patch, using jqPathExpressions to ignore the defaulted apiVersion and kind under every volumeClaimTemplates entry.

A single global customization is chosen over per-manifest edits because the affected StatefulSets span both raw manifests (kanidm) and helm renders (consul, nats) whose output cannot be edited; it is inert for StatefulSets that already emit TypeMeta (vault, woodpecker) and future-proof for new ones. The live StatefulSets are left untouched — their volumeClaimTemplates are immutable, and recreation would orphan PVCs.

## Why Kubernetes defaults `apiVersion: v1` and `kind: PersistentVolumeClaim` onto every StatefulSet `volumeClaimTemplates` entry, but neither the raw manifests nor the rendered helm charts in this repo emit those fields. Live StatefulSets therefore carry TypeMeta that git lacks, and ArgoCD reports a diff that removes it. `volumeClaimTemplates` are immutable on an existing StatefulSet, so ArgoCD can never apply the removal. The affected StatefulSets stay perpetually OutOfSync and the un-appliable diff can contribute to sync failures. Rendering the overlays confirms this is a chronic render-vs-live mismatch, not a regression: the source manifests/charts have never emitted the TypeMeta. Affected StatefulSets (render lacks TypeMeta, live defaults it in): - `consul-server` (consul, helm render) - `nats` (logging, helm render) - `kanidm` (kanidm, raw manifest) `vault` and the `woodpecker` StatefulSets already emit TypeMeta from their charts and are unaffected. ## How - Add a fleet-wide `resource.customizations.ignoreDifferences.apps_StatefulSet` to the `argocd-cm` patch, using `jqPathExpressions` to ignore the defaulted `apiVersion` and `kind` under every `volumeClaimTemplates` entry. A single global customization is chosen over per-manifest edits because the affected StatefulSets span both raw manifests (kanidm) and helm renders (consul, nats) whose output cannot be edited; it is inert for StatefulSets that already emit TypeMeta (vault, woodpecker) and future-proof for new ones. The live StatefulSets are left untouched — their `volumeClaimTemplates` are immutable, and recreation would orphan PVCs.
unkinben added 1 commit 2026-08-09 19:17:23 +10:00
Ignore defaulted StatefulSet volumeClaimTemplates TypeMeta
ci/woodpecker/pr/vector-test Pipeline was successful
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/kubeconform Pipeline was successful
15f1171ac5
Kubernetes defaults apiVersion=v1 and kind=PersistentVolumeClaim onto every
StatefulSet volumeClaimTemplates entry, but neither the raw manifests nor the
rendered helm charts emit those fields. Live StatefulSets therefore carry
TypeMeta that git lacks, and ArgoCD reports a diff removing it. Because
volumeClaimTemplates are immutable on an existing StatefulSet, ArgoCD can never
apply the removal, so consul-server, kanidm and nats stay perpetually OutOfSync
and can contribute to sync failures.

Add a fleet-wide resource.customizations.ignoreDifferences for apps/StatefulSet
that ignores the defaulted apiVersion/kind under every volumeClaimTemplates
entry. A single global customization covers the affected StatefulSets across
both raw manifests (kanidm) and helm renders (consul, nats), and is inert for
those whose charts already emit TypeMeta (vault, woodpecker).
benvin merged commit a8d52311cd into main 2026-08-09 20:53:50 +10:00
benvin deleted branch benvin/sts-vct-typemeta-ignorediff 2026-08-09 20:53:50 +10:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: unkin/argocd-apps#350