Skip to content

refactor(infrastructure): centralize HelmRelease Flux remediation defaults - #1928

Merged
devantler merged 1 commit into
mainfrom
claude/helmrelease-flux-defaults
Jun 9, 2026
Merged

devantler merged 1 commit into
mainfrom
claude/helmrelease-flux-defaults

Conversation

@devantler

Copy link
Copy Markdown
Contributor

What

The install/upgrade remediation block required by the enforce-flux-best-practices Kyverno policy:

install:
  remediation:
    retries: -1
upgrade:
  remediation:
    retries: -1
    remediateLastFailure: true

was copy-pasted byte-identical into all 37 HelmReleases (~190 lines). Centralize it into a Kustomize Component — the same mechanism already used for helmrelease-drift-detection — and delete the inline copies.

How

  • New k8s/bases/components/helmrelease-flux-defaults/ merges the remediation block into every HelmRelease.
  • Strategic-merge (not JSON6902) so it merges: creates spec.install/spec.upgrade when absent and leaves sibling fields untouched — install.crds, upgrade.crds, and velero's upgrade.force are all preserved.
  • Wired into the same five overlay layers as drift detection: providers/{docker,hetzner}/infrastructure, .../infrastructure/controllers, and hetzner/apps.

Net: −185 lines across 37 HelmReleases; new HelmReleases no longer need to restate the block.

Validation (behavior-preserving)

  • kubectl kustomize for all five HR-rendering provider paths is byte-identical to before (59 rendered HR instances total).
  • ksail workload validate: local 0 failures; prod unchanged (its only failure is the pre-existing coroot catalog-schema issue). The sole delta is 88 → 89 kustomizations validated — the new Component itself.
  • Standalone base HRs no longer carry remediation, which is schema-valid (optional in the CRD). On the live cluster Flux always renders HRs through an overlay that includes the Component, so the Kyverno enforce-flux-best-practices gate still sees the field.

Note

This intentionally leaves interval/timeout inline (they have a few deliberate per-chart values, unlike the 100%-uniform remediation block). The one pre-existing label inconsistency (origin-ca-issuer missing helm.toolkit.fluxcd.io/remediation: enabled) is left for a separate change to keep this PR a pure behavior-preserving refactor.

🤖 Generated with Claude Code

…aults

The install/upgrade remediation block (retries: -1 + remediateLastFailure: true)
required by the enforce-flux-best-practices Kyverno policy was copy-pasted,
byte-identical, into all 37 HelmReleases. Move it into a Kustomize Component
(bases/components/helmrelease-flux-defaults) that merges it into every
HelmRelease — the same mechanism already used for helmrelease-drift-detection —
and delete the inline blocks.

A strategic-merge patch (not JSON6902) is used so the defaults MERGE: they create
spec.install/upgrade where absent and leave sibling fields (install.crds,
upgrade.crds, velero's upgrade.force) and per-chart values untouched.

The Component is wired into the same five overlay layers as drift detection
(providers/{docker,hetzner}/infrastructure[/controllers], hetzner/apps).

Behavior-preserving: `kubectl kustomize` output for all five HR-rendering
provider paths is byte-identical to before. `ksail workload validate` is
unchanged (local 0 failures; prod's only failure is the pre-existing coroot
catalog-schema one) — the single delta is one additional kustomization validated
(the new Component). Standalone base HRs no longer carry remediation, which is
schema-valid (the field is optional in the CRD); the live cluster still sees it
because Flux always renders HRs through an overlay that includes the Component,
so the Kyverno gate is satisfied.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-project-automation github-project-automation Bot moved this to 🫴 Ready in 🌊 Project Board Jun 9, 2026
@devantler
devantler marked this pull request as ready for review June 9, 2026 17:42
@devantler
devantler added this pull request to the merge queue Jun 9, 2026
Merged via the queue into main with commit 04635e9 Jun 9, 2026
10 checks passed
@devantler
devantler deleted the claude/helmrelease-flux-defaults branch June 9, 2026 18:06
@github-project-automation github-project-automation Bot moved this from 🫴 Ready to ✅ Done in 🌊 Project Board Jun 9, 2026
@botantler-1

botantler-1 Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 1.44.9 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

This branch was previously deployed

1 inactive deployment
ci — 55d76182 Deployed Jun 9, 2026 by devantler via 🧪 System Test #2391
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant