chore(deps)!: Migrate to Valkey from Redis (#775)

<!--
 Before you open the request please review the following guidelines and tips to help it be more easily integrated:

 - Describe the scope of your change - i.e. what the change does.
 - Describe any known limitations with your change.
 - Please run any tests or examples that can exercise your modified code.

 Thank you for contributing! We will try to review, test and integrate the change as soon as we can.
 -->

### Description of the change

Migrates from Redis to Valkey.

### Benefits

The Redis License is changing from BSD-3-Clause to RSALv2 and SSPLv1 which are not open source under the OSI definition. We should consider open-source alternatives as a default replacement for Redis.

### Possible drawbacks

Large scale change, potentially breaking.

### Applicable issues

https://github.com/go-gitea/gitea/issues/32056

### ⚠ BREAKING

Major version change, redis provider changed to valkey.

### Checklist

<!-- [Place an '[X]' (no spaces) in all applicable fields. Please remove unrelated fields.] -->

- [X] Parameters are documented in the `values.yaml` and added to the `README.md` using [readme-generator-for-helm](https://github.com/bitnami-labs/readme-generator-for-helm)
- [X] Breaking changes are documented in the `README.md`
- [X] Helm templating unittests are added (required when changing anything in `templates` folder)

Co-authored-by: pat-s <patrick.schratz@gmail.com>
Reviewed-on: https://gitea.com/gitea/helm-gitea/pulls/775
Reviewed-by: pat-s <pat-s@noreply.gitea.com>
Co-authored-by: Sean Teo <sawntoe@gmail.com>
Co-committed-by: Sean Teo <sawntoe@gmail.com>
This commit is contained in:
Sean Teo 2025-05-05 08:12:41 +00:00 committed by pat-s
parent 037eca0c91
commit 6e4e414771
15 changed files with 246 additions and 220 deletions

View File

@ -5,11 +5,11 @@ dependencies:
- name: postgresql-ha - name: postgresql-ha
repository: oci://registry-1.docker.io/bitnamicharts repository: oci://registry-1.docker.io/bitnamicharts
version: 15.3.8 version: 15.3.8
- name: redis-cluster - name: valkey-cluster
repository: oci://registry-1.docker.io/bitnamicharts repository: oci://registry-1.docker.io/bitnamicharts
version: 11.4.6 version: 3.0.3
- name: redis - name: valkey
repository: oci://registry-1.docker.io/bitnamicharts repository: oci://registry-1.docker.io/bitnamicharts
version: 20.11.4 version: 3.0.3
digest: sha256:58043080c2090cb80a434b2a88e155cece3a3418c62b7908fcaa58c9c66a192a digest: sha256:f1d1b04d28fd93a00467a61ef19bdf1d02df1bccc613cc1eedde08f295e8b253
generated: "2025-03-29T00:06:23.258261191Z" generated: "2025-05-05T09:54:33.58745+02:00"

View File

@ -43,13 +43,13 @@ dependencies:
repository: oci://registry-1.docker.io/bitnamicharts repository: oci://registry-1.docker.io/bitnamicharts
version: 15.3.8 version: 15.3.8
condition: postgresql-ha.enabled condition: postgresql-ha.enabled
# https://github.com/bitnami/charts/blob/main/bitnami/redis-cluster/Chart.yaml # https://github.com/bitnami/charts/blob/main/bitnami/valkey-cluster/Chart.yaml
- name: redis-cluster - name: valkey-cluster
repository: oci://registry-1.docker.io/bitnamicharts repository: oci://registry-1.docker.io/bitnamicharts
version: 11.4.6 version: 3.0.3
condition: redis-cluster.enabled condition: valkey-cluster.enabled
# https://github.com/bitnami/charts/blob/main/bitnami/redis/Chart.yaml # https://github.com/bitnami/charts/blob/main/bitnami/valkey/Chart.yaml
- name: redis - name: valkey
repository: oci://registry-1.docker.io/bitnamicharts repository: oci://registry-1.docker.io/bitnamicharts
version: 20.11.4 version: 3.0.3
condition: redis.enabled condition: valkey.enabled

View File

@ -51,8 +51,8 @@
- [LivenessProbe](#livenessprobe) - [LivenessProbe](#livenessprobe)
- [ReadinessProbe](#readinessprobe) - [ReadinessProbe](#readinessprobe)
- [StartupProbe](#startupprobe) - [StartupProbe](#startupprobe)
- [redis-cluster](#redis-cluster) - [valkey-cluster](#valkey-cluster)
- [redis](#redis) - [valkey](#valkey)
- [PostgreSQL HA](#postgresql-ha) - [PostgreSQL HA](#postgresql-ha)
- [PostgreSQL](#postgresql) - [PostgreSQL](#postgresql)
- [Advanced](#advanced) - [Advanced](#advanced)
@ -95,14 +95,14 @@ Users can also configure their own external providers via the configuration.
These dependencies are enabled by default: These dependencies are enabled by default:
- PostgreSQL HA ([Bitnami PostgreSQL-HA](https://github.com/bitnami/charts/blob/main/bitnami/postgresql-ha/Chart.yaml)) - PostgreSQL HA ([Bitnami PostgreSQL-HA](https://github.com/bitnami/charts/blob/main/bitnami/postgresql-ha/Chart.yaml))
- Redis-Cluster ([Bitnami Redis-Cluster](https://github.com/bitnami/charts/blob/main/bitnami/redis-cluster/Chart.yaml)) - Valkey-Cluster ([Bitnami Valkey-Cluster](https://github.com/bitnami/charts/blob/main/bitnami/valkey-cluster/Chart.yaml))
### Non-HA Dependencies ### Non-HA Dependencies
Alternatively, the following non-HA replacements are available: Alternatively, the following non-HA replacements are available:
- PostgreSQL ([Bitnami PostgreSQL](<Postgresql](https://github.com/bitnami/charts/blob/main/bitnami/postgresql/Chart.yaml)>)) - PostgreSQL ([Bitnami PostgreSQL](<Postgresql](https://github.com/bitnami/charts/blob/main/bitnami/postgresql/Chart.yaml)>))
- Redis ([Bitnami Redis](<Redis](https://github.com/bitnami/charts/blob/main/bitnami/redis/Chart.yaml)>)) - Valkey ([Bitnami Valkey](<Valkey](https://github.com/bitnami/charts/blob/main/bitnami/valkey/Chart.yaml)>))
### Dependency Versioning ### Dependency Versioning
@ -120,8 +120,8 @@ Please double-check the image repository and available tags in the sub-chart:
- [PostgreSQL-HA](https://hub.docker.com/r/bitnami/postgresql-repmgr/tags) - [PostgreSQL-HA](https://hub.docker.com/r/bitnami/postgresql-repmgr/tags)
- [PostgreSQL](https://hub.docker.com/r/bitnami/postgresql/tags) - [PostgreSQL](https://hub.docker.com/r/bitnami/postgresql/tags)
- [Redis Cluster](https://hub.docker.com/r/bitnami/redis-cluster/tags) - [Valkey Cluster](https://hub.docker.com/r/bitnami/valkey-cluster/tags)
- [Redis](https://hub.docker.com/r/bitnami/redis/tags) - [Valkey](https://hub.docker.com/r/bitnami/valkey/tags)
and look up the image tag which fits your needs on Dockerhub. and look up the image tag which fits your needs on Dockerhub.
@ -281,28 +281,28 @@ If `.Values.image.rootless: true`, then the following will occur. In case you us
#### Session, Cache and Queue #### Session, Cache and Queue
The session, cache and queue settings are set to use the built-in Redis Cluster sub-chart dependency. The session, cache and queue settings are set to use the built-in Valkey Cluster sub-chart dependency.
If Redis Cluster is disabled, the chart will fall back to the Gitea defaults which use "memory" for `session` and `cache` and "level" for `queue`. If Valkey Cluster is disabled, the chart will fall back to the Gitea defaults which use "memory" for `session` and `cache` and "level" for `queue`.
While these will work and even not cause immediate issues after startup, **they are not recommended for production use**. While these will work and even not cause immediate issues after startup, **they are not recommended for production use**.
Reasons being that a single pod will take on all the work for `session` and `cache` tasks in its available memory. Reasons being that a single pod will take on all the work for `session` and `cache` tasks in its available memory.
It is likely that the pod will run out of memory or will face substantial memory spikes, depending on the workload. It is likely that the pod will run out of memory or will face substantial memory spikes, depending on the workload.
External tools such as `redis-cluster` or `memcached` handle these workloads much better. External tools such as `valkey-cluster` or `memcached` handle these workloads much better.
### Single-Pod Configurations ### Single-Pod Configurations
If HA is not needed/desired, the following configurations can be used to deploy a single-pod Gitea instance. If HA is not needed/desired, the following configurations can be used to deploy a single-pod Gitea instance.
1. For a production-ready single-pod Gitea instance without external dependencies (using the chart dependency `postgresql` and `redis`): 1. For a production-ready single-pod Gitea instance without external dependencies (using the chart dependency `postgresql` and `valkey`):
<details> <details>
<summary>values.yml</summary> <summary>values.yml</summary>
```yaml ```yaml
redis-cluster: valkey-cluster:
enabled: false enabled: false
redis: valkey:
enabled: true enabled: true
postgresql: postgresql:
enabled: true enabled: true
@ -333,9 +333,9 @@ If HA is not needed/desired, the following configurations can be used to deploy
<summary>values.yml</summary> <summary>values.yml</summary>
```yaml ```yaml
redis-cluster: valkey-cluster:
enabled: false enabled: false
redis: valkey:
enabled: false enabled: false
postgresql: postgresql:
enabled: false enabled: false
@ -537,17 +537,17 @@ More about this issue [here](https://gitea.com/gitea/helm-gitea/issues/161).
### Cache ### Cache
The cache handling is done via `redis-cluster` (via the `bitnami` chart) by default. The cache handling is done via `valkey-cluster` (via the `bitnami` chart) by default.
This deployment is HA-ready but can also be used for single-pod deployments. This deployment is HA-ready but can also be used for single-pod deployments.
By default, 6 replicas are deployed for a working `redis-cluster` deployment. By default, 6 replicas are deployed for a working `valkey-cluster` deployment.
Many cloud providers offer a managed redis service, which can be used instead of the built-in `redis-cluster`. Many cloud providers offer a managed valkey service, which can be used instead of the built-in `valkey-cluster`.
```yaml ```yaml
redis-cluster: valkey-cluster:
enabled: true enabled: true
``` ```
⚠️ The redis charts [do not work well with special characters in the password](https://gitea.com/gitea/helm-gitea/issues/690). ⚠️ The valkey charts [do not work well with special characters in the password](https://gitea.com/gitea/helm-chart/issues/690).
Consider omitting such or open an issue in the Bitnami repo and let us know once this got fixed. Consider omitting such or open an issue in the Bitnami repo and let us know once this got fixed.
### Persistence ### Persistence
@ -1131,27 +1131,30 @@ To comply with the Gitea helm chart definition of the digest parameter, a "custo
| `gitea.startupProbe.successThreshold` | Success threshold for startup probe | `1` | | `gitea.startupProbe.successThreshold` | Success threshold for startup probe | `1` |
| `gitea.startupProbe.failureThreshold` | Failure threshold for startup probe | `10` | | `gitea.startupProbe.failureThreshold` | Failure threshold for startup probe | `10` |
### redis-cluster ### valkey-cluster
Redis cluster and [Redis](#redis) cannot be enabled at the same time. Valkey cluster and [Valkey](#valkey) cannot be enabled at the same time.
| Name | Description | Value | | Name | Description | Value |
| -------------------------------- | -------------------------------------------- | ------- | | ------------------------------------- | -------------------------------------------------------------------- | ------- |
| `redis-cluster.enabled` | Enable redis cluster | `true` | | `valkey-cluster.enabled` | Enable valkey cluster | `true` |
| `redis-cluster.usePassword` | Whether to use password authentication | `false` | | `valkey-cluster.usePassword` | Whether to use password authentication | `false` |
| `redis-cluster.cluster.nodes` | Number of redis cluster master nodes | `3` | | `valkey-cluster.usePasswordFiles` | Whether to mount passwords as files instead of environment variables | `false` |
| `redis-cluster.cluster.replicas` | Number of redis cluster master node replicas | `0` | | `valkey-cluster.cluster.nodes` | Number of valkey cluster master nodes | `3` |
| `valkey-cluster.cluster.replicas` | Number of valkey cluster master node replicas | `0` |
| `valkey-cluster.service.ports.valkey` | Port of Valkey service | `6379` |
### redis ### valkey
Redis and [Redis cluster](#redis-cluster) cannot be enabled at the same time. Valkey and [Valkey cluster](#valkey-cluster) cannot be enabled at the same time.
| Name | Description | Value | | Name | Description | Value |
| ----------------------------- | ------------------------------------------ | ------------ | | ------------------------------------ | ------------------------------------------- | ------------ |
| `redis.enabled` | Enable redis standalone or replicated | `false` | | `valkey.enabled` | Enable valkey standalone or replicated | `false` |
| `redis.architecture` | Whether to use standalone or replication | `standalone` | | `valkey.architecture` | Whether to use standalone or replication | `standalone` |
| `redis.global.redis.password` | Required password | `changeme` | | `valkey.global.valkey.password` | Required password | `changeme` |
| `redis.master.count` | Number of Redis master instances to deploy | `1` | | `valkey.master.count` | Number of Valkey master instances to deploy | `1` |
| `valkey.master.service.ports.valkey` | Port of Valkey service | `6379` |
### PostgreSQL HA ### PostgreSQL HA
@ -1203,6 +1206,20 @@ If you miss this, blindly upgrading may delete your Postgres instance and you ma
<details> <details>
<summary>To 12.0.0</summary>
<!-- prettier-ignore-start -->
<!-- markdownlint-disable-next-line -->
**Breaking changes**
<!-- prettier-ignore-end -->
- Migrated from Redis/Redis-cluster to Valkey/Valkey-cluster charts (#775).
While marked as breaking, there should be no need to migrate data explicity. Cache will start to refill automatically.
</details>
<details>
<summary>To 11.0.0</summary> <summary>To 11.0.0</summary>
<!-- prettier-ignore-start --> <!-- prettier-ignore-start -->
@ -1220,8 +1237,7 @@ If you miss this, blindly upgrading may delete your Postgres instance and you ma
Although there are no breaking changes in the Redis Chart itself, it updates Redis from `7.2` to `7.4`. We recommend checking the release notes: Although there are no breaking changes in the Redis Chart itself, it updates Redis from `7.2` to `7.4`. We recommend checking the release notes:
- [Redis Chart release notes (starting with v11.0.0)](https://github.com/bitnami/charts/blob/HEAD/bitnami/redis-cluster/CHANGELOG.md#1100-2024-08-09). - [Redis Chart release notes (starting with v11.0.0)](https://github.com/bitnami/charts/blob/HEAD/bitnami/redis-cluster/CHANGELOG.md#1100-2024-08-09).
- [Redis 7.4 release notes](https://raw.githubusercontent.com/redis/redis/7.4/00-RELEASENOTES). - [Redis 7.4 release notes](https://raw.githubusercontent.com/redis/redis/7.4/00-RELEASENOTES).
</details>
</details>
<details> <details>
@ -1298,16 +1314,16 @@ gitea:
config: config:
session: session:
PROVIDER: redis-cluster PROVIDER: redis-cluster
PROVIDER_CONFIG: redis+cluster://:gitea@gitea-redis-cluster-headless.<namespace>.svc.cluster.local:6379/0?pool_size=100&idle_timeout=180s& PROVIDER_CONFIG: redis+cluster://:gitea@gitea-valkey-cluster-headless.<namespace>.svc.cluster.local:6379/0?pool_size=100&idle_timeout=180s&
cache: cache:
ENABLED: true ENABLED: true
ADAPTER: redis-cluster ADAPTER: redis-cluster
HOST: redis+cluster://:gitea@gitea-redis-cluster-headless.<namespace>.svc.cluster.local:6379/0?pool_size=100&idle_timeout=180s& HOST: redis+cluster://:gitea@gitea-valkey-cluster-headless.<namespace>.svc.cluster.local:6379/0?pool_size=100&idle_timeout=180s&
queue: queue:
TYPE: redis TYPE: redis
CONN_STR: redis+cluster://:gitea@gitea-redis-cluster-headless.<namespace>.svc.cluster.local:6379/0?pool_size=100&idle_timeout=180s& CONN_STR: redis+cluster://:gitea@gitea-valkey-cluster-headless.<namespace>.svc.cluster.local:6379/0?pool_size=100&idle_timeout=180s&
``` ```
<!-- prettier-ignore-start --> <!-- prettier-ignore-start -->

View File

@ -25,7 +25,7 @@ In addition, the following components are required for full HA-readiness:
- A HA-ready issue (and optionally code) indexer: `elasticsearch` or `meilisearch` - A HA-ready issue (and optionally code) indexer: `elasticsearch` or `meilisearch`
- A HA-ready external object/asset storage (`minio`) (optional, assets can also be stored on the RWX file-system) - A HA-ready external object/asset storage (`minio`) (optional, assets can also be stored on the RWX file-system)
- A HA-ready cache (`redis-cluster`) - A HA-ready cache (`valkey-cluster`)
- A HA-ready DB - A HA-ready DB
`postgres.enabled`, which default to `true`, must be set to `false` for a HA setup. `postgres.enabled`, which default to `true`, must be set to `false` for a HA setup.
@ -72,33 +72,33 @@ persistence:
## Cache, session and queue ## Cache, session and queue
A `redis` instance is required for the in-memory cache. A `valkey` instance is required for the in-memory cache.
Two options exist: Two options exist:
- `redis` - `valkey`
- `redis-cluster` - `valkey-cluster`
The chart provides `redis-cluster` as a dependency as this one can be used for both HA and non-HA setups. The chart provides `valkey-cluster` as a dependency as this one can be used for both HA and non-HA setups.
You're also welcome to go with `redis` if you prefer or already have a running instance. You're also welcome to go with `valkey` if you prefer or already have a running instance.
It should be noted that `redis-cluster` support is only available starting with Gitea 1.19.2. It should be noted that `valkey-cluster` support is only available starting with Gitea 1.19.2.
You can also configure an external (managed) `redis` instance to be used. You can also configure an external (managed) `valkey` instance to be used.
To do so, you need to set the following configuration values yourself: To do so, you need to set the following configuration values yourself:
- `gitea.config.queue.TYPE`: redis` - `gitea.config.queue.TYPE`: valkey`
- `gitea.config.queue.CONN_STR`: `<your redis connection string>` - `gitea.config.queue.CONN_STR`: `<your valkey connection string>`
- `gitea.config.session.PROVIDER`: `redis` - `gitea.config.session.PROVIDER`: `valkey`
- `gitea.config.session.PROVIDER_CONFIG`: `<your redis connection string>` - `gitea.config.session.PROVIDER_CONFIG`: `<your valkey connection string>`
- `gitea.config.cache.ENABLED`: `true` - `gitea.config.cache.ENABLED`: `true`
- `gitea.config.cache.ADAPTER`: `redis` - `gitea.config.cache.ADAPTER`: `valkey`
- `gitea.config.cache.HOST`: `<your redis connection string>` - `gitea.config.cache.HOST`: `<your valkey connection string>`
By default, the `redis-cluster` chart provisions three standalone master nodes of which each has a single replica. By default, the `valkey-cluster` chart provisions three standalone master nodes of which each has a single replica.
To reduce the number of pods for a default Gitea deployment, we opted to omit the replicas (`replicas: 0`) by default. To reduce the number of pods for a default Gitea deployment, we opted to omit the replicas (`replicas: 0`) by default.
Only the minimum required number of master pods for a functional `redis-cluster` deployment are provisioned. Only the minimum required number of master pods for a functional `valkey-cluster` deployment are provisioned.
For a "proper" `redis-cluster` setup however, we recommend to set `replicas: 1` and `nodes: 6`. For a "proper" `valkey-cluster` setup however, we recommend to set `replicas: 1` and `nodes: 6`.
## Object and asset storage ## Object and asset storage

View File

@ -133,29 +133,29 @@ app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- define "redis.dns" -}} {{- define "valkey.dns" -}}
{{- if and ((index .Values "redis-cluster").enabled) ((index .Values "redis").enabled) -}} {{- if and ((index .Values "valkey-cluster").enabled) ((index .Values "valkey").enabled) -}}
{{- fail "redis and redis-cluster cannot be enabled at the same time. Please only choose one." -}} {{- fail "valkey and valkey-cluster cannot be enabled at the same time. Please only choose one." -}}
{{- else if (index .Values "redis-cluster").enabled -}} {{- else if (index .Values "valkey-cluster").enabled -}}
{{- printf "redis+cluster://:%s@%s-redis-cluster-headless.%s.svc.%s:%g/0?pool_size=100&idle_timeout=180s&" (index .Values "redis-cluster").global.redis.password .Release.Name .Release.Namespace .Values.clusterDomain (index .Values "redis-cluster").service.ports.redis -}} {{- printf "redis+cluster://:%s@%s-valkey-cluster-headless.%s.svc.%s:%g/0?pool_size=100&idle_timeout=180s&" (index .Values "valkey-cluster").global.valkey.password .Release.Name .Release.Namespace .Values.clusterDomain (index .Values "valkey-cluster").service.ports.valkey -}}
{{- else if (index .Values "redis").enabled -}} {{- else if (index .Values "valkey").enabled -}}
{{- printf "redis://:%s@%s-redis-headless.%s.svc.%s:%g/0?pool_size=100&idle_timeout=180s&" (index .Values "redis").global.redis.password .Release.Name .Release.Namespace .Values.clusterDomain (index .Values "redis").master.service.ports.redis -}} {{- printf "redis://:%s@%s-valkey-headless.%s.svc.%s:%g/0?pool_size=100&idle_timeout=180s&" (index .Values "valkey").global.valkey.password .Release.Name .Release.Namespace .Values.clusterDomain (index .Values "valkey").master.service.ports.valkey -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- define "redis.port" -}} {{- define "valkey.port" -}}
{{- if (index .Values "redis-cluster").enabled -}} {{- if (index .Values "valkey-cluster").enabled -}}
{{ (index .Values "redis-cluster").service.ports.redis }} {{ (index .Values "valkey-cluster").service.ports.valkey }}
{{- else if (index .Values "redis").enabled -}} {{- else if (index .Values "valkey").enabled -}}
{{ (index .Values "redis").master.service.ports.redis }} {{ (index .Values "valkey").master.service.ports.valkey }}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- define "redis.servicename" -}} {{- define "valkey.servicename" -}}
{{- if (index .Values "redis-cluster").enabled -}} {{- if (index .Values "valkey-cluster").enabled -}}
{{- printf "%s-redis-cluster-headless.%s.svc.%s" .Release.Name .Release.Namespace .Values.clusterDomain -}} {{- printf "%s-valkey-cluster-headless.%s.svc.%s" .Release.Name .Release.Namespace .Values.clusterDomain -}}
{{- else if (index .Values "redis").enabled -}} {{- else if (index .Values "valkey").enabled -}}
{{- printf "%s-redis-headless.%s.svc.%s" .Release.Name .Release.Namespace .Values.clusterDomain -}} {{- printf "%s-valkey-headless.%s.svc.%s" .Release.Name .Release.Namespace .Values.clusterDomain -}}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
@ -305,14 +305,14 @@ https
{{- if and (not (hasKey .Values.gitea.config.metrics "TOKEN")) (.Values.gitea.metrics.token) (.Values.gitea.metrics.enabled) -}} {{- if and (not (hasKey .Values.gitea.config.metrics "TOKEN")) (.Values.gitea.metrics.token) (.Values.gitea.metrics.enabled) -}}
{{- $_ := set .Values.gitea.config.metrics "TOKEN" .Values.gitea.metrics.token -}} {{- $_ := set .Values.gitea.config.metrics "TOKEN" .Values.gitea.metrics.token -}}
{{- end -}} {{- end -}}
{{- /* redis queue */ -}} {{- /* valkey queue */ -}}
{{- if or ((index .Values "redis-cluster").enabled) ((index .Values "redis").enabled) -}} {{- if or ((index .Values "valkey-cluster").enabled) ((index .Values "valkey").enabled) -}}
{{- $_ := set .Values.gitea.config.queue "TYPE" "redis" -}} {{- $_ := set .Values.gitea.config.queue "TYPE" "redis" -}}
{{- $_ := set .Values.gitea.config.queue "CONN_STR" (include "redis.dns" .) -}} {{- $_ := set .Values.gitea.config.queue "CONN_STR" (include "valkey.dns" .) -}}
{{- $_ := set .Values.gitea.config.session "PROVIDER" "redis" -}} {{- $_ := set .Values.gitea.config.session "PROVIDER" "redis" -}}
{{- $_ := set .Values.gitea.config.session "PROVIDER_CONFIG" (include "redis.dns" .) -}} {{- $_ := set .Values.gitea.config.session "PROVIDER_CONFIG" (include "valkey.dns" .) -}}
{{- $_ := set .Values.gitea.config.cache "ADAPTER" "redis" -}} {{- $_ := set .Values.gitea.config.cache "ADAPTER" "redis" -}}
{{- $_ := set .Values.gitea.config.cache "HOST" (include "redis.dns" .) -}} {{- $_ := set .Values.gitea.config.cache "HOST" (include "valkey.dns" .) -}}
{{- else -}} {{- else -}}
{{- if not (get .Values.gitea.config.session "PROVIDER") -}} {{- if not (get .Values.gitea.config.session "PROVIDER") -}}
{{- $_ := set .Values.gitea.config.session "PROVIDER" "memory" -}} {{- $_ := set .Values.gitea.config.session "PROVIDER" "memory" -}}

View File

@ -57,25 +57,25 @@ stringData:
exit 1 exit 1
} }
{{- if include "redis.servicename" . }} {{- if include "valkey.servicename" . }}
function test_redis_connection() { function test_valkey_connection() {
local RETRY=0 local RETRY=0
local MAX=30 local MAX=30
echo 'Wait for redis to become available...' echo 'Wait for valkey to become avialable...'
until [ "${RETRY}" -ge "${MAX}" ]; do until [ "${RETRY}" -ge "${MAX}" ]; do
nc -vz -w2 {{ include "redis.servicename" . }} {{ include "redis.port" . }} && break nc -vz -w2 {{ include "valkey.servicename" . }} {{ include "valkey.port" . }} && break
RETRY=$[${RETRY}+1] RETRY=$[${RETRY}+1]
echo "...not ready yet (${RETRY}/${MAX})" echo "...not ready yet (${RETRY}/${MAX})"
done done
if [ "${RETRY}" -ge "${MAX}" ]; then if [ "${RETRY}" -ge "${MAX}" ]; then
echo "Redis not reachable after '${MAX}' attempts!" echo "Valkey not reachable after '${MAX}' attempts!"
exit 1 exit 1
fi fi
} }
test_redis_connection test_valkey_connection
{{- end }} {{- end }}

View File

@ -3,12 +3,12 @@ release:
name: gitea-unittests name: gitea-unittests
namespace: testing namespace: testing
tests: tests:
- it: "cache is configured correctly for redis-cluster" - it: "cache is configured correctly for valkey-cluster"
template: templates/gitea/config.yaml template: templates/gitea/config.yaml
set: set:
redis-cluster: valkey-cluster:
enabled: true enabled: true
redis: valkey:
enabled: false enabled: false
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
@ -16,14 +16,14 @@ tests:
path: stringData.cache path: stringData.cache
value: |- value: |-
ADAPTER=redis ADAPTER=redis
HOST=redis+cluster://:@gitea-unittests-redis-cluster-headless.testing.svc.cluster.local:6379/0?pool_size=100&idle_timeout=180s& HOST=redis+cluster://:@gitea-unittests-valkey-cluster-headless.testing.svc.cluster.local:6379/0?pool_size=100&idle_timeout=180s&
- it: "cache is configured correctly for redis" - it: "cache is configured correctly for valkey"
template: templates/gitea/config.yaml template: templates/gitea/config.yaml
set: set:
redis-cluster: valkey-cluster:
enabled: false enabled: false
redis: valkey:
enabled: true enabled: true
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
@ -31,14 +31,14 @@ tests:
path: stringData.cache path: stringData.cache
value: |- value: |-
ADAPTER=redis ADAPTER=redis
HOST=redis://:changeme@gitea-unittests-redis-headless.testing.svc.cluster.local:6379/0?pool_size=100&idle_timeout=180s& HOST=redis://:changeme@gitea-unittests-valkey-headless.testing.svc.cluster.local:6379/0?pool_size=100&idle_timeout=180s&
- it: "cache is configured correctly for 'memory' when redis (or redis-cluster) is disabled" - it: "cache is configured correctly for 'memory' when valkey (or valkey-cluster) is disabled"
template: templates/gitea/config.yaml template: templates/gitea/config.yaml
set: set:
redis-cluster: valkey-cluster:
enabled: false enabled: false
redis: valkey:
enabled: false enabled: false
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
@ -48,12 +48,12 @@ tests:
ADAPTER=memory ADAPTER=memory
HOST= HOST=
- it: "cache can be customized when redis (or redis-cluster) is disabled" - it: "cache can be customized when valkey (or valkey-cluster) is disabled"
template: templates/gitea/config.yaml template: templates/gitea/config.yaml
set: set:
redis-cluster: valkey-cluster:
enabled: false enabled: false
redis: valkey:
enabled: false enabled: false
gitea.config.cache.ADAPTER: custom-adapter gitea.config.cache.ADAPTER: custom-adapter
gitea.config.cache.HOST: custom-host gitea.config.cache.HOST: custom-host

View File

@ -3,42 +3,42 @@ release:
name: gitea-unittests name: gitea-unittests
namespace: testing namespace: testing
tests: tests:
- it: "queue is configured correctly for redis-cluster" - it: "queue is configured correctly for valkey-cluster"
template: templates/gitea/config.yaml template: templates/gitea/config.yaml
set: set:
redis-cluster: valkey-cluster:
enabled: true enabled: true
redis: valkey:
enabled: false enabled: false
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
equal: equal:
path: stringData.queue path: stringData.queue
value: |- value: |-
CONN_STR=redis+cluster://:@gitea-unittests-redis-cluster-headless.testing.svc.cluster.local:6379/0?pool_size=100&idle_timeout=180s& CONN_STR=redis+cluster://:@gitea-unittests-valkey-cluster-headless.testing.svc.cluster.local:6379/0?pool_size=100&idle_timeout=180s&
TYPE=redis TYPE=redis
- it: "queue is configured correctly for redis" - it: "queue is configured correctly for valkey"
template: templates/gitea/config.yaml template: templates/gitea/config.yaml
set: set:
redis-cluster: valkey-cluster:
enabled: false enabled: false
redis: valkey:
enabled: true enabled: true
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
equal: equal:
path: stringData.queue path: stringData.queue
value: |- value: |-
CONN_STR=redis://:changeme@gitea-unittests-redis-headless.testing.svc.cluster.local:6379/0?pool_size=100&idle_timeout=180s& CONN_STR=redis://:changeme@gitea-unittests-valkey-headless.testing.svc.cluster.local:6379/0?pool_size=100&idle_timeout=180s&
TYPE=redis TYPE=redis
- it: "queue is configured correctly for 'levelDB' when redis (and redis-cluster) is disabled" - it: "queue is configured correctly for 'levelDB' when valkey (and valkey-cluster) is disabled"
template: templates/gitea/config.yaml template: templates/gitea/config.yaml
set: set:
redis-cluster: valkey-cluster:
enabled: false enabled: false
redis: valkey:
enabled: false enabled: false
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
@ -48,12 +48,12 @@ tests:
CONN_STR= CONN_STR=
TYPE=level TYPE=level
- it: "queue can be customized when redis (and redis-cluster) are disabled" - it: "queue can be customized when valkey (and valkey-cluster) are disabled"
template: templates/gitea/config.yaml template: templates/gitea/config.yaml
set: set:
redis-cluster: valkey-cluster:
enabled: false enabled: false
redis: valkey:
enabled: false enabled: false
gitea.config.queue.TYPE: custom-type gitea.config.queue.TYPE: custom-type
gitea.config.queue.CONN_STR: custom-connection-string gitea.config.queue.CONN_STR: custom-connection-string

View File

@ -3,12 +3,12 @@ release:
name: gitea-unittests name: gitea-unittests
namespace: testing namespace: testing
tests: tests:
- it: "session is configured correctly for redis-cluster" - it: "session is configured correctly for valkey-cluster"
template: templates/gitea/config.yaml template: templates/gitea/config.yaml
set: set:
redis-cluster: valkey-cluster:
enabled: true enabled: true
redis: valkey:
enabled: false enabled: false
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
@ -16,14 +16,14 @@ tests:
path: stringData.session path: stringData.session
value: |- value: |-
PROVIDER=redis PROVIDER=redis
PROVIDER_CONFIG=redis+cluster://:@gitea-unittests-redis-cluster-headless.testing.svc.cluster.local:6379/0?pool_size=100&idle_timeout=180s& PROVIDER_CONFIG=redis+cluster://:@gitea-unittests-valkey-cluster-headless.testing.svc.cluster.local:6379/0?pool_size=100&idle_timeout=180s&
- it: "session is configured correctly for redis" - it: "session is configured correctly for valkey"
template: templates/gitea/config.yaml template: templates/gitea/config.yaml
set: set:
redis-cluster: valkey-cluster:
enabled: false enabled: false
redis: valkey:
enabled: true enabled: true
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
@ -31,14 +31,14 @@ tests:
path: stringData.session path: stringData.session
value: |- value: |-
PROVIDER=redis PROVIDER=redis
PROVIDER_CONFIG=redis://:changeme@gitea-unittests-redis-headless.testing.svc.cluster.local:6379/0?pool_size=100&idle_timeout=180s& PROVIDER_CONFIG=redis://:changeme@gitea-unittests-valkey-headless.testing.svc.cluster.local:6379/0?pool_size=100&idle_timeout=180s&
- it: "session is configured correctly for 'memory' when redis (and redis-cluster) is disabled" - it: "session is configured correctly for 'memory' when valkey (and valkey-cluster) is disabled"
template: templates/gitea/config.yaml template: templates/gitea/config.yaml
set: set:
redis-cluster: valkey-cluster:
enabled: false enabled: false
redis: valkey:
enabled: false enabled: false
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
@ -48,12 +48,12 @@ tests:
PROVIDER=memory PROVIDER=memory
PROVIDER_CONFIG= PROVIDER_CONFIG=
- it: "session can be customized when redis (and redis-cluster) is disabled" - it: "session can be customized when valkey (and valkey-cluster) is disabled"
template: templates/gitea/config.yaml template: templates/gitea/config.yaml
set: set:
redis-cluster: valkey-cluster:
enabled: false enabled: false
redis: valkey:
enabled: false enabled: false
gitea.config.session.PROVIDER: custom-provider gitea.config.session.PROVIDER: custom-provider
gitea.config.session.PROVIDER_CONFIG: custom-provider-config gitea.config.session.PROVIDER_CONFIG: custom-provider-config

View File

@ -1,19 +1,19 @@
suite: Dependency checks | Customization integrity | redis-cluster suite: Dependency checks | Customization integrity | valkey-cluster
release: release:
name: gitea-unittests name: gitea-unittests
namespace: testing namespace: testing
set: set:
redis: valkey:
enabled: false enabled: false
redis-cluster: valkey-cluster:
enabled: true enabled: true
usePassword: false usePassword: false
cluster: cluster:
nodes: 5 nodes: 5
replicas: 2 replicas: 2
tests: tests:
- it: "[redis-cluster] configures correct nodes/replicas" - it: "[valkey-cluster] configures correct nodes/replicas"
template: charts/redis-cluster/templates/redis-statefulset.yaml template: charts/valkey-cluster/templates/valkey-statefulset.yaml
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
equal: equal:
@ -22,31 +22,31 @@ tests:
- documentIndex: 0 - documentIndex: 0
matchRegex: matchRegex:
path: spec.template.spec.containers[0].args[0] path: spec.template.spec.containers[0].args[0]
pattern: REDIS_CLUSTER_REPLICAS="2" pattern: VALKEY_CLUSTER_REPLICAS="2"
- it: "[redis-cluster] support auth-less connections" - it: "[valkey-cluster] support auth-less connections"
asserts: asserts:
- template: charts/redis-cluster/templates/secret.yaml - template: charts/valkey-cluster/templates/secret.yaml
hasDocuments: hasDocuments:
count: 0 count: 0
- template: charts/redis-cluster/templates/redis-statefulset.yaml - template: charts/valkey-cluster/templates/valkey-statefulset.yaml
documentIndex: 0 documentIndex: 0
contains: contains:
path: spec.template.spec.containers[0].env path: spec.template.spec.containers[0].env
content: content:
name: ALLOW_EMPTY_PASSWORD name: ALLOW_EMPTY_PASSWORD
value: "yes" value: "yes"
- it: "[redis-cluster] support auth-full connections" - it: "[valkey-cluster] support auth-full connections"
set: set:
redis-cluster: valkey-cluster:
usePassword: true usePassword: true
asserts: asserts:
- template: charts/redis-cluster/templates/secret.yaml - template: charts/valkey-cluster/templates/secret.yaml
containsDocument: containsDocument:
kind: Secret kind: Secret
apiVersion: v1 apiVersion: v1
name: gitea-unittests-redis-cluster name: gitea-unittests-valkey-cluster
namespace: testing namespace: testing
- template: charts/redis-cluster/templates/redis-statefulset.yaml - template: charts/valkey-cluster/templates/valkey-statefulset.yaml
documentIndex: 0 documentIndex: 0
contains: contains:
path: spec.template.spec.containers[0].env path: spec.template.spec.containers[0].env
@ -54,25 +54,25 @@ tests:
name: REDISCLI_AUTH name: REDISCLI_AUTH
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: gitea-unittests-redis-cluster name: gitea-unittests-valkey-cluster
key: redis-password key: valkey-password
- template: charts/redis-cluster/templates/redis-statefulset.yaml - template: charts/valkey-cluster/templates/valkey-statefulset.yaml
documentIndex: 0 documentIndex: 0
contains: contains:
path: spec.template.spec.containers[0].env path: spec.template.spec.containers[0].env
content: content:
name: REDIS_PASSWORD name: REDISCLI_AUTH
valueFrom: valueFrom:
secretKeyRef: secretKeyRef:
name: gitea-unittests-redis-cluster name: gitea-unittests-valkey-cluster
key: redis-password key: valkey-password
- it: "[redis-cluster] renders the referenced service" - it: "[valkey-cluster] renders the referenced service"
template: charts/redis-cluster/templates/headless-svc.yaml template: charts/valkey-cluster/templates/headless-svc.yaml
asserts: asserts:
- containsDocument: - containsDocument:
kind: Service kind: Service
apiVersion: v1 apiVersion: v1
name: gitea-unittests-redis-cluster-headless name: gitea-unittests-valkey-cluster-headless
namespace: testing namespace: testing
- documentIndex: 0 - documentIndex: 0
contains: contains:
@ -81,10 +81,10 @@ tests:
name: tcp-redis name: tcp-redis
port: 6379 port: 6379
targetPort: tcp-redis targetPort: tcp-redis
- it: "[gitea] waits for redis-cluster to be up and running" - it: "[gitea] waits for valkey-cluster to be up and running"
template: templates/gitea/init.yaml template: templates/gitea/init.yaml
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
matchRegex: matchRegex:
path: stringData["configure_gitea.sh"] path: stringData["configure_gitea.sh"]
pattern: nc -vz -w2 gitea-unittests-redis-cluster-headless.testing.svc.cluster.local 6379 pattern: nc -vz -w2 gitea-unittests-valkey-cluster-headless.testing.svc.cluster.local 6379

View File

@ -1,40 +1,40 @@
suite: Dependency checks | Customization integrity | redis suite: Dependency checks | Customization integrity | valkey
release: release:
name: gitea-unittests name: gitea-unittests
namespace: testing namespace: testing
set: set:
redis-cluster: valkey-cluster:
enabled: false enabled: false
redis: valkey:
enabled: true enabled: true
architecture: standalone architecture: standalone
global: global:
redis: valkey:
password: gitea-password password: gitea-password
master: master:
count: 2 count: 2
tests: tests:
- it: "[redis] configures correct 'master' nodes" - it: "[valkey] configures correct 'master' nodes"
template: charts/redis/templates/master/application.yaml template: charts/valkey/templates/primary/application.yaml
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
equal: equal:
path: spec.replicas path: spec.replicas
value: 2 value: 1
- it: "[redis] redis.global.redis.password is applied as expected" - it: "[valkey] valkey.global.valkey.password is applied as expected"
template: charts/redis/templates/secret.yaml template: charts/valkey/templates/secret.yaml
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
equal: equal:
path: data["redis-password"] path: data["valkey-password"]
value: "Z2l0ZWEtcGFzc3dvcmQ=" value: "Z2l0ZWEtcGFzc3dvcmQ="
- it: "[redis] renders the referenced service" - it: "[valkey] renders the referenced service"
template: charts/redis/templates/headless-svc.yaml template: charts/valkey/templates/headless-svc.yaml
asserts: asserts:
- containsDocument: - containsDocument:
kind: Service kind: Service
apiVersion: v1 apiVersion: v1
name: gitea-unittests-redis-headless name: gitea-unittests-valkey-headless
namespace: testing namespace: testing
- documentIndex: 0 - documentIndex: 0
contains: contains:
@ -43,10 +43,10 @@ tests:
name: tcp-redis name: tcp-redis
port: 6379 port: 6379
targetPort: redis targetPort: redis
- it: "[gitea] waits for redis to be up and running" - it: "[gitea] waits for valkey to be up and running"
template: templates/gitea/init.yaml template: templates/gitea/init.yaml
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
matchRegex: matchRegex:
path: stringData["configure_gitea.sh"] path: stringData["configure_gitea.sh"]
pattern: nc -vz -w2 gitea-unittests-redis-headless.testing.svc.cluster.local 6379 pattern: nc -vz -w2 gitea-unittests-valkey-headless.testing.svc.cluster.local 6379

View File

@ -29,29 +29,29 @@ tests:
path: spec.template.spec.containers[0].image path: spec.template.spec.containers[0].image
# IN CASE OF AN INTENTIONAL MAJOR BUMP, ADJUST THIS TEST # IN CASE OF AN INTENTIONAL MAJOR BUMP, ADJUST THIS TEST
pattern: bitnami/postgresql:17.+$ pattern: bitnami/postgresql:17.+$
- it: "[redis-cluster] ensures we detect major image version upgrades" - it: "[valkey-cluster] ensures we detect major image version upgrades"
template: charts/redis-cluster/templates/redis-statefulset.yaml template: charts/valkey-cluster/templates/valkey-statefulset.yaml
set: set:
redis-cluster: valkey-cluster:
enabled: true enabled: true
redis: valkey:
enabled: false enabled: false
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
matchRegex: matchRegex:
path: spec.template.spec.containers[0].image path: spec.template.spec.containers[0].image
# IN CASE OF AN INTENTIONAL MAJOR BUMP, ADJUST THIS TEST # IN CASE OF AN INTENTIONAL MAJOR BUMP, ADJUST THIS TEST
pattern: bitnami/redis-cluster:7.+$ pattern: bitnami/valkey-cluster:8.+$
- it: "[redis] ensures we detect major image version upgrades" - it: "[valkey] ensures we detect major image version upgrades"
template: charts/redis/templates/master/application.yaml template: charts/valkey/templates/primary/application.yaml
set: set:
redis-cluster: valkey-cluster:
enabled: false enabled: false
redis: valkey:
enabled: true enabled: true
asserts: asserts:
- documentIndex: 0 - documentIndex: 0
matchRegex: matchRegex:
path: spec.template.spec.containers[0].image path: spec.template.spec.containers[0].image
# IN CASE OF AN INTENTIONAL MAJOR BUMP, ADJUST THIS TEST # IN CASE OF AN INTENTIONAL MAJOR BUMP, ADJUST THIS TEST
pattern: bitnami/redis:7.+$ pattern: bitnami/valkey:8.+$

View File

@ -3,12 +3,12 @@ release:
name: gitea-unittests name: gitea-unittests
namespace: testing namespace: testing
tests: tests:
- it: fails when trying to configure redis and redis-cluster the same time - it: fails when trying to configure valkey and valkey-cluster the same time
set: set:
redis-cluster: valkey-cluster:
enabled: true enabled: true
redis: valkey:
enabled: true enabled: true
asserts: asserts:
- failedTemplate: - failedTemplate:
errorMessage: redis and redis-cluster cannot be enabled at the same time. Please only choose one. errorMessage: valkey and valkey-cluster cannot be enabled at the same time. Please only choose one.

View File

@ -509,41 +509,51 @@ gitea:
successThreshold: 1 successThreshold: 1
failureThreshold: 10 failureThreshold: 10
## @section redis-cluster ## @section valkey-cluster
## @param redis-cluster.enabled Enable redis cluster ## @param valkey-cluster.enabled Enable valkey cluster
# ⚠️ The redis charts do not work well with special characters in the password (<https://gitea.com/gitea/helm-gitea/issues/690>). # ⚠️ The valkey charts do not work well with special characters in the password (<https://gitea.com/gitea/helm-chart/issues/690>).
# Consider omitting such or open an issue in the Bitnami repo and let us know once this got fixed. # Consider omitting such or open an issue in the Bitnami repo and let us know once this got fixed.
## @param redis-cluster.usePassword Whether to use password authentication ## @param valkey-cluster.usePassword Whether to use password authentication
## @param redis-cluster.cluster.nodes Number of redis cluster master nodes ## @param valkey-cluster.usePasswordFiles Whether to mount passwords as files instead of environment variables
## @param redis-cluster.cluster.replicas Number of redis cluster master node replicas ## @param valkey-cluster.cluster.nodes Number of valkey cluster master nodes
## @param valkey-cluster.cluster.replicas Number of valkey cluster master node replicas
## @param valkey-cluster.service.ports.valkey Port of Valkey service
## @descriptionStart ## @descriptionStart
## Redis cluster and [Redis](#redis) cannot be enabled at the same time. ## Valkey cluster and [Valkey](#valkey) cannot be enabled at the same time.
## @descriptionEnd ## @descriptionEnd
redis-cluster: valkey-cluster:
enabled: true enabled: true
usePassword: false usePassword: false
usePasswordFiles: false
cluster: cluster:
nodes: 3 # default: 6 nodes: 3 # default: 6
replicas: 0 # default: 1 replicas: 0 # default: 1
service:
ports:
valkey: 6379
## @section redis ## @section valkey
## @param redis.enabled Enable redis standalone or replicated ## @param valkey.enabled Enable valkey standalone or replicated
## @param redis.architecture Whether to use standalone or replication ## @param valkey.architecture Whether to use standalone or replication
# ⚠️ The redis charts do not work well with special characters in the password (<https://gitea.com/gitea/helm-gitea/issues/690>). # ⚠️ The valkey charts do not work well with special characters in the password (<https://gitea.com/gitea/helm-chart/issues/690>).
# Consider omitting such or open an issue in the Bitnami repo and let us know once this got fixed. # Consider omitting such or open an issue in the Bitnami repo and let us know once this got fixed.
## @param redis.global.redis.password Required password ## @param valkey.global.valkey.password Required password
## @param redis.master.count Number of Redis master instances to deploy ## @param valkey.master.count Number of Valkey master instances to deploy
## @param valkey.master.service.ports.valkey Port of Valkey service
## @descriptionStart ## @descriptionStart
## Redis and [Redis cluster](#redis-cluster) cannot be enabled at the same time. ## Valkey and [Valkey cluster](#valkey-cluster) cannot be enabled at the same time.
## @descriptionEnd ## @descriptionEnd
redis: valkey:
enabled: false enabled: false
architecture: standalone architecture: standalone
global: global:
redis: valkey:
password: changeme password: changeme
master: master:
count: 1 count: 1
service:
ports:
valkey: 6379
## @section PostgreSQL HA ## @section PostgreSQL HA
# #