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

@ -3,12 +3,12 @@ release:
name: gitea-unittests
namespace: testing
tests:
- it: "cache is configured correctly for redis-cluster"
- it: "cache is configured correctly for valkey-cluster"
template: templates/gitea/config.yaml
set:
redis-cluster:
valkey-cluster:
enabled: true
redis:
valkey:
enabled: false
asserts:
- documentIndex: 0
@ -16,14 +16,14 @@ tests:
path: stringData.cache
value: |-
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
set:
redis-cluster:
valkey-cluster:
enabled: false
redis:
valkey:
enabled: true
asserts:
- documentIndex: 0
@ -31,14 +31,14 @@ tests:
path: stringData.cache
value: |-
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
set:
redis-cluster:
valkey-cluster:
enabled: false
redis:
valkey:
enabled: false
asserts:
- documentIndex: 0
@ -48,12 +48,12 @@ tests:
ADAPTER=memory
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
set:
redis-cluster:
valkey-cluster:
enabled: false
redis:
valkey:
enabled: false
gitea.config.cache.ADAPTER: custom-adapter
gitea.config.cache.HOST: custom-host

View File

@ -3,42 +3,42 @@ release:
name: gitea-unittests
namespace: testing
tests:
- it: "queue is configured correctly for redis-cluster"
- it: "queue is configured correctly for valkey-cluster"
template: templates/gitea/config.yaml
set:
redis-cluster:
valkey-cluster:
enabled: true
redis:
valkey:
enabled: false
asserts:
- documentIndex: 0
equal:
path: stringData.queue
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
- it: "queue is configured correctly for redis"
- it: "queue is configured correctly for valkey"
template: templates/gitea/config.yaml
set:
redis-cluster:
valkey-cluster:
enabled: false
redis:
valkey:
enabled: true
asserts:
- documentIndex: 0
equal:
path: stringData.queue
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
- 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
set:
redis-cluster:
valkey-cluster:
enabled: false
redis:
valkey:
enabled: false
asserts:
- documentIndex: 0
@ -48,12 +48,12 @@ tests:
CONN_STR=
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
set:
redis-cluster:
valkey-cluster:
enabled: false
redis:
valkey:
enabled: false
gitea.config.queue.TYPE: custom-type
gitea.config.queue.CONN_STR: custom-connection-string

View File

@ -3,12 +3,12 @@ release:
name: gitea-unittests
namespace: testing
tests:
- it: "session is configured correctly for redis-cluster"
- it: "session is configured correctly for valkey-cluster"
template: templates/gitea/config.yaml
set:
redis-cluster:
valkey-cluster:
enabled: true
redis:
valkey:
enabled: false
asserts:
- documentIndex: 0
@ -16,14 +16,14 @@ tests:
path: stringData.session
value: |-
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
set:
redis-cluster:
valkey-cluster:
enabled: false
redis:
valkey:
enabled: true
asserts:
- documentIndex: 0
@ -31,14 +31,14 @@ tests:
path: stringData.session
value: |-
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
set:
redis-cluster:
valkey-cluster:
enabled: false
redis:
valkey:
enabled: false
asserts:
- documentIndex: 0
@ -48,12 +48,12 @@ tests:
PROVIDER=memory
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
set:
redis-cluster:
valkey-cluster:
enabled: false
redis:
valkey:
enabled: false
gitea.config.session.PROVIDER: custom-provider
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:
name: gitea-unittests
namespace: testing
set:
redis:
valkey:
enabled: false
redis-cluster:
valkey-cluster:
enabled: true
usePassword: false
cluster:
nodes: 5
replicas: 2
tests:
- it: "[redis-cluster] configures correct nodes/replicas"
template: charts/redis-cluster/templates/redis-statefulset.yaml
- it: "[valkey-cluster] configures correct nodes/replicas"
template: charts/valkey-cluster/templates/valkey-statefulset.yaml
asserts:
- documentIndex: 0
equal:
@ -22,31 +22,31 @@ tests:
- documentIndex: 0
matchRegex:
path: spec.template.spec.containers[0].args[0]
pattern: REDIS_CLUSTER_REPLICAS="2"
- it: "[redis-cluster] support auth-less connections"
pattern: VALKEY_CLUSTER_REPLICAS="2"
- it: "[valkey-cluster] support auth-less connections"
asserts:
- template: charts/redis-cluster/templates/secret.yaml
- template: charts/valkey-cluster/templates/secret.yaml
hasDocuments:
count: 0
- template: charts/redis-cluster/templates/redis-statefulset.yaml
- template: charts/valkey-cluster/templates/valkey-statefulset.yaml
documentIndex: 0
contains:
path: spec.template.spec.containers[0].env
content:
name: ALLOW_EMPTY_PASSWORD
value: "yes"
- it: "[redis-cluster] support auth-full connections"
- it: "[valkey-cluster] support auth-full connections"
set:
redis-cluster:
valkey-cluster:
usePassword: true
asserts:
- template: charts/redis-cluster/templates/secret.yaml
- template: charts/valkey-cluster/templates/secret.yaml
containsDocument:
kind: Secret
apiVersion: v1
name: gitea-unittests-redis-cluster
name: gitea-unittests-valkey-cluster
namespace: testing
- template: charts/redis-cluster/templates/redis-statefulset.yaml
- template: charts/valkey-cluster/templates/valkey-statefulset.yaml
documentIndex: 0
contains:
path: spec.template.spec.containers[0].env
@ -54,25 +54,25 @@ tests:
name: REDISCLI_AUTH
valueFrom:
secretKeyRef:
name: gitea-unittests-redis-cluster
key: redis-password
- template: charts/redis-cluster/templates/redis-statefulset.yaml
name: gitea-unittests-valkey-cluster
key: valkey-password
- template: charts/valkey-cluster/templates/valkey-statefulset.yaml
documentIndex: 0
contains:
path: spec.template.spec.containers[0].env
content:
name: REDIS_PASSWORD
name: REDISCLI_AUTH
valueFrom:
secretKeyRef:
name: gitea-unittests-redis-cluster
key: redis-password
- it: "[redis-cluster] renders the referenced service"
template: charts/redis-cluster/templates/headless-svc.yaml
name: gitea-unittests-valkey-cluster
key: valkey-password
- it: "[valkey-cluster] renders the referenced service"
template: charts/valkey-cluster/templates/headless-svc.yaml
asserts:
- containsDocument:
kind: Service
apiVersion: v1
name: gitea-unittests-redis-cluster-headless
name: gitea-unittests-valkey-cluster-headless
namespace: testing
- documentIndex: 0
contains:
@ -81,10 +81,10 @@ tests:
name: tcp-redis
port: 6379
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
asserts:
- documentIndex: 0
matchRegex:
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:
name: gitea-unittests
namespace: testing
set:
redis-cluster:
valkey-cluster:
enabled: false
redis:
valkey:
enabled: true
architecture: standalone
global:
redis:
valkey:
password: gitea-password
master:
count: 2
tests:
- it: "[redis] configures correct 'master' nodes"
template: charts/redis/templates/master/application.yaml
- it: "[valkey] configures correct 'master' nodes"
template: charts/valkey/templates/primary/application.yaml
asserts:
- documentIndex: 0
equal:
path: spec.replicas
value: 2
- it: "[redis] redis.global.redis.password is applied as expected"
template: charts/redis/templates/secret.yaml
value: 1
- it: "[valkey] valkey.global.valkey.password is applied as expected"
template: charts/valkey/templates/secret.yaml
asserts:
- documentIndex: 0
equal:
path: data["redis-password"]
path: data["valkey-password"]
value: "Z2l0ZWEtcGFzc3dvcmQ="
- it: "[redis] renders the referenced service"
template: charts/redis/templates/headless-svc.yaml
- it: "[valkey] renders the referenced service"
template: charts/valkey/templates/headless-svc.yaml
asserts:
- containsDocument:
kind: Service
apiVersion: v1
name: gitea-unittests-redis-headless
name: gitea-unittests-valkey-headless
namespace: testing
- documentIndex: 0
contains:
@ -43,10 +43,10 @@ tests:
name: tcp-redis
port: 6379
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
asserts:
- documentIndex: 0
matchRegex:
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
# IN CASE OF AN INTENTIONAL MAJOR BUMP, ADJUST THIS TEST
pattern: bitnami/postgresql:17.+$
- it: "[redis-cluster] ensures we detect major image version upgrades"
template: charts/redis-cluster/templates/redis-statefulset.yaml
- it: "[valkey-cluster] ensures we detect major image version upgrades"
template: charts/valkey-cluster/templates/valkey-statefulset.yaml
set:
redis-cluster:
valkey-cluster:
enabled: true
redis:
valkey:
enabled: false
asserts:
- documentIndex: 0
matchRegex:
path: spec.template.spec.containers[0].image
# IN CASE OF AN INTENTIONAL MAJOR BUMP, ADJUST THIS TEST
pattern: bitnami/redis-cluster:7.+$
- it: "[redis] ensures we detect major image version upgrades"
template: charts/redis/templates/master/application.yaml
pattern: bitnami/valkey-cluster:8.+$
- it: "[valkey] ensures we detect major image version upgrades"
template: charts/valkey/templates/primary/application.yaml
set:
redis-cluster:
valkey-cluster:
enabled: false
redis:
valkey:
enabled: true
asserts:
- documentIndex: 0
matchRegex:
path: spec.template.spec.containers[0].image
# 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
namespace: testing
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:
redis-cluster:
valkey-cluster:
enabled: true
redis:
valkey:
enabled: true
asserts:
- 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.