Skip to content

Commit

Permalink
Fix review items
Browse files Browse the repository at this point in the history
Signed-off-by: Rafael Rios Saavedra <[email protected]>
  • Loading branch information
rafariossaa committed May 9, 2024
1 parent adfac3d commit 35b724d
Show file tree
Hide file tree
Showing 38 changed files with 398 additions and 422 deletions.
4 changes: 2 additions & 2 deletions .vib/valkey/runtime-parameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ auth:
enabled: true
password: ComplicatedPassword123!4
master:
count: 1
replicaCount: 1
disableCommands:
- FLUSHALL
- FLUSHDB
Expand Down Expand Up @@ -44,4 +44,4 @@ replica:
valkey: 6378
type: ClusterIP
sentinel:
enabled: false
enabled: false
2 changes: 1 addition & 1 deletion bitnami/valkey/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ maintainers:
name: valkey
sources:
- https://github.com/bitnami/charts/tree/main/bitnami/valkey
version: 1.0.0
version: 0.1.0
80 changes: 34 additions & 46 deletions bitnami/valkey/README.md

Large diffs are not rendered by default.

4 changes: 1 addition & 3 deletions bitnami/valkey/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,6 @@ To connect to your database from outside the cluster execute the following comma
{{- end }}
{{- end }}
{{- include "valkey.checkRollingTags" . }}
{{- include "common.warnings.rollingTag" .Values.volumePermissions.image }}
{{- include "common.warnings.rollingTag" .Values.sysctl.image }}
{{- include "valkey.validateValues" . }}

{{- if and (eq .Values.architecture "replication") .Values.sentinel.enabled (eq .Values.sentinel.service.type "NodePort") (not .Release.IsUpgrade ) }}
Expand All @@ -205,7 +203,7 @@ No need to upgrade, ports and nodeports have been set from values
YOU NEED TO PERFORM AN UPGRADE FOR THE SERVICES AND WORKLOAD TO BE CREATED
{{- end }}
{{- end }}
{{- $resourceSections := list "metrics" "replica" "sentinel" "sysctl" "volumePermissions" }}
{{- $resourceSections := list "metrics" "replica" "sentinel" "volumePermissions" }}
{{- if not (and (eq .Values.architecture "replication") .Values.sentinel.enabled) }}
{{- $resourceSections = append $resourceSections "master" -}}
{{- end }}
Expand Down
41 changes: 11 additions & 30 deletions bitnami/valkey/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -40,29 +40,11 @@ Return kubectl image
{{ include "common.images.image" (dict "imageRoot" .Values.kubectl.image "global" .Values.global) }}
{{- end -}}

{{/*
Return sysctl image
*/}}
{{- define "valkey.sysctl.image" -}}
{{ include "common.images.image" (dict "imageRoot" .Values.sysctl.image "global" .Values.global) }}
{{- end -}}

{{/*
Return the proper Docker Image Registry Secret Names
*/}}
{{- define "valkey.imagePullSecrets" -}}
{{- include "common.images.renderPullSecrets" (dict "images" (list .Values.image .Values.sentinel.image .Values.metrics.image .Values.volumePermissions.image .Values.sysctl.image) "context" $) -}}
{{- end -}}

{{/*
Return the appropriate apiVersion for networkpolicy.
*/}}
{{- define "networkPolicy.apiVersion" -}}
{{- if semverCompare ">=1.4-0, <1.7-0" .Capabilities.KubeVersion.GitVersion -}}
{{- print "extensions/v1beta1" -}}
{{- else -}}
{{- print "networking.k8s.io/v1" -}}
{{- end -}}
{{- include "common.images.renderPullSecrets" (dict "images" (list .Values.image .Values.sentinel.image .Values.metrics.image .Values.volumePermissions.image) "context" $) -}}
{{- end -}}

{{/*
Expand All @@ -80,7 +62,7 @@ Return the appropriate apiGroup for PodSecurityPolicy.
Return true if a TLS secret object should be created
*/}}
{{- define "valkey.createTlsSecret" -}}
{{- if and .Values.tls.enabled .Values.tls.autoGenerated (and (not .Values.tls.existingSecret) (not .Values.tls.certificatesSecret)) }}
{{- if and .Values.tls.enabled .Values.tls.autoGenerated (not .Values.tls.existingSecret) }}
{{- true -}}
{{- end -}}
{{- end -}}
Expand All @@ -89,9 +71,8 @@ Return true if a TLS secret object should be created
Return the secret containing Valkey TLS certificates
*/}}
{{- define "valkey.tlsSecretName" -}}
{{- $secretName := coalesce .Values.tls.existingSecret .Values.tls.certificatesSecret -}}
{{- if $secretName -}}
{{- printf "%s" (tpl $secretName $) -}}
{{- if .Values.tls.existingSecret -}}
{{- print .Values.tls.existingSecret -}}
{{- else -}}
{{- printf "%s-crt" (include "common.names.fullname" .) -}}
{{- end -}}
Expand Down Expand Up @@ -185,7 +166,7 @@ Return the configuration configmap name
*/}}
{{- define "valkey.configmapName" -}}
{{- if .Values.existingConfigmap -}}
{{- printf "%s" (tpl .Values.existingConfigmap $) -}}
{{- print (tpl .Values.existingConfigmap $) -}}
{{- else -}}
{{- printf "%s-configuration" (include "common.names.fullname" .) -}}
{{- end -}}
Expand All @@ -205,9 +186,9 @@ Get the password secret.
*/}}
{{- define "valkey.secretName" -}}
{{- if .Values.auth.existingSecret -}}
{{- printf "%s" (tpl .Values.auth.existingSecret $) -}}
{{- print (tpl .Values.auth.existingSecret $) -}}
{{- else -}}
{{- printf "%s" (include "common.names.fullname" .) -}}
{{- print (include "common.names.fullname" .) -}}
{{- end -}}
{{- end -}}

Expand All @@ -216,13 +197,12 @@ Get the password key to be retrieved from Valkey secret.
*/}}
{{- define "valkey.secretPasswordKey" -}}
{{- if and .Values.auth.existingSecret .Values.auth.existingSecretPasswordKey -}}
{{- printf "%s" (tpl .Values.auth.existingSecretPasswordKey $) -}}
{{- print (tpl .Values.auth.existingSecretPasswordKey $) -}}
{{- else -}}
{{- printf "valkey-password" -}}
{{- print "valkey-password" -}}
{{- end -}}
{{- end -}}


{{/*
Returns the available value for certain key in an existing secret (if it exists),
otherwise it generates a random value.
Expand Down Expand Up @@ -257,6 +237,7 @@ Return Valkey password
{{- include "common.warnings.rollingTag" .Values.image }}
{{- include "common.warnings.rollingTag" .Values.sentinel.image }}
{{- include "common.warnings.rollingTag" .Values.metrics.image }}
{{- include "common.warnings.rollingTag" .Values.volumePermissions.image }}
{{- end -}}

{{/*
Expand Down Expand Up @@ -312,7 +293,7 @@ valkey: podSecurityPolicy.create

{{/* Validate values of Valkey - TLS enabled */}}
{{- define "valkey.validateValues.tls" -}}
{{- if and .Values.tls.enabled (not .Values.tls.autoGenerated) (not .Values.tls.existingSecret) (not .Values.tls.certificatesSecret) }}
{{- if and .Values.tls.enabled (not .Values.tls.autoGenerated) (not .Values.tls.existingSecret) }}
valkey: tls.enabled
In order to enable TLS, you also need to provide
an existing secret containing the TLS certificates or
Expand Down
1 change: 1 addition & 0 deletions bitnami/valkey/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ metadata:
name: {{ printf "%s-configuration" (include "common.names.fullname" .) }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: valkey
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
Expand Down
5 changes: 3 additions & 2 deletions bitnami/valkey/templates/headless-svc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ metadata:
name: {{ printf "%s-headless" (include "common.names.fullname" .) }}
namespace: {{ include "common.names.namespace" . | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
app.kubernetes.io/part-of: valkey
{{- if or .Values.sentinel.service.headless.annotations .Values.commonAnnotations (include "valkey.externalDNS.annotations" .) }}
annotations:
{{- if or .Values.sentinel.service.headless.annotations .Values.commonAnnotations }}
Expand All @@ -25,11 +26,11 @@ spec:
{{- end }}
ports:
- name: tcp-valkey
port: {{ if .Values.sentinel.enabled }}{{ .Values.sentinel.service.ports.valkey }}{{ else }}{{ .Values.master.service.ports.valkey }}{{ end }}
port: {{ if .Values.sentinel.enabled }}{{ .Values.sentinel.containerPorts.sentinel }}{{ else }} {{ .Values.master.containerPorts.valkey }}{{ end }}
targetPort: valkey
{{- if .Values.sentinel.enabled }}
- name: tcp-sentinel
port: {{ .Values.sentinel.service.ports.sentinel }}
port: {{ .Values.sentinel.containerPorts.sentinel }}
targetPort: valkey-sentinel
{{- end }}
selector: {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
46 changes: 23 additions & 23 deletions bitnami/valkey/templates/health-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ data:
timeout -s 15 $1 \
valkey-cli \
-h localhost \
{{- if .Values.tls.enabled }}
{{- if .Values.tls.enabled }}
-p $VALKEY_TLS_PORT \
--tls \
--cacert {{ template "valkey.tlsCACert" . }} \
{{- if .Values.tls.authClients }}
{{- if .Values.tls.authClients }}
--cert {{ template "valkey.tlsCert" . }} \
--key {{ template "valkey.tlsCertKey" . }} \
{{- end }}
{{- else }}
{{- end }}
{{- else }}
-p $VALKEY_PORT \
{{- end }}
{{- end }}
ping
)
if [ "$?" -eq "124" ]; then
Expand All @@ -52,17 +52,17 @@ data:
timeout -s 15 $1 \
valkey-cli \
-h localhost \
{{- if .Values.tls.enabled }}
{{- if .Values.tls.enabled }}
-p $VALKEY_TLS_PORT \
--tls \
--cacert {{ template "valkey.tlsCACert" . }} \
{{- if .Values.tls.authClients }}
{{- if .Values.tls.authClients }}
--cert {{ template "valkey.tlsCert" . }} \
--key {{ template "valkey.tlsCertKey" . }} \
{{- end }}
{{- else }}
{{- end }}
{{- else }}
-p $VALKEY_PORT \
{{- end }}
{{- end }}
ping
)
if [ "$?" -eq "124" ]; then
Expand All @@ -78,25 +78,25 @@ data:
ping_sentinel.sh: |-
#!/bin/bash
{{- if .Values.auth.sentinel }}
{{- if .Values.auth.sentinel }}
[[ -f $VALKEY_PASSWORD_FILE ]] && export VALKEY_PASSWORD="$(< "${VALKEY_PASSWORD_FILE}")"
[[ -n "$VALKEY_PASSWORD" ]] && export REDISCLI_AUTH="$VALKEY_PASSWORD"
{{- end }}
{{- end }}
response=$(
timeout -s 15 $1 \
valkey-cli \
-h localhost \
{{- if .Values.tls.enabled }}
{{- if .Values.tls.enabled }}
-p $VALKEY_SENTINEL_TLS_PORT_NUMBER \
--tls \
--cacert "$VALKEY_SENTINEL_TLS_CA_FILE" \
{{- if .Values.tls.authClients }}
{{- if .Values.tls.authClients }}
--cert "$VALKEY_SENTINEL_TLS_CERT_FILE" \
--key "$VALKEY_SENTINEL_TLS_KEY_FILE" \
{{- end }}
{{- else }}
{{- end }}
{{- else }}
-p $VALKEY_SENTINEL_PORT \
{{- end }}
{{- end }}
ping
)
if [ "$?" -eq "124" ]; then
Expand Down Expand Up @@ -133,14 +133,14 @@ data:
valkey-cli \
-h $VALKEY_MASTER_HOST \
-p $VALKEY_MASTER_PORT_NUMBER \
{{- if .Values.tls.enabled }}
{{- if .Values.tls.enabled }}
--tls \
--cacert {{ template "valkey.tlsCACert" . }} \
{{- if .Values.tls.authClients }}
{{- if .Values.tls.authClients }}
--cert {{ template "valkey.tlsCert" . }} \
--key {{ template "valkey.tlsCertKey" . }} \
{{- end }}
{{- end }}
{{- end }}
ping
)
if [ "$?" -eq "124" ]; then
Expand All @@ -161,14 +161,14 @@ data:
valkey-cli \
-h $VALKEY_MASTER_HOST \
-p $VALKEY_MASTER_PORT_NUMBER \
{{- if .Values.tls.enabled }}
{{- if .Values.tls.enabled }}
--tls \
--cacert {{ template "valkey.tlsCACert" . }} \
{{- if .Values.tls.authClients }}
{{- if .Values.tls.authClients }}
--cert {{ template "valkey.tlsCert" . }} \
--key {{ template "valkey.tlsCertKey" . }} \
{{- end }}
{{- end }}
{{- end }}
ping
)
if [ "$?" -eq "124" ]; then
Expand Down
Loading

0 comments on commit 35b724d

Please sign in to comment.