Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from Redis to Valkey #332

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Always [use an existing Secret](#using-an-existing-secret) and supply all
passwords and secret keys yourself to avoid Helm re-generating any of them for
you.

We recommend setting both `postgresql.enabled` and `redis.enabled` to
We recommend setting both `postgresql.enabled` and `valkey.enabled` to
`false` and using a separate external PostgreSQL and Redis instance. This
de-couples those services from the chart's bundled versions which may have
complex upgrade requirements. A clustered PostgreSQL server (e.g. using Zalando's
Expand Down Expand Up @@ -214,13 +214,13 @@ The following table lists the configurable parameters for this chart and their d
| `externalDatabase.connMaxAge` | The lifetime of a database connection, as an integer of seconds | `300` |
| `externalDatabase.disableServerSideCursors` | Disable the use of server-side cursors transaction pooling | `false` |
| `externalDatabase.targetSessionAttrs` | Determines whether the session must have certain properties | `read-write` |
| `redis.enabled` | Deploy Redis using bundled Bitnami Redis chart | `true` |
| `redis.*` | Values under this key are passed to the bundled Redis chart | n/a |
| `tasksRedis.database` | Redis database number used for NetBox task queue | `0` |
| `tasksRedis.ssl` | Enable SSL when connecting to Redis | `false` |
| `valkey.enabled` | Deploy Valkey using bundled Bitnami Valkey chart | `true` |
| `valkey.*` | Values under this key are passed to the bundled Valkey chart | n/a |
| `tasksRedis.database` | Redis/Valkey database number used for NetBox task queue | `0` |
| `tasksRedis.ssl` | Enable SSL when connecting to Redis/Valkey | `false` |
| `tasksRedis.insecureSkipTlsVerify` | Skip TLS certificate verification when connecting to Redis | `false` |
| `tasksRedis.caCertPath` | Path to CA certificates bundle for Redis (needs mounting manually) | `""` |
| `tasksRedis.host` | Redis host to use when `redis.enabled` is `false` | `"netbox-redis"` |
| `tasksRedis.host` | Redis host to use when `valkey.enabled` is `false` | `"netbox-redis"` |
| `tasksRedis.port` | Port number for external Redis | `6379` |
| `tasksRedis.sentinels` | List of sentinels in `host:port` form (`host` and `port` not used) | `[]` |
| `tasksRedis.sentinelService` | Sentinel master service name | `"netbox-redis"` |
Expand All @@ -233,7 +233,7 @@ The following table lists the configurable parameters for this chart and their d
| `cachingRedis.ssl` | Enable SSL when connecting to Redis | `false` |
| `cachingRedis.insecureSkipTlsVerify` | Skip TLS certificate verification when connecting to Redis | `false` |
| `cachingRedis.caCertPath` | Path to CA certificates bundle for Redis (needs mounting manually) | `""` |
| `cachingRedis.host` | Redis host to use when `redis.enabled` is `false` | `"netbox-redis"` |
| `cachingRedis.host` | Redis host to use when `valkey.enabled` is `false` | `"netbox-redis"` |
| `cachingRedis.port` | Port number for external Redis | `6379` |
| `cachingRedis.sentinels` | List of sentinels in `host:port` form (`host` and `port` not used) | `[]` |
| `cachingRedis.sentinelService` | Sentinel master service name | `"netbox-redis"` |
Expand Down Expand Up @@ -458,7 +458,7 @@ Type: `kubernetes.io/basic-auth`

| Key | Description | Required? |
| -----------------------|---------------------------------------------------------------|---------------------------------------------------------------------------------------------------|
| `redis-password` | Password for the external Redis database (tasks and/or cache) | If `redis.enabled` is `false` |
| `redis-password` | Password for the external Redis database (tasks and/or cache) | If `valkey.enabled` is `false` |

## Authentication
* [Single Sign On](docs/auth.md#configuring-sso)
Expand All @@ -480,7 +480,7 @@ Type: `kubernetes.io/basic-auth`
* NAPALM support has been moved into a plugin since NetBox 3.5, so all NAPALM configuration has been **removed from this chart**.
* Please consult the [NetBox](https://docs.netbox.dev/en/stable/release-notes/) and [netbox-docker](https://github.com/netbox-community/netbox-docker) release notes in case there are any other changes that may affect your configuration.
* The Bitnami [PostgreSQL](https://github.com/bitnami/charts/tree/main/bitnami/postgresql) sub-chart was upgraded from 10.x to 15.x; please read the upstream upgrade notes if you are using the bundled PostgreSQL.
* The Bitnami [Redis](https://github.com/bitnami/charts/tree/main/bitnami/redis) sub-chart was upgraded from 15.x to 20.x; please read the upstream upgrade notes if you are using the bundled Redis.
* The Bitnami [Redis](https://github.com/bitnami/charts/tree/main/bitnami/redis) sub-chart was upgraded from 15.x to 20.x; please read the upstream upgrade notes if you are using the bundled valkey.

### From 3.x to 4.x

Expand All @@ -503,7 +503,7 @@ Type: `kubernetes.io/basic-auth`
### From 1.x to 2.x

If you use an external Redis you will need to update your configuration values
due to the chart reflecting upstream changes in how it uses Redis. There are
due to the chart reflecting upstream changes in how it uses valkey. There are
now separate Redis configuration blocks for webhooks and for caching, though
they can both point at the same Redis instance as long as the database numbers
are different.
Expand Down
8 changes: 4 additions & 4 deletions charts/netbox/Chart.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions charts/netbox/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ dependencies:
version: ^15.5.32
repository: oci://registry-1.docker.io/bitnamicharts
condition: postgresql.enabled
- name: redis
version: ^20.1.3
- name: valkey
version: ^0.3.17
repository: oci://registry-1.docker.io/bitnamicharts
condition: redis.enabled
condition: valkey.enabled
annotations:
artifacthub.io/license: Apache-2.0
artifacthub.io/links: |
Expand Down
28 changes: 14 additions & 14 deletions charts/netbox/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,22 @@ Name of the key in Secret that contains the PostgreSQL password
{{- end }}

{{/*
Name of the Secret that contains the Redis tasks password
Name of the Secret that contains the Valkey tasks password
*/}}
{{- define "netbox.tasksRedis.secret" -}}
{{- if .Values.redis.enabled }}
{{- include "redis.secretName" .Subcharts.redis -}}
{{- if .Values.valkey.enabled }}
{{- include "valkey.secretName" .Subcharts.valkey -}}
{{- else }}
{{- include "common.secrets.name" (dict "existingSecret" .Values.tasksRedis.existingSecretName "defaultNameSuffix" "redis" "context" $) }}
{{- include "common.secrets.name" (dict "existingSecret" .Values.tasksRedis.existingSecretName "defaultNameSuffix" "valkey" "context" $) }}
{{- end }}
{{- end }}

{{/*
Name of the key in Secret that contains the Redis tasks password
Name of the key in Secret that contains the Valkey tasks password
*/}}
{{- define "netbox.tasksRedis.secretKey" -}}
{{- if .Values.redis.enabled -}}
{{- include "redis.secretPasswordKey" .Subcharts.redis -}}
{{- if .Values.valkey.enabled -}}
{{- include "valkey.secretPasswordKey" .Subcharts.valkey -}}
{{- else if .Values.tasksRedis.existingSecretName -}}
{{ .Values.tasksRedis.existingSecretKey }}
{{- else -}}
Expand All @@ -74,22 +74,22 @@ Name of the key in Secret that contains the Redis tasks password
{{- end }}

{{/*
Name of the Secret that contains the Redis cache password
Name of the Secret that contains the Valkey cache password
*/}}
{{- define "netbox.cachingRedis.secret" -}}
{{- if .Values.redis.enabled }}
{{- include "redis.secretName" .Subcharts.redis -}}
{{- if .Values.valkey.enabled }}
{{- include "valkey.secretName" .Subcharts.valkey -}}
{{- else }}
{{- include "common.secrets.name" (dict "existingSecret" .Values.cachingRedis.existingSecretName "defaultNameSuffix" "redis" "context" $) }}
{{- include "common.secrets.name" (dict "existingSecret" .Values.cachingRedis.existingSecretName "defaultNameSuffix" "valkey" "context" $) }}
{{- end }}
{{- end }}

{{/*
Name of the key in Secret that contains the Redis cache password
Name of the key in Secret that contains the Valkey cache password
*/}}
{{- define "netbox.cachingRedis.secretKey" -}}
{{- if .Values.redis.enabled -}}
{{- include "redis.secretPasswordKey" .Subcharts.redis -}}
{{- if .Values.valkey.enabled -}}
{{- include "valkey.secretPasswordKey" .Subcharts.valkey -}}
{{- else if .Values.cachingRedis.existingSecretName -}}
{{ .Values.cachingRedis.existingSecretKey }}
{{- else -}}
Expand Down
12 changes: 6 additions & 6 deletions charts/netbox/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ data:

REDIS:
tasks:
{{- if .Values.redis.enabled }}
HOST: {{ printf "%s-master" (include "common.names.fullname" .Subcharts.redis) | quote }}
PORT: {{ .Values.redis.master.service.ports.redis | int }}
{{- if .Values.valkey.enabled }}
HOST: {{ printf "%s-master" (include "common.names.fullname" .Subcharts.valkey) | quote }}
PORT: {{ .Values.valkey.master.service.ports.valkey | int }}
{{- else if .Values.tasksRedis.sentinels }}
SENTINELS: {{ toJson .Values.tasksRedis.sentinels }}
SENTINEL_SERVICE: {{ .Values.tasksRedis.sentinelService | quote }}
Expand All @@ -132,9 +132,9 @@ data:
INSECURE_SKIP_TLS_VERIFY: {{ toJson .Values.tasksRedis.insecureSkipTlsVerify }}
CA_CERT_PATH: {{ .Values.tasksRedis.caCertPath | quote }}
caching:
{{- if .Values.redis.enabled }}
HOST: {{ printf "%s-master" (include "common.names.fullname" .Subcharts.redis) | quote }}
PORT: {{ .Values.redis.master.service.ports.redis | int }}
{{- if .Values.valkey.enabled }}
HOST: {{ printf "%s-master" (include "common.names.fullname" .Subcharts.valkey) | quote }}
PORT: {{ .Values.valkey.master.service.ports.valkey | int }}
{{- else if .Values.cachingRedis.sentinels }}
SENTINELS: {{ toJson .Values.cachingRedis.sentinels }}
SENTINEL_SERVICE: {{ .Values.cachingRedis.sentinelService | quote }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{{- if not (or .Values.redis.enabled (and .Values.tasksRedis.existingSecretName .Values.cachingRedis.existingSecretName)) -}}
{{- if not (or .Values.valkey.enabled (and .Values.tasksRedis.existingSecretName .Values.cachingRedis.existingSecretName)) -}}
apiVersion: v1
kind: Secret
metadata:
name: {{ include "common.secrets.name" (dict "defaultNameSuffix" "redis" "context" $) }}
name: {{ include "common.secrets.name" (dict "defaultNameSuffix" "valkey" "context" $) }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- if .Values.commonAnnotations }}
Expand Down
24 changes: 12 additions & 12 deletions charts/netbox/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1020,11 +1020,11 @@ externalDatabase:
disableServerSideCursors: false
targetSessionAttrs: read-write

## Redis chart configuration
## https://github.com/bitnami/charts/blob/main/bitnami/redis/values.yaml
## @param redis.enabled Deploy Redis using bundled Bitnami Redis chart
## Valkey chart configuration
## https://github.com/bitnami/charts/blob/main/bitnami/valkey/values.yaml
## @param valkey.enabled Whether to deploy a Valkey server to satisfy the applications database requirements
##
redis:
valkey:
enabled: true

tasksRedis:
Expand All @@ -1033,37 +1033,37 @@ tasksRedis:
insecureSkipTlsVerify: false
caCertPath: ""

# Used only when redis.enabled is false. host and port are not used if
# Used only when valkey.enabled is false. host and port are not used if
# sentinels are given.
host: netbox-redis
host: netbox-valkey
port: 6379
sentinels: []
# - mysentinel:26379
sentinelService: netbox-redis
sentinelService: netbox-valkey
sentinelTimeout: 300
username: ""
password: ""
existingSecretName: ""
existingSecretKey: redis-password
existingSecretKey: valkey-password

cachingRedis:
database: 1
ssl: false
insecureSkipTlsVerify: false
caCertPath: ""

# Used only when redis.enabled is false. host and port are not used if
# Used only when valkey.enabled is false. host and port are not used if
# sentinels are given.
host: netbox-redis
host: netbox-valkey
port: 6379
sentinels: []
# - mysentinel:26379
sentinelService: netbox-redis
sentinelService: netbox-valkey
sentinelTimeout: 300
username: ""
password: ""
existingSecretName: ""
existingSecretKey: redis-password
existingSecretKey: valkey-password

## @section Autoscaling parameters

Expand Down