feat(deploy): optional bundled Redis in the Helm chart
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 10m22s
ci / test (pull_request) Successful in 15m16s
ci / build (pull_request) Successful in 15m27s
ci / image (pull_request) Successful in 4m43s
ci / lint (push) Skipped
ci / test (push) Skipped
ci / build (push) Skipped
ci / image (push) Skipped
ci / lint (pull_request) Successful in 10m22s
ci / test (pull_request) Successful in 15m16s
ci / build (pull_request) Successful in 15m27s
ci / image (pull_request) Successful in 4m43s
redis.bundled.enabled adds a single Redis for trying UptimeSebi out, like the bundled TimescaleDB: password generated and kept, append-only file on a volume so sessions and schedules survive restarts, read-only root filesystem, kept with its volume on uninstall and adopted by a reinstall. Your own Redis, directly or through Sentinel, stays the way for production. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017GpWAskjmYtZpuQ5JwYTX3
This commit is contained in:
1 parent
a9de8b8d75
commit
d2b669ae71
6 files changed
+158
-9
No files matched your search
@@ -11,8 +11,8 @@ Console: {{ .Values.publicURL }}
|
||||
|
||||
Checkers and status page servers outside the cluster: create them in the
|
||||
console (Settings -> Regions) and install them with the command shown there.
|
||||
{{- if .Values.database.bundled.enabled }}
|
||||
{{- if or .Values.database.bundled.enabled .Values.redis.bundled.enabled }}
|
||||
|
||||
The bundled database is meant for trying UptimeSebi out: it has no backups
|
||||
and no high availability. Its volume and password are kept on uninstall.
|
||||
The bundled {{ if .Values.database.bundled.enabled }}database{{ end }}{{ if and .Values.database.bundled.enabled .Values.redis.bundled.enabled }} and {{ end }}{{ if .Values.redis.bundled.enabled }}Redis{{ end }} are meant for trying UptimeSebi out: no backups
|
||||
and no high availability. Their volumes and passwords are kept on uninstall.
|
||||
{{- end }}
|
||||
@@ -72,7 +72,7 @@ where $secret is the chart's secret holding values under the last argument.
|
||||
{{- $data := dict -}}
|
||||
{{- if and .Values.secretKeys.value (not .Values.secretKeys.existingSecret) }}{{ $_ := set $data "secret-keys" .Values.secretKeys.value }}{{ end -}}
|
||||
{{- if and .Values.database.url (not .Values.database.existingSecret) (not .Values.database.bundled.enabled) }}{{ $_ := set $data "database-url" .Values.database.url }}{{ end -}}
|
||||
{{- if and .Values.redis.url (not .Values.redis.existingSecret) }}{{ $_ := set $data "redis-url" .Values.redis.url }}{{ end -}}
|
||||
{{- if and .Values.redis.url (not .Values.redis.existingSecret) (not .Values.redis.bundled.enabled) }}{{ $_ := set $data "redis-url" .Values.redis.url }}{{ end -}}
|
||||
{{- if and .Values.redis.sentinel.password (not .Values.redis.sentinel.existingSecret) }}{{ $_ := set $data "redis-sentinel-password" .Values.redis.sentinel.password }}{{ end -}}
|
||||
{{- if and .Values.smtp.url (not .Values.smtp.existingSecret) }}{{ $_ := set $data "smtp-url" .Values.smtp.url }}{{ end -}}
|
||||
{{- if and .Values.checker.token (not .Values.checker.existingSecret) }}{{ $_ := set $data "checker-token" .Values.checker.token }}{{ end -}}
|
||||
@@ -124,7 +124,15 @@ $secret being the chart secret to read values from.
|
||||
{{- else }}
|
||||
{{ include "uptimesebi.secretEnv" (list $secret "UPTIME_DATABASE_URL" .Values.database.existingSecret .Values.database.existingSecretKey "database-url") }}
|
||||
{{- end }}
|
||||
{{- if .Values.redis.sentinel.master }}
|
||||
{{- if .Values.redis.bundled.enabled }}
|
||||
- name: UPTIME_REDIS_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "uptimesebi.fullname" . }}-redis
|
||||
key: password
|
||||
- name: UPTIME_REDIS_URL
|
||||
value: {{ printf "redis://:$(UPTIME_REDIS_PASSWORD)@%s-redis:6379/0" (include "uptimesebi.fullname" .) | quote }}
|
||||
{{- else if .Values.redis.sentinel.master }}
|
||||
- name: UPTIME_REDIS_SENTINEL_MASTER
|
||||
value: {{ .Values.redis.sentinel.master | quote }}
|
||||
- name: UPTIME_REDIS_SENTINEL_ADDRS
|
||||
@@ -139,7 +147,7 @@ $secret being the chart secret to read values from.
|
||||
{{- else if or .Values.redis.url .Values.redis.existingSecret }}
|
||||
{{ include "uptimesebi.secretEnv" (list $secret "UPTIME_REDIS_URL" .Values.redis.existingSecret .Values.redis.existingSecretKey "redis-url") }}
|
||||
{{- else }}
|
||||
{{- fail "set redis.url, redis.existingSecret or redis.sentinel.master: Redis is not bundled" }}
|
||||
{{- fail "set redis.url, redis.existingSecret, redis.sentinel.master or redis.bundled.enabled" }}
|
||||
{{- end }}
|
||||
{{- if or .Values.secretKeys.value .Values.secretKeys.existingSecret }}
|
||||
{{ include "uptimesebi.secretEnv" (list $secret "UPTIME_SECRET_KEYS" .Values.secretKeys.existingSecret .Values.secretKeys.existingSecretKey "secret-keys") }}
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
{{- if .Values.redis.bundled.enabled }}
|
||||
{{- $name := printf "%s-redis" (include "uptimesebi.fullname" .) }}
|
||||
{{- $existing := lookup "v1" "Secret" .Release.Namespace $name }}
|
||||
{{- $password := .Values.redis.bundled.password }}
|
||||
{{- if and (not $password) $existing }}{{ $password = index $existing.data "password" | b64dec }}{{ end }}
|
||||
{{- if not $password }}{{ $password = randAlphaNum 32 }}{{ end }}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ $name }}
|
||||
labels:
|
||||
{{- include "uptimesebi.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: redis
|
||||
annotations:
|
||||
# Uninstalling keeps the password along with the kept volume.
|
||||
helm.sh/resource-policy: keep
|
||||
type: Opaque
|
||||
stringData:
|
||||
password: {{ $password | quote }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ $name }}
|
||||
labels:
|
||||
{{- include "uptimesebi.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: redis
|
||||
spec:
|
||||
selector:
|
||||
{{- include "uptimesebi.selector" (list . "redis") | nindent 4 }}
|
||||
ports:
|
||||
- name: redis
|
||||
port: 6379
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: {{ $name }}
|
||||
labels:
|
||||
{{- include "uptimesebi.labels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: redis
|
||||
spec:
|
||||
serviceName: {{ $name }}
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "uptimesebi.selector" (list . "redis") | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "uptimesebi.selector" (list . "redis") | nindent 8 }}
|
||||
spec:
|
||||
automountServiceAccountToken: false
|
||||
securityContext:
|
||||
runAsNonRoot: true
|
||||
runAsUser: 999
|
||||
runAsGroup: 999
|
||||
fsGroup: 999
|
||||
seccompProfile:
|
||||
type: RuntimeDefault
|
||||
containers:
|
||||
- name: redis
|
||||
image: {{ printf "%s:%s" .Values.redis.bundled.image.repository .Values.redis.bundled.image.tag }}
|
||||
command: [redis-server]
|
||||
args:
|
||||
- --requirepass
|
||||
- $(REDIS_PASSWORD)
|
||||
- --appendonly
|
||||
- {{ ternary "yes" "no" .Values.redis.bundled.persistence.enabled | quote }}
|
||||
- --save
|
||||
- ""
|
||||
env:
|
||||
- name: REDIS_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ $name }}
|
||||
key: password
|
||||
- name: REDISCLI_AUTH
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ $name }}
|
||||
key: password
|
||||
ports:
|
||||
- name: redis
|
||||
containerPort: 6379
|
||||
readinessProbe:
|
||||
exec:
|
||||
command: [redis-cli, ping]
|
||||
periodSeconds: 5
|
||||
livenessProbe:
|
||||
tcpSocket:
|
||||
port: redis
|
||||
periodSeconds: 20
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
readOnlyRootFilesystem: true
|
||||
capabilities:
|
||||
drop: [ALL]
|
||||
resources:
|
||||
{{- toYaml .Values.redis.bundled.resources | nindent 12 }}
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /data
|
||||
{{- if not .Values.redis.bundled.persistence.enabled }}
|
||||
volumes:
|
||||
- name: data
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
{{- if .Values.redis.bundled.persistence.enabled }}
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: data
|
||||
spec:
|
||||
accessModes: [ReadWriteOnce]
|
||||
{{- with .Values.redis.bundled.persistence.storageClass }}
|
||||
storageClassName: {{ . }}
|
||||
{{- end }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.redis.bundled.persistence.size }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -68,7 +68,7 @@ database:
|
||||
resources: {}
|
||||
|
||||
# -- Redis --
|
||||
# Redis is not bundled: point to your own, directly or through Sentinel.
|
||||
# Point to your own Redis, directly or through Sentinel, or bundle one.
|
||||
|
||||
redis:
|
||||
# redis://:password@host:6379/0 or rediss:// for TLS.
|
||||
@@ -82,6 +82,23 @@ redis:
|
||||
password: ""
|
||||
existingSecret: ""
|
||||
existingSecretKey: redis-sentinel-password
|
||||
# A single Redis in the cluster, for trying UptimeSebi out. Without high
|
||||
# availability: for production use your own Redis.
|
||||
bundled:
|
||||
enabled: false
|
||||
image:
|
||||
repository: redis
|
||||
tag: 8-alpine
|
||||
# Generated on install if empty, then kept; letters and digits only,
|
||||
# it goes into a URL.
|
||||
password: ""
|
||||
# Sessions, schedules and rate limits survive restarts on a volume;
|
||||
# without one a restart signs everyone out.
|
||||
persistence:
|
||||
enabled: true
|
||||
size: 1Gi
|
||||
storageClass: ""
|
||||
resources: {}
|
||||
|
||||
# -- Migrations --
|
||||
|
||||
|
||||
Reference in new issue
Block a user