fix: the crds Application never actually synced #50
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/crds-app-sync-shape"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Fixes the
crdsApplication added in #49, which never actually ran.What was wrong
Every resource in
gitops/apps/crds/was an ArgoCD hook. ArgoCD excludes hookresources from its desired-vs-live comparison, so the Application had nothing to
compare — it reported
Synced/Healthywithin two minutes of merging and neverran a sync operation at all.
Observed after #49 merged:
status.resourcesoperationStatecrd-installernamespaceCreateNamespace=trueNothing broke. The three scripts still exist and the CRDs were already
installed, so the app was simply inert — which is exactly what #49 was designed
to be on its first run.
Why adding any normal resource is not enough
The same exclusion has a second consequence: a version changed inside a hook
manifest never puts the Application OutOfSync, so the installer would not
re-run after a Renovate bump. The first sync would work and every subsequent
bump would silently do nothing. The change-trigger has to live in a normal
resource.
The fix
crd-versionsConfigMap (normal resource) holds the three chart versions.It is both the single source of truth and the thing that puts the app
OutOfSync when a version changes.
configMapKeyRef. PostSync because the ConfigMap and ServiceAccount mustexist first — a PreSync hook needing them would deadlock, since normal
resources never apply while PreSync is failing.
Sync-wave
-5still gates the dependent charts: the sync operation is notcomplete until the PostSync hooks succeed, and an Application's health is the
child's.
This also removes the duplicate chart version that each Job carried in its
args— the version now appears in the ConfigMap and in the matchingApplication's
targetRevision, and nowhere else.Guard
tests/gitops-sync-shape.batsencodes both halves of the bug:gitops/apps/directory may consist entirely of hookscrdsversion source must stay a normal resourceBoth were checked against mutations, including a faithful reconstruction of the
broken shape, which is rejected with
gitops/apps/crds/: all 7 resource(s) are ArgoCD hooks.tests/version-sync.batsandtests/renovate-annotations.batsnow read the pinfrom the ConfigMap, and Renovate's custom manager accepts both
NAME="x"inshell and
NAME: "x"in YAML.Verification
32 bats tests and all 24 pre-commit hooks pass. The in-cluster behaviour cannot
be verified until this merges, for the same reason #49 could not be — which is
why the scripts stay until it is confirmed working.