From a8d52311cd89c6340656bffb7c3990809cb47d38 Mon Sep 17 00:00:00 2001 From: Ben Vincent Date: Sun, 9 Aug 2026 20:53:49 +1000 Subject: [PATCH] Ignore defaulted StatefulSet volumeClaimTemplates TypeMeta (#350) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 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. --------- Co-authored-by: Ben Vincent Reviewed-on: https://git.unkin.net/unkin/argocd-apps/pulls/350 Co-authored-by: Ben Vincent Co-committed-by: Ben Vincent --- clusters/au-syd1/bootstrap/argocd-cm-patch.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/clusters/au-syd1/bootstrap/argocd-cm-patch.yaml b/clusters/au-syd1/bootstrap/argocd-cm-patch.yaml index e13e14b..8701640 100644 --- a/clusters/au-syd1/bootstrap/argocd-cm-patch.yaml +++ b/clusters/au-syd1/bootstrap/argocd-cm-patch.yaml @@ -6,6 +6,16 @@ metadata: namespace: argocd data: kustomize.buildOptions: "--enable-helm" + # Kubernetes defaults apiVersion/kind onto every StatefulSet + # volumeClaimTemplates entry, but neither the raw manifests nor the helm + # charts emit them, so live StatefulSets carry TypeMeta that git lacks. + # volumeClaimTemplates are immutable on an existing StatefulSet, so ArgoCD + # can never reconcile the removal and the resource stays perpetually + # OutOfSync. Ignore the defaulted TypeMeta fleet-wide. + resource.customizations.ignoreDifferences.apps_StatefulSet: | + jqPathExpressions: + - '.spec.volumeClaimTemplates[]?.apiVersion' + - '.spec.volumeClaimTemplates[]?.kind' # External URL ArgoCD serves on (TLS terminated at the traefik-internal gateway). url: https://argocd.k8s.syd1.au.unkin.net # OIDC login via Authentik. The client secret is seeded in Vault out of band