use pascaliske chart for redis
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
# -----------------------------------------------------------------------------
|
||||
# templates/NOTES.txt
|
||||
# -----------------------------------------------------------------------------
|
||||
{{""}}
|
||||
1. Get the application URL by running these commands:
|
||||
export POD0=$(kubectl get pods -l app={{ include "keydb-custom.name" . }} -o jsonpath="{.items[0].metadata.name}")
|
||||
kubectl logs $POD0
|
||||
|
||||
2. To connect via keydb-cli from a pod:
|
||||
kubectl run -it --rm --image=eqalpha/keydb --restart=Never keydb-client -- /bin/sh
|
||||
# inside the pod:
|
||||
keydb-cli -h {{ include "keydb-custom.fullname" . }}-0.{{ include "keydb-custom.fullname" . }}-headless -a "{{ .Values.auth.password }}" PING
|
||||
@@ -1,11 +0,0 @@
|
||||
# -----------------------------------------------------------------------------
|
||||
# templates/_helpers.tpl
|
||||
# -----------------------------------------------------------------------------
|
||||
{{""}}
|
||||
{{- define "keydb-custom.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "keydb-custom.fullname" -}}
|
||||
{{- printf "%s" (include "keydb-custom.name" .) -}}
|
||||
{{- end -}}
|
||||
@@ -1,24 +0,0 @@
|
||||
# -----------------------------------------------------------------------------
|
||||
# templates/configmap.yaml
|
||||
# -----------------------------------------------------------------------------
|
||||
{{""}}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: '{{ include "keydb-custom.fullname" . }}-conf'
|
||||
labels:
|
||||
app: {{ include "keydb-custom.name" . }}
|
||||
data:
|
||||
keydb.conf: |
|
||||
# Minimal keydb.conf generated from values
|
||||
server-threads {{ .Values.keydb.serverThreads }}
|
||||
maxmemory {{ .Values.keydb.maxmemory }}
|
||||
maxmemory-policy {{ .Values.keydb.maxmemoryPolicy }}
|
||||
appendonly {{ .Values.keydb.appendonly }}
|
||||
protected-mode no
|
||||
bind 0.0.0.0
|
||||
port {{ .Values.service.port }}
|
||||
active-replica yes
|
||||
scratch-file-path /tmp/
|
||||
jemalloc-bg-thread no # doesn't work with rpi5 16ko page size instead of classic 4ko size
|
||||
# requirepass is handled via env (not in file)
|
||||
@@ -1,17 +0,0 @@
|
||||
# -----------------------------------------------------------------------------
|
||||
# templates/headless-svc.yaml
|
||||
# -----------------------------------------------------------------------------
|
||||
{{""}}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: '{{ include "keydb-custom.fullname" . }}-headless'
|
||||
labels:
|
||||
app: {{ include "keydb-custom.name" . }}
|
||||
spec:
|
||||
clusterIP: None
|
||||
selector:
|
||||
app: {{ include "keydb-custom.name" . }}
|
||||
ports:
|
||||
- port: {{ .Values.service.port }}
|
||||
name: keydb
|
||||
3
redis/templates/helm-chart-config.yaml
Normal file
3
redis/templates/helm-chart-config.yaml
Normal file
@@ -0,0 +1,3 @@
|
||||
{{- if eq .Values.tool.kind "HelmChart" -}}
|
||||
{{- include "tool.helm-chart-config.tpl" . -}}
|
||||
{{- end -}}
|
||||
3
redis/templates/helm-chart.yaml
Normal file
3
redis/templates/helm-chart.yaml
Normal file
@@ -0,0 +1,3 @@
|
||||
{{- if eq .Values.tool.kind "HelmChart" -}}
|
||||
{{- include "tool.helm-chart.tpl" . -}}
|
||||
{{- end -}}
|
||||
@@ -1,11 +0,0 @@
|
||||
# -----------------------------------------------------------------------------
|
||||
# templates/secret-auth.yaml
|
||||
# -----------------------------------------------------------------------------
|
||||
{{""}}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: '{{ include "keydb-custom.fullname" . }}-auth'
|
||||
type: Opaque
|
||||
stringData:
|
||||
password: "{{ .Values.auth.password }}"
|
||||
@@ -1,135 +0,0 @@
|
||||
# -----------------------------------------------------------------------------
|
||||
# templates/statefulset.yaml
|
||||
# -----------------------------------------------------------------------------
|
||||
{{""}}
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: {{ include "keydb-custom.fullname" . }}
|
||||
labels:
|
||||
app: {{ include "keydb-custom.name" . }}
|
||||
spec:
|
||||
serviceName: {{ include "keydb-custom.fullname" . }}-headless
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
selector:
|
||||
matchLabels:
|
||||
app: {{ include "keydb-custom.name" . }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ include "keydb-custom.name" . }}
|
||||
spec:
|
||||
{{- if .Values.nodeAffinity }}
|
||||
affinity:
|
||||
nodeAffinity: {{ toYaml .Values.nodeAffinity | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.podAntiAffinity.enabled }}
|
||||
affinity:
|
||||
podAntiAffinity:
|
||||
requiredDuringSchedulingIgnoredDuringExecution:
|
||||
- labelSelector:
|
||||
matchExpressions:
|
||||
- key: "app"
|
||||
operator: In
|
||||
values:
|
||||
- {{ include "keydb-custom.name" . }}
|
||||
topologyKey: "kubernetes.io/hostname"
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: keydb
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
ports:
|
||||
- name: keydb
|
||||
containerPort: {{ .Values.service.port }}
|
||||
env:
|
||||
- name: KEYDB_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "keydb-custom.fullname" . }}-auth
|
||||
key: password
|
||||
- name: KEYDB_CONF_FILE
|
||||
value: "/etc/keydb/keydb.conf"
|
||||
volumeMounts:
|
||||
- name: keydb-conf
|
||||
mountPath: /etc/keydb
|
||||
- name: data
|
||||
mountPath: /bitnami/keydb
|
||||
resources:
|
||||
{{ toYaml .Values.resources | nindent 12 }}
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
# Startup logic:
|
||||
# - pod index 0 starts as master
|
||||
# - pod index >0 will start and then configure REPLICAOF to master
|
||||
POD_NAME=$(hostname)
|
||||
# derive ordinal from pods named <release>-<ordinal>
|
||||
ORDINAL=${POD_NAME##*-}
|
||||
# start keydb-server in background to accept CONFIG/CLI commands
|
||||
keydb-server /etc/keydb/keydb.conf &
|
||||
sleep 1
|
||||
if [ "${ORDINAL}" != "0" ]; then
|
||||
# wait for master to be ready
|
||||
MASTER_HOST={{ include "keydb-custom.fullname" . }}-0.{{ include "keydb-custom.fullname" . }}-headless
|
||||
until nc -z ${MASTER_HOST} {{ .Values.service.port }}; do sleep 1; done
|
||||
# configure replication (use CLI to set replicaof)
|
||||
if [ -n "$KEYDB_PASSWORD" ]; then
|
||||
keydb-cli -a "$KEYDB_PASSWORD" REPLICAOF ${MASTER_HOST} {{ .Values.service.port }}
|
||||
else
|
||||
keydb-cli REPLICAOF ${MASTER_HOST} {{ .Values.service.port }}
|
||||
fi
|
||||
echo "Configured replicaof ${MASTER_HOST}:{{ .Values.service.port }}"
|
||||
# tail logs (block) to keep container running
|
||||
wait
|
||||
else
|
||||
# master: block on server process
|
||||
wait
|
||||
fi
|
||||
readinessProbe:
|
||||
{{- if .Values.readinessProbe.enabled }}
|
||||
exec:
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
# quick PING check
|
||||
if [ -n "$KEYDB_PASSWORD" ]; then
|
||||
keydb-cli -a "$KEYDB_PASSWORD" PING > /dev/null 2>&1 && exit 0 || exit 1
|
||||
else
|
||||
keydb-cli PING > /dev/null 2>&1 && exit 0 || exit 1
|
||||
fi
|
||||
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
|
||||
{{- end }}
|
||||
livenessProbe:
|
||||
{{- if .Values.livenessProbe.enabled }}
|
||||
exec:
|
||||
command:
|
||||
- sh
|
||||
- -c
|
||||
- |
|
||||
if [ -n "$KEYDB_PASSWORD" ]; then
|
||||
keydb-cli -a "$KEYDB_PASSWORD" PING > /dev/null 2>&1 && exit 0 || exit 1
|
||||
else
|
||||
keydb-cli PING > /dev/null 2>&1 && exit 0 || exit 1
|
||||
fi
|
||||
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: keydb-conf
|
||||
configMap:
|
||||
name: {{ include "keydb-custom.fullname" . }}-conf
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: data
|
||||
spec:
|
||||
accessModes: {{ toYaml .Values.persistence.accessModes | nindent 8 }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.persistence.size }}
|
||||
storageClassName: "{{ .Values.persistence.storageClass }}"
|
||||
Reference in New Issue
Block a user