Skip to content

Commit

Permalink
Switch from Redis to Valkey
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoColomb authored Sep 7, 2024
1 parent f6f1f80 commit 8474b13
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 43 deletions.
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.28
repository: oci://registry-1.docker.io/bitnamicharts
condition: postgresql.enabled
- name: redis
version: ^20.0.5
- name: valkey
version: ^0.3.15
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
16 changes: 8 additions & 8 deletions charts/netbox/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ data:
# Post-process certain values
CORS_ORIGIN_REGEX_WHITELIST = [re.compile(r) for r in CORS_ORIGIN_REGEX_WHITELIST]
{{- if and (not .Values.redis.enabled) .Values.tasksRedis.sentinels }}
{{- if and (not .Values.valkey.enabled) .Values.tasksRedis.sentinels }}
REDIS['tasks']['SENTINELS'] = [tuple(x.split(r":")) for x in REDIS['tasks']['SENTINELS']]
{{- end }}
{{- if and (not .Values.redis.enabled) .Values.cachingRedis.sentinels }}
{{- if and (not .Values.valkey.enabled) .Values.cachingRedis.sentinels }}
REDIS['caching']['SENTINELS'] = [tuple(x.split(r":")) for x in REDIS['caching']['SENTINELS']]
{{- end }}
Expand Down Expand Up @@ -177,9 +177,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 @@ -194,9 +194,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 @@ -996,11 +996,11 @@ externalDatabase:
disableServerSideCursors: false
targetSessionAttrs: read-write

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

tasksRedis:
Expand All @@ -1009,37 +1009,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

0 comments on commit 8474b13

Please sign in to comment.