From 5b9bfdff7df8608f51d96515e2a462a3a57a5895 Mon Sep 17 00:00:00 2001 From: Alexander Olofsson Date: Fri, 3 Jun 2022 11:59:49 +0200 Subject: [PATCH] Fix and upgrade postgres/redis across the line Still need to move all postgres installs onto version 11 of the chart, and ensure redis works with the latest available version as well Replaces: !35 !36 !37 Fixes: #11 #22 --- .../element-web/templates/configuration.yaml | 2 +- charts/funkwhale/Chart.yaml | 6 +-- charts/funkwhale/templates/_helpers.tpl | 18 +++++++-- charts/funkwhale/values.yaml | 11 ++++-- charts/matrix-media-repo/Chart.yaml | 6 +-- .../matrix-media-repo/templates/_helpers.tpl | 37 +++++++------------ .../templates/deployment.yaml | 6 +++ .../matrix-media-repo/templates/secrets.yaml | 18 ++++----- charts/matrix-media-repo/values.yaml | 22 +++++------ charts/matrix-synapse/Chart.yaml | 6 +-- charts/matrix-synapse/templates/_helpers.tpl | 36 +++++++++--------- charts/matrix-synapse/values.yaml | 3 ++ charts/netbox/Chart.yaml | 6 +-- charts/netbox/templates/_helpers.tpl | 12 +++--- 14 files changed, 100 insertions(+), 89 deletions(-) diff --git a/charts/element-web/templates/configuration.yaml b/charts/element-web/templates/configuration.yaml index 04bf8f2..c5fa1da 100644 --- a/charts/element-web/templates/configuration.yaml +++ b/charts/element-web/templates/configuration.yaml @@ -1,4 +1,4 @@ -{{- $m_homeserver := (dict "base_url" (required "Must specify a default homeserver" .Values.defaultServer.url) "server_name" (required "Must specify a default server name" .Values.defaultServer.name)) -}} +{{- $m_homeserver := (dict "base_url" (required "Must specify a defaultServer.url for a homeserver" .Values.defaultServer.url) "server_name" (required "Must specify a defaultServer.name for the homeserver" .Values.defaultServer.name)) -}} {{- $m_identity_server := (dict "base_url" (.Values.defaultServer.identity_url | default "https://vector.im")) -}} {{- $default_server_config := dict "default_server_config" (dict "m.homeserver" $m_homeserver "m.identity_server" $m_identity_server) -}} --- diff --git a/charts/funkwhale/Chart.yaml b/charts/funkwhale/Chart.yaml index 427940f..6c2b79f 100644 --- a/charts/funkwhale/Chart.yaml +++ b/charts/funkwhale/Chart.yaml @@ -4,14 +4,14 @@ appVersion: "1.2.3" description: A social platform to enjoy and share music icon: https://funkwhale.audio/favicon.png name: funkwhale -version: 0.4.7 +version: 0.5.0 dependencies: - name: redis - version: ~10.6.10 + version: ^15.7.0 repository: https://charts.bitnami.com/bitnami condition: redis.enabled - name: postgresql - version: ~10.9.4 + version: ^10.9.4 repository: https://charts.bitnami.com/bitnami condition: postgresql.enabled diff --git a/charts/funkwhale/templates/_helpers.tpl b/charts/funkwhale/templates/_helpers.tpl index 3ab755b..c3e649c 100644 --- a/charts/funkwhale/templates/_helpers.tpl +++ b/charts/funkwhale/templates/_helpers.tpl @@ -6,13 +6,18 @@ Expand the name of the chart. {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} {{- end -}} +{{- define "funkwhale.postgresql.host" -}} +{{- $name := .Values.postgresql.nameOverride | default "postgresql" -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + {{- define "funkwhale.dbUrl" -}} {{- if .Values.database -}} {{ fail "You are using the old database config key - please update your values to the new postgresql config key" }} {{- else if and .Values.postgresql.enabled .Values.postgresql.host -}} {{ fail "Both postgresql.enabled and postgresql.host have been specified - you may want to set postgresql.enabled=false if you want to use an external database" }} {{- else if .Values.postgresql.enabled -}} -postgres://{{ .Values.postgresql.postgresqlUsername }}:{{ .Values.postgresql.postgresqlPassword }}@{{ template "funkwhale.fullname" . }}-postgresql:{{ .Values.postgresql.service.port }}/{{ .Values.postgresql.postgresqlDatabase }} +postgres://{{ .Values.postgresql.postgresqlUsername }}:{{ .Values.postgresql.postgresqlPassword }}@{{ template "funkwhale.postgresql.host" . }}:{{ .Values.postgresql.service.port }}/{{ .Values.postgresql.postgresqlDatabase }} {{- else if .Values.postgresql.host -}} postgres://{{ .Values.postgresql.postgresqlUsername }}:{{ .Values.postgresql.postgresqlPassword }}@{{ .Values.postgresql.host }}:{{ .Values.postgresql.service.port }}/{{ .Values.postgresql.postgresqlDatabase }} {{- else -}} @@ -52,13 +57,18 @@ Create the correct image tag name {{- .Values.image.tag | default .Chart.AppVersion -}} {{- end -}} +{{- define "funkwhale.redis.host" -}} +{{- $name := .Values.redis.nameOverride | default "redis" -}} +{{- printf "%s-%s-%s" .Release.Name $name "master" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + {{- define "funkwhale.redisUrl" -}} {{- if and .Values.redis.enabled .Values.redis.host -}} -{{ fail "Setting both redis.enabled and redis.host will deploy an internal Redis service and attempt to use an external one - please set only one of the two!" }} +{{ fail "Setting both redis.enabled and redis.host would deploy an internal Redis service and attempt to use an external one - please set only one of the two!" }} {{- else if .Values.redis.enabled -}} -redis://:{{ .Values.redis.password }}@{{ template "funkwhale.fullname" . }}-redis-master:{{ .Values.redis.redisPort }}/0 +redis://:{{ .Values.redis.auth.password }}@{{ template "funkwhale.redis.host" . }}:{{ .Values.redis.master.service.port | default 6379 }}/0 {{- else if .Values.redis.host -}} -redis://:{{ .Values.redis.password }}@{{ .Values.redis.host }}:{{ .Values.redis.redisPort }}/0 +redis://:{{ .Values.redis.auth.password }}@{{ .Values.redis.host }}:{{ .Values.redis.master.service.port | default 6379 }}/0 {{- else -}} {{ fail "Either redis.enabled or redis.host are required!" }} {{- end -}} diff --git a/charts/funkwhale/values.yaml b/charts/funkwhale/values.yaml index eab6a4b..f6c7fb3 100644 --- a/charts/funkwhale/values.yaml +++ b/charts/funkwhale/values.yaml @@ -80,14 +80,17 @@ redis: ## External Redis hostname or IP # host: redis.example.com - redisPort: 6379 - password: funkwhale - cluster: - enabled: false + auth: + enabled: true + password: funkwhale + + architecture: standalone master: persistence: enabled: false + service: + port: 6379 slave: persistence: enabled: false diff --git a/charts/matrix-media-repo/Chart.yaml b/charts/matrix-media-repo/Chart.yaml index 49b5050..b873d3f 100644 --- a/charts/matrix-media-repo/Chart.yaml +++ b/charts/matrix-media-repo/Chart.yaml @@ -5,17 +5,17 @@ description: Matrix media repository with multi-domain in mind. appVersion: 1.2.12 type: application -version: 1.0.8 +version: 1.1.0 maintainers: - name: Alexander Olofsson email: ace@haxalot.com dependencies: - name: postgresql - version: ~8.9.4 + version: ^10.9.4 repository: https://charts.bitnami.com/bitnami condition: postgresql.enabled - name: redis - version: ~10.6.10 + version: ^15.7.0 repository: https://charts.bitnami.com/bitnami condition: redis.enabled diff --git a/charts/matrix-media-repo/templates/_helpers.tpl b/charts/matrix-media-repo/templates/_helpers.tpl index f72b395..c427ee3 100644 --- a/charts/matrix-media-repo/templates/_helpers.tpl +++ b/charts/matrix-media-repo/templates/_helpers.tpl @@ -74,7 +74,8 @@ Create a default fully qualified app name. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). */}} {{- define "matrix-media-repo.postgresql.fullname" -}} -{{- printf "%s-%s" .Release.Name "postgresql" | trunc 63 | trimSuffix "-" -}} +{{- $name := .Values.postgresql.nameOverride | default "postgresql" -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} {{- end -}} {{/* @@ -104,11 +105,7 @@ Set postgres port */}} {{- define "matrix-media-repo.postgresql.port" -}} {{- if .Values.postgresql.enabled -}} -{{- if .Values.postgresql.service -}} -{{- default 5432 .Values.postgresql.service.port }} -{{- else -}} -5432 -{{- end -}} +{{- .Values.postgresql.service.port | default 5432 }} {{- else -}} {{- required "A valid externalPostgresql.port is required" .Values.externalPostgresql.port -}} {{- end -}} @@ -119,7 +116,7 @@ Set postgresql username */}} {{- define "matrix-media-repo.postgresql.username" -}} {{- if .Values.postgresql.enabled -}} -{{- default "postgres" .Values.postgresql.postgresqlUsername }} +{{- .Values.postgresql.postgresqlUsername | default "postgres" }} {{- else -}} {{ required "A valid externalPostgresql.username is required" .Values.externalPostgresql.username }} {{- end -}} @@ -130,7 +127,7 @@ Set postgresql password */}} {{- define "matrix-media-repo.postgresql.password" -}} {{- if .Values.postgresql.enabled -}} -{{- default "" .Values.postgresql.postgresqlPassword }} +{{- .Values.postgresql.postgresqlPassword | default "" }} {{- else -}} {{ required "A valid externalPostgresql.password is required" .Values.externalPostgresql.password }} {{- end -}} @@ -141,7 +138,7 @@ Set postgresql database */}} {{- define "matrix-media-repo.postgresql.database" -}} {{- if .Values.postgresql.enabled -}} -{{- default "synapse" .Values.postgresql.postgresqlDatabase }} +{{- .Values.postgresql.postgresqlDatabase | default "synapse" }} {{- else -}} {{ required "A valid externalPostgresql.database is required" .Values.externalPostgresql.database }} {{- end -}} @@ -153,7 +150,8 @@ Create a default fully qualified app name. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). */}} {{- define "matrix-media-repo.redis.fullname" -}} -{{- printf "%s-%s" .Release.Name "redis" | trunc 63 | trimSuffix "-" -}} +{{- $name := .Values.redis.nameOverride | default "redis" -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} {{- end -}} {{/* @@ -161,7 +159,7 @@ Set redis host */}} {{- define "matrix-media-repo.redis.host" -}} {{- if .Values.redis.enabled -}} -{{- template "matrix-media-repo.redis.fullname" . -}}-master +{{- printf "%s-%s" (include "matrix-media-repo.redis.fullname" .) "master" | trunc 63 | trimSuffix "-" -}} {{- else -}} {{ required "A valid externalRedis.host is required" .Values.externalRedis.host }} {{- end -}} @@ -172,7 +170,11 @@ Set redis secret */}} {{- define "matrix-media-repo.redis.secret" -}} {{- if .Values.redis.enabled -}} +{{- if .Values.redis.auth.existingSecret -}} +{{ .Values.redis.auth.existingSecret }} +{{- else -}} {{- template "matrix-media-repo.redis.fullname" . -}} +{{- end -}} {{- else -}} {{- template "matrix-media-repo.fullname" . -}} {{- end -}} @@ -183,23 +185,12 @@ Set redis port */}} {{- define "matrix-media-repo.redis.port" -}} {{- if .Values.redis.enabled -}} -{{- default 6379 .Values.redis.redisPort }} +{{- .Values.redis.master.service.port | default 6379 }} {{- else -}} {{ required "A valid externalRedis.port is required" .Values.externalRedis.port }} {{- end -}} {{- end -}} -{{/* -Set redis password -*/}} -{{- define "matrix-media-repo.redis.user" -}} -{{- if .Values.redis.enabled -}} -{{ .Values.redis.user }} -{{- else if .Values.externalRedis.user -}} -{{ .Values.externalRedis.user }} -{{- end -}} -{{- end -}} - {{/* Set redis password */}} diff --git a/charts/matrix-media-repo/templates/deployment.yaml b/charts/matrix-media-repo/templates/deployment.yaml index 8c94b17..b9ba69a 100644 --- a/charts/matrix-media-repo/templates/deployment.yaml +++ b/charts/matrix-media-repo/templates/deployment.yaml @@ -72,6 +72,9 @@ spec: name: secrets - mountPath: /media name: data + {{- with .Values.extraVolumeMounts }} + {{- . | toYaml | nindent 12 }} + {{- end }} volumes: - name: empty-combined emptyDir: {} @@ -88,6 +91,9 @@ spec: {{- else }} emptyDir: {} {{- end }} + {{- with .Values.extraVolumes }} + {{- . | toYaml | nindent 8 }} + {{- end }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} diff --git a/charts/matrix-media-repo/templates/secrets.yaml b/charts/matrix-media-repo/templates/secrets.yaml index b955646..ecd6608 100644 --- a/charts/matrix-media-repo/templates/secrets.yaml +++ b/charts/matrix-media-repo/templates/secrets.yaml @@ -20,29 +20,27 @@ stringData: databaseNumber: 0 shards: {{- $redisHost := include "matrix-media-repo.redis.host" . }} - {{- $redisPort := include "matrix-media-repo.redis.port" . }} - {{- if .Values.redis.usePassword }} - {{- $redisUser := include "matrix-media-repo.redis.usr" . }} + {{- $redisPort := include "matrix-media-repo.redis.master.service.port" . }} + {{- if .Values.redis.auth.enabled }} {{- $redisPass := include "matrix-media-repo.redis.password" . }} - name: k8s - addr: "redis://{{ $redisUser }}:{{ $redisPass}}@{{ $redisHost }}:{{ $redisPort }}/0" + addr: "redis://:{{ $redisPass }}@{{ $redisHost }}:{{ $redisPort }}/0" {{- else }} - name: k8s - addr: "{{ $redisHost }}:{{ $redisPass }}" + addr: "{{ $redisHost }}:{{ $redisPort }}" {{- end }} {{- else if .Values.externalRedis.host }} - enabled: {{ .Values.externalRedis.host }} + enabled: true databaseNumber: {{ .Values.externalRedis.database | default 0 }} shards: {{- $redisHost := include "matrix-media-repo.redis.host" . }} {{- $redisPort := include "matrix-media-repo.redis.port" . }} -{{- $redisUser := include "matrix-media-repo.redis.usr" . }} {{- $redisPass := include "matrix-media-repo.redis.password" . }} - name: external - {{- if (or $redisUser $redisPass) }} - addr: "redis://{{ $redisUser }}:{{ $redisPass}}@{{ $redisHost }}:{{ $redisPort }}/0" + {{- if $redisPass }} + addr: "redis://:{{ $redisPass}}@{{ $redisHost }}:{{ $redisPort }}/{{ .Values.externalRedis.database | default 0 }}" {{- else }} - addr: {{ .Values.externalRedis.host }}:{{ .Values.externalRedis.port }} + addr: "{{ $redisHost }}:{{ $redisPort }}" {{- end }} {{- else }} enabled: false diff --git a/charts/matrix-media-repo/values.yaml b/charts/matrix-media-repo/values.yaml index 251271b..93ac970 100644 --- a/charts/matrix-media-repo/values.yaml +++ b/charts/matrix-media-repo/values.yaml @@ -54,6 +54,10 @@ config: extraRepo: {} # useForwardedHost: false +extraVolumes: [] + +extraVolumeMounts: [] + ## Per-domain configuration. ## Ref: https://github.com/turt2live/matrix-media-repo/blob/master/docs/config.md ## @@ -103,23 +107,20 @@ externalPostgresql: redis: enabled: false - usePassword: true - # XXX Change me! - password: media-repo + auth: + enabled: true + # XXX Change me! + password: media-repo - ## Or use existing secret with "redis-password" key - ## instead of static password - ## - # existingSecret: redis-secret - - cluster: - enabled: false + architecture: standalone master: persistence: ## Note that Synapse only uses redis as a synchronization utility, so no ## data will ever need to be persisted. ## enabled: false + service: + port: 6379 statefulset: updateStrategy: RollingUpdate @@ -128,7 +129,6 @@ redis: externalRedis: # host: redis port: 6379 - # user: media-repo # password: media-repo # database: 0 diff --git a/charts/matrix-synapse/Chart.yaml b/charts/matrix-synapse/Chart.yaml index bd078a0..99bb0a8 100644 --- a/charts/matrix-synapse/Chart.yaml +++ b/charts/matrix-synapse/Chart.yaml @@ -6,17 +6,17 @@ icon: https://matrix.org/images/matrix-logo.svg appVersion: 1.60.0 type: application -version: 2.1.39 +version: 2.2.0 maintainers: - name: Alexander Olofsson email: ace@haxalot.com dependencies: - name: postgresql - version: ~8.9.4 + version: ^10.9.4 repository: https://charts.bitnami.com/bitnami condition: postgresql.enabled - name: redis - version: ~16.1.0 + version: ^16.1.0 repository: https://charts.bitnami.com/bitnami condition: redis.enabled diff --git a/charts/matrix-synapse/templates/_helpers.tpl b/charts/matrix-synapse/templates/_helpers.tpl index 2e51789..a2e4df6 100644 --- a/charts/matrix-synapse/templates/_helpers.tpl +++ b/charts/matrix-synapse/templates/_helpers.tpl @@ -3,7 +3,7 @@ Expand the name of the chart. */}} {{- define "matrix-synapse.name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- .Values.nameOverride | default .Chart.Name | trunc 63 | trimSuffix "-" -}} {{- end -}} {{/* @@ -15,7 +15,7 @@ If release name contains chart name it will be used as a full name. {{- if .Values.fullnameOverride -}} {{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} {{- else -}} -{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- $name := .Values.nameOverride | default .Chart.Name -}} {{- if contains $name .Release.Name -}} {{- .Release.Name | trunc 63 | trimSuffix "-" -}} {{- else -}} @@ -108,14 +108,6 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this {{- printf "%s-%s" .Release.Name "postgresql" | trunc 63 | trimSuffix "-" -}} {{- end -}} -{{/* -Create a default fully qualified app name. -We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). -*/}} -{{- define "matrix-synapse.redis.fullname" -}} -{{- printf "%s-%s" .Release.Name "redis" | trunc 63 | trimSuffix "-" -}} -{{- end -}} - {{/* Set postgres host */}} @@ -144,7 +136,7 @@ Set postgres port {{- define "matrix-synapse.postgresql.port" -}} {{- if .Values.postgresql.enabled -}} {{- if .Values.postgresql.service -}} -{{- default 5432 .Values.postgresql.service.port }} +{{- .Values.postgresql.service.port | default 5432 }} {{- else -}} 5432 {{- end -}} @@ -158,7 +150,7 @@ Set postgresql username */}} {{- define "matrix-synapse.postgresql.username" -}} {{- if .Values.postgresql.enabled -}} -{{- default "postgres" .Values.postgresql.postgresqlUsername }} +{{- .Values.postgresql.postgresqlUsername | default "postgres" }} {{- else -}} {{ required "A valid externalPostgresql.username is required" .Values.externalPostgresql.username }} {{- end -}} @@ -169,7 +161,7 @@ Set postgresql password */}} {{- define "matrix-synapse.postgresql.password" -}} {{- if .Values.postgresql.enabled -}} -{{- default "" .Values.postgresql.postgresqlPassword }} +{{- .Values.postgresql.postgresqlPassword | default "" }} {{- else if not (and .Values.externalPostgresql.existingSecret .Values.externalPostgresql.existingSecretPasswordKey) -}} {{ required "A valid externalPostgresql.password is required" .Values.externalPostgresql.password }} {{- end -}} @@ -180,7 +172,7 @@ Set postgresql database */}} {{- define "matrix-synapse.postgresql.database" -}} {{- if .Values.postgresql.enabled -}} -{{- default "synapse" .Values.postgresql.postgresqlDatabase }} +{{- .Values.postgresql.postgresqlDatabase | default "synapse" }} {{- else -}} {{ required "A valid externalPostgresql.database is required" .Values.externalPostgresql.database }} {{- end -}} @@ -191,9 +183,9 @@ Set postgresql sslmode */}} {{- define "matrix-synapse.postgresql.sslmode" -}} {{- if .Values.postgresql.enabled -}} -{{- default "prefer" .Values.postgresql.sslmode }} +{{- .Values.postgresql.sslmode | default "prefer" }} {{- else -}} -{{- default "prefer" .Values.externalPostgresql.sslmode }} +{{- .Values.externalPostgresql.sslmode | default "prefer" }} {{- end -}} {{- end -}} @@ -216,12 +208,20 @@ for a list of options that can be passed. {{- end -}} +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "matrix-synapse.redis.fullname" -}} +{{- printf "%s-%s" .Release.Name "redis" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + {{/* Set redis host */}} {{- define "matrix-synapse.redis.host" -}} {{- if .Values.redis.enabled -}} -{{- template "matrix-synapse.redis.fullname" . -}}-master +{{- printf "%s-%s" (include "matrix-synapse.redis.fullname" .) "master" | trunc 63 | trimSuffix "-" -}} {{- else -}} {{ required "A valid externalRedis.host is required" .Values.externalRedis.host }} {{- end -}} @@ -243,7 +243,7 @@ Set redis port */}} {{- define "matrix-synapse.redis.port" -}} {{- if .Values.redis.enabled -}} -{{- default 6379 .Values.redis.redisPort }} +{{- .Values.redis.master.service.port | default 6379 }} {{- else -}} {{ required "A valid externalRedis.port is required" .Values.externalRedis.port }} {{- end -}} diff --git a/charts/matrix-synapse/values.yaml b/charts/matrix-synapse/values.yaml index c3076e8..410873d 100644 --- a/charts/matrix-synapse/values.yaml +++ b/charts/matrix-synapse/values.yaml @@ -654,6 +654,7 @@ redis: enabled: true auth: + enabled: true # XXX Change me! password: synapse @@ -669,6 +670,8 @@ redis: ## data will ever need to be persisted. ## enabled: false + service: + port: 6379 statefulset: updateStrategy: RollingUpdate diff --git a/charts/netbox/Chart.yaml b/charts/netbox/Chart.yaml index 0c16c7d..251b579 100644 --- a/charts/netbox/Chart.yaml +++ b/charts/netbox/Chart.yaml @@ -10,16 +10,16 @@ icon: https://raw.githubusercontent.com/digitalocean/netbox/develop/netbox/proje appVersion: 3.1.0 type: application -version: 4.1.0 +version: 4.2.0 maintainers: - name: Alexander Olofsson email: ace@haxalot.com dependencies: - name: postgresql - version: '> 8, < 11' + version: ^10.6.0 repository: https://charts.bitnami.com/bitnami condition: postgresql.enabled - name: redis - version: ~15 + version: ^15.7.0 repository: https://charts.bitnami.com/bitnami diff --git a/charts/netbox/templates/_helpers.tpl b/charts/netbox/templates/_helpers.tpl index 8d6c3a6..c369367 100644 --- a/charts/netbox/templates/_helpers.tpl +++ b/charts/netbox/templates/_helpers.tpl @@ -6,10 +6,6 @@ Expand the name of the chart. {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} {{- end -}} -{{- define "netbox.redisHost" -}} -{{ template "netbox.fullname" . }}-redis-master -{{- end -}} - {{/* Create a default fully qualified app name. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). @@ -46,7 +42,7 @@ Get the correct image tag name Get the installed postgresql fullname */}} {{- define "netbox.postgresql.fullname" -}} -{{- $name := default "postgresql" .Values.postgresql.nameOverride -}} +{{- $name := .Values.postgresql.nameOverride | default "postgresql" -}} {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} {{- end -}} @@ -54,6 +50,10 @@ Get the installed postgresql fullname Get the installed redis fullname */}} {{- define "netbox.redis.fullname" -}} -{{- $name := default "redis" .Values.redis.nameOverride -}} +{{- $name := .Values.redis.nameOverride | default "redis" -}} {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} {{- end -}} + +{{- define "netbox.redisHost" -}} +{{- printf "%s-%s" (include "netbox.redis.fullname" .) "master" | trunc 63 | trimSuffix "-" -}} +{{- end -}}