Files
helm-gitea/unittests/helm/deprecation/deployment.yaml
T
volker.raschekandCopilot 1b82a15b7f feat!: replace postgresql-ha with CloudNativePG
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>
2026-10-04 00:18:34 +02:00

251 lines
9.7 KiB
YAML

suite: Test deployment deprecations
release:
name: gitea-unittests
namespace: testing
templates:
- templates/deprecation.yaml
tests:
- it: "Render nothing with the default values"
asserts:
- hasDocuments:
count: 0
- it: "Fail when the removed `affinity` value is set"
set:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/os
operator: In
values:
- linux
asserts:
- failedTemplate:
errorMessage: "`affinity` does no longer exist. Please refer to the changelog and configure `deployment.affinity` instead."
- it: "Fail when the removed `containerSecurityContext` value is set"
set:
containerSecurityContext:
runAsUser: 1000
asserts:
- failedTemplate:
errorMessage: "`containerSecurityContext` does no longer exist. Please refer to the changelog and configure `deployment.gitea.securityContext` instead."
- it: "Fail when the removed `deployment.env` value is set"
set:
deployment.env:
- name: VARIABLE
value: my-value
asserts:
- failedTemplate:
errorMessage: "`deployment.env` does no longer exist. Please refer to the changelog and configure `deployment.gitea.env` instead."
- it: "Fail when the removed `dnsConfig` value is set"
set:
dnsConfig:
nameservers:
- 192.0.2.1
asserts:
- failedTemplate:
errorMessage: "`dnsConfig` does no longer exist. Please refer to the changelog and configure `deployment.dnsConfig` instead."
- it: "Fail when the removed `extraContainerVolumeMounts` value is set"
set:
extraContainerVolumeMounts:
- name: postgres-ssl-vol
mountPath: /pg-ssl
asserts:
- failedTemplate:
errorMessage: "`extraContainerVolumeMounts` does no longer exist. Please refer to the changelog and configure `deployment.gitea.volumeMounts` instead."
- it: "Fail when the removed `extraInitVolumeMounts` value is set"
set:
extraInitVolumeMounts:
- name: postgres-ssl-vol
mountPath: /pg-ssl
asserts:
- failedTemplate:
errorMessage: "`extraInitVolumeMounts` does no longer exist. Please refer to the changelog and configure `deployment.<initContainer>.volumeMounts` instead."
- it: "Fail when the removed `extraVolumeMounts` value is set"
set:
extraVolumeMounts:
- name: postgres-ssl-vol
mountPath: /pg-ssl
asserts:
- failedTemplate:
errorMessage: "`extraVolumeMounts` does no longer exist. Please refer to the changelog and configure `deployment.gitea.volumeMounts` and `deployment.<initContainer>.volumeMounts` instead."
- it: "Fail when the removed `extraVolumes` value is set"
set:
extraVolumes:
- name: postgres-ssl-vol
secret:
secretName: gitea-postgres-ssl
asserts:
- failedTemplate:
errorMessage: "`extraVolumes` does no longer exist. Please refer to the changelog and configure `deployment.volumes` instead."
- it: "Fail when the removed `ingress.className` value is set"
set:
ingress.className: ""
asserts:
- failedTemplate:
errorMessage: "`ingress.className` does no longer exist. Please refer to the changelog and configure `ingress.ingressClassName` instead."
- it: "Fail when the removed `nodeSelector` value is set"
set:
nodeSelector:
foo: bar
asserts:
- failedTemplate:
errorMessage: "`nodeSelector` does no longer exist. Please refer to the changelog and configure `deployment.nodeSelector` instead."
- it: "Fail when the removed `openshift.hostUsers` value is set"
set:
openshift.hostUsers: false
asserts:
- failedTemplate:
errorMessage: "`openshift.hostUsers` does no longer exist. Please refer to the changelog and configure `deployment.hostUsers` instead."
- it: "Fail when the removed `postgresql-ha` value is set"
set:
postgresql-ha:
enabled: true
asserts:
- failedTemplate:
errorMessage: "`postgresql-ha` does no longer exist. Please refer to the changelog and configure `cloudnativePG` instead, which requires the CloudNativePG operator to be installed in the cluster."
- it: "Fail when the removed `priorityClassName` value is set"
set:
priorityClassName: high-priority
asserts:
- failedTemplate:
errorMessage: "`priorityClassName` does no longer exist. Please refer to the changelog and configure `deployment.priorityClassName` instead."
- it: "Fail when the removed `podSecurityContext` value is set"
set:
podSecurityContext:
fsGroup: 1000
asserts:
- failedTemplate:
errorMessage: "`podSecurityContext` does no longer exist. Please refer to the changelog and configure `deployment.securityContext` instead."
- it: "Fail when the removed `postExtraInitContainers` value is set"
set:
postExtraInitContainers:
- name: post-init-container
image: docker.io/library/busybox
asserts:
- failedTemplate:
errorMessage: "`postExtraInitContainers` does no longer exist. Please refer to the changelog and append an entry with a `container` key to `deployment.initContainers` instead."
- it: "Fail when the removed `preExtraInitContainers` value is set"
set:
preExtraInitContainers:
- name: pre-init-container
image: docker.io/library/busybox
asserts:
- failedTemplate:
errorMessage: "`preExtraInitContainers` does no longer exist. Please refer to the changelog and prepend an entry with a `container` key to `deployment.initContainers` instead."
- it: "Fail when the removed `resources` value is set"
set:
resources:
limits:
cpu: 100m
asserts:
- failedTemplate:
errorMessage: "`resources` does no longer exist. Please refer to the changelog and configure `deployment.gitea.resources` instead."
- it: "Fail when the removed `replicaCount` value is set"
set:
replicaCount: 2
asserts:
- failedTemplate:
errorMessage: "`replicaCount` does no longer exist. Please refer to the changelog and configure `deployment.replicas` instead."
- it: "Fail when the removed `schedulerName` value is set"
set:
schedulerName: stork
asserts:
- failedTemplate:
errorMessage: "`schedulerName` does no longer exist. Please refer to the changelog and configure `deployment.schedulerName` instead."
- it: "Fail when the removed `securityContext` value is set"
set:
securityContext:
runAsUser: 1000
asserts:
- failedTemplate:
errorMessage: "`securityContext` does no longer exist. Please refer to the changelog and configure `deployment.securityContext` and `deployment.gitea.securityContext` instead."
- it: "Fail when the removed `strategy` value is set"
set:
strategy:
type: Recreate
asserts:
- failedTemplate:
errorMessage: "`strategy` does no longer exist. Please refer to the changelog and configure `deployment.strategy` instead."
- it: "Fail when the removed `test` value is set"
set:
test:
enabled: false
asserts:
- failedTemplate:
errorMessage: "`test` does no longer exist. Please refer to the changelog. The `helm test` connection Pod has been removed without replacement."
- it: "Fail when the removed `tolerations` value is set"
set:
tolerations:
- key: database/type
operator: Equal
value: postgres
effect: NoSchedule
asserts:
- failedTemplate:
errorMessage: "`tolerations` does no longer exist. Please refer to the changelog and configure `deployment.tolerations` instead."
- it: "Fail when the removed `topologySpreadConstraints` value is set"
set:
topologySpreadConstraints:
- topologyKey: kubernetes.io/hostname
asserts:
- failedTemplate:
errorMessage: "`topologySpreadConstraints` does no longer exist. Please refer to the changelog and configure `deployment.topologySpreadConstraints` instead."
- it: "Skip the deprecation checks when `checkDeprecation` is disabled"
set:
checkDeprecation: false
affinity:
nodeAffinity: {}
containerSecurityContext:
runAsUser: 1000
deployment.env:
- name: VARIABLE
value: my-value
dnsConfig:
nameservers:
- 192.0.2.1
extraContainerVolumeMounts:
- name: postgres-ssl-vol
mountPath: /pg-ssl
extraInitVolumeMounts:
- name: postgres-ssl-vol
mountPath: /pg-ssl
extraVolumeMounts:
- name: postgres-ssl-vol
mountPath: /pg-ssl
extraVolumes:
- name: postgres-ssl-vol
secret:
secretName: gitea-postgres-ssl
nodeSelector:
foo: bar
podSecurityContext:
fsGroup: 1000
postExtraInitContainers:
- name: post-init-container
image: docker.io/library/busybox
preExtraInitContainers:
- name: pre-init-container
image: docker.io/library/busybox
priorityClassName: high-priority
replicaCount: 2
resources:
limits:
cpu: 100m
schedulerName: stork
securityContext:
runAsUser: 1000
strategy:
type: Recreate
tolerations:
- key: database/type
operator: Equal
value: postgres
effect: NoSchedule
topologySpreadConstraints:
- topologyKey: kubernetes.io/hostname
asserts:
- hasDocuments:
count: 0