The bundled `postgresql-ha` sub-chart was the only HA-ready database option, but it pinned us to a Bitnami chart whose images are no longer freely distributed, and it bundled repmgr and pgpool into the release. Operating a Postgres cluster through a Helm release also means the chart has to reimplement failover, backup and upgrade orchestration that a dedicated operator already solves. CloudNativePG is the de-facto standard operator for Postgres on Kubernetes and handles instance management, streaming replication, switchover and rolling upgrades itself. The operator is deliberately *not* part of this chart: cluster-scoped CRDs and controllers do not belong into an application release and would conflict with an operator that is already installed. The chart only renders the namespaced `Cluster` resource, so the operator can be managed independently. Because the operator cannot be assumed to be present, `cloudnativePG.enabled` defaults to `false`. Existing users of `postgresql` or an external database are therefore unaffected. Credentials follow the chart-wide `secrets.*` convention. Only the password is read from a Secret, because CloudNativePG requires `bootstrap.initdb.database` and `bootstrap.initdb.owner` as literals in the `Cluster` spec and cannot resolve them from a Secret. The password is injected into the `init-app-ini` container as `GITEA__database__PASSWD` instead of being written into the generated `app.ini`. BREAKING CHANGE: The `postgresql-ha` sub-chart and all `postgresql-ha.*` values have been removed. There is no in-place migration path between the two deployments: dump the database of the old `postgresql-ha` release with `pg_dump`, remove the `postgresql-ha` values, deploy the chart with `cloudnativePG.enabled=true` and restore the dump. Setting `postgresql-ha` now fails the release with a pointer to the changelog. Co-authored-by: Copilot <copilot@github.com>
5.2 KiB
5.2 KiB
Gitea Helm Chart — Copilot Instructions
Project Overview
Kubernetes Helm chart for deploying Gitea. Uses Go/Helm templating (templates/), YAML values (values.yaml), and includes sub-charts for PostgreSQL, Valkey, and Valkey-cluster. The HA-ready database is provisioned as a CloudNativePG Cluster resource, the operator itself is not part of the chart.
Build & Test
make missing-dot # Check if the @param annotations are missing a trailing dot.
make readme # Regenerate README.md parameter table + lint + link checker
make helm/unittest # Run Helm unit tests (helm-unittest plugin required)
make bash/unittest # Run bash/bats script tests (requires git submodule init)
Always run make readme after changing values.yaml @param annotations.
Always run make helm/unittest after changing templates or unit tests.
Conventions
values.yaml
- Use
## @param path.to.key Descriptionannotations for every user-facing value. These drive the auto-generated README parameter table. - Property ordering within a resource block:
enabled,annotations,labelsfirst, then type-specific fields. - Top-level keys are sorted alphabetically within their section group.
- Use Helm Values pattern from renovatebot. Ensure that the attributes
registry,repositoryandtagare available as part of the dictimage. For example:
image:
registry: docker.io
repository: library/busybox
tag: 0.1.0
Templates
- Helm templates live in
templates/. Helpers live intemplates/_helpers.tpl. - Use camelCase for all files and variables (e.g
httpRoute,backendTLSPolicy,gatewayAPI,statefulSet). - Use
include "gitea.fullname"for naming resources. - Use
failfor required-value validation with clear error messages referencing the full values path. - Ensure, that the attributes
annotations,labels,nameandnamespaceare alphabetically sorted. - Render all attributes, even if they are empty, to prevent drift in Argo CD. For example,
labelsmust be rendered, whileannotationsare defined asyaml:"annotations,omitempty". - Use plural for
*.tplfiles, because they may contain functions for multiple resources of the same kind (e.g._services.tplforhttpService.yamlorsshService.yaml,_backendTLSPolicies.tplforbackendTLSPolicy.yaml). - Use as prefix of YAML files the resource kind (e.g.,
deployment.yamlforDeploymentresources). If there are multiple resources of the same kind, use a descriptive suffix (e.g.,deployment_metrics.yamlfor aDeploymentrelated to metrics). - Short names like
pvcfor Persistent Volume Claims orsvcfor Services are not allowed in file names or key names. - Render
Secretpayloads as base64dataand never asstringData. The API server dropsstringDataand persists everything underdata, so Helm's three-way merge cannot prune a key that was removed from the values — the stale key survives every upgrade. For example:
data:
app.ini: {{ $config | b64enc }}
Unit Tests
- Helm unit tests live in
unittests/helm/mirroring the template structure. A suite belongs into the directory of the template it asserts on, never into the directory of a template it only renders as a side effect. - Test files are YAML using the helm-unittest format.
- Name test files in camelCase after the scenario they cover (e.g.
signingEnabled.yaml), usebasics.yamlfor the default scenario and do not repeat the directory name in the file name. Themake helm/unittestglob only matches one directory level, so every suite must live in a subdirectory. - Each test must set all required values explicitly — do not rely on cross-test state.
- The
values.yamlfile must passyamllint. The configuration is in.yamllint.yaml. Usemake yamllintto run the linter. - The title of the unit test should clearly describe the scenario being tested. As title must be use a short sentence starting with a capital letter and ending without a period.
- The
suitetitle follows the patternTest <subject> <scenario>(e.g.Test deployment probes). It must be unique across all suites, becausehelm unittestidentifies a failing suite by this title. - Each unit test must explicitly set a custom namespace and release name, rather than relying on defaults.
- Assert
Secretcontent viadata.*withdecodeBase64: trueand add anotExistsassertion forstringData.
Commits & PRs
- Follow Conventional Commits for PR titles and commit messages (e.g.
feat:,fix:,refactor:,docs:,style:). - See
CONTRIBUTING.mdfor full PR requirements. - Explain in detail why a change is needed, not just what the change is. Include links to relevant issues, PRs, or external references.
- Add co-authors for any contributions that are not your own. Use the
Co-authored-by:trailer in the commit message.
Documentation
docs/contains topic-specific guides (e.g.gateway-api.md,ha-setup.md).README.mdparameter tables are auto-generated — never edit them manually.