Conventions¶
This document describes the conventions and practices we follow when working in this repository. Consistency here reduces review friction and keeps the codebase predictable.
Git¶
No Direct Pushes to Main¶
All changes must go through a pull request. Direct pushes to main are not allowed. PRs provide a review checkpoint and a clear history of intent behind each change.
Keep Documentation Up to Date¶
When introducing a new feature or modifying existing behaviour, update the relevant documentation in the same PR. Documentation in docs/content/ is part of the change — not a follow-up task.
Agent work¶
Agents start with the repository instruction file and relevant documentation before searching implementation details. When a task reveals durable knowledge such as conventions, gotchas, or where things live, propose a documentation change in the same pull request. Keep task-specific facts in the task or pull request rather than permanent instructions.
A repository's fitness expectations (its FITNESS.md, or the section in its instruction file) follow the format in ADR 0017.
This repository's list is FITNESS.md at its root: the conventions on this page that no check verifies appear there as not verified.
Kubernetes Manifests¶
Name Files After Their Kind¶
Manifest files are named after the Kubernetes kind they contain, in lowercase kebab-case:
Group Same-Kind Manifests in One File¶
If a directory contains multiple manifests of the same kind, they belong in a single file separated by ---. Do not create separate files per instance.
# cluster-role-binding.yaml
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: foo
...
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: bar
...
Every HelmRelease Sets Remediation¶
Every HelmRelease in components/ sets remediation, so a failed chart upgrade returns to the previous Helm revision on its own:
A release may keep stricter or more retries, but never drops remediation. Helm rollback does not revert CRDs or data migrations, so for add-ons with CRDs and stateful services the rollback is only a first line; see the Renovate architecture.
Flux Kustomizations Outwait Helm Upgrades and Rollbacks¶
Every Flux Kustomization that health-checks a HelmRelease (or uses wait: true to wait for
all its resources) sets spec.timeout longer than the HelmRelease's upgrade wait plus its rollback
wait. For each wait, use spec.upgrade.timeout or spec.rollback.timeout when set; otherwise use
the HelmRelease's spec.timeout, or Helm's 5m default when that is also unset. The Kustomization
timeout must be strictly longer than the sum, so Flux does not give up while Helm is still rolling
back. Add a one-line comment stating that the timeout covers the upgrade wait plus rollback.
Flux Kustomizations Retry Failures Sooner¶
Every Flux Kustomization on hetzner-mgmt sets spec.retryInterval: 2m. One patch in
cluster/hetzner-mgmt/kustomization.yaml sets it, so a new Kustomization gets it without listing it.
Without retryInterval, kustomize-controller retries a failed reconcile only at spec.interval
(5m or 10m here). So an ArtifactFailed (failed to download archive ... connection refused)
while the single source-controller replica restarts would last up to one interval after it is
back, and every Kustomization that dependsOn the failed one would wait the same time. A dependent
re-checks its dependencies every 30s on its own (--requeue-dependency), so the 2m retry is
needed only on the Kustomization that failed. The patch sets it on all of them anyway, because
any Kustomization whose interval comes up during the outage fails the same way.
The retry does not shorten spec.timeout or a health-check wait: it starts only after a reconcile
has failed, so the previous section still holds. A retry of a failed backup gate re-applies an
unchanged Job, which does nothing: the gate does not run again until its target version changes.
Taskbase raises one post-merge failure task per object and revision, so the extra retries of a
broken change raise no extra tasks. The Kustomization hetzner-mgmt-cluster is created by
Terraform (terraform/environments/hetzner-mgmt-cluster/2-components), outside this patch, and
keeps retrying at its interval.
Cluster-Specific Values Belong at the Cluster Level¶
If a value in a manifest is specific to a cluster (hostname, IP, replica count, credentials path, etc.), it must not be hardcoded in components/. It either:
- Gets injected via variable substitution from the
cluster-configConfigMap, or - Gets applied as a patch in
cluster/<name>/
The component layer defines structure and defaults. The cluster layer defines specifics. See Repository Structure for how this works in practice.