9937ee457d
- Add helm/kubectl binaries and chart directory to backend Dockerfile - Extend Helm templates for MongoDB/MariaDB database support (env vars, probes, ports) - Add Redis and RabbitMQ Helm templates (deployment, service, secret, PVC) - Add generic app-storage PVC and Fluent Bit sidecar with ES authentication - Fix imagePullSecrets in K8s API fallback, prevent secret regeneration on redeploy - Clean up Redis/RabbitMQ/FluentBit resources on app deletion without removing shared secrets - Fix HelmService chartPath resolution for production Docker builds Co-authored-by: Cursor <cursoragent@cursor.com>
109 lines
2.8 KiB
YAML
109 lines
2.8 KiB
YAML
{{- if .Values.redis.enabled }}
|
|
{{- $name := include "cloudhost-app.name" . -}}
|
|
{{- $ns := include "cloudhost-app.namespace" . -}}
|
|
{{- $redisName := printf "%s-redis" $name -}}
|
|
---
|
|
apiVersion: v1
|
|
kind: Secret
|
|
metadata:
|
|
name: {{ $redisName }}-secret
|
|
namespace: {{ $ns }}
|
|
labels:
|
|
app: {{ $redisName }}
|
|
{{- include "cloudhost-app.labels" . | nindent 4 }}
|
|
annotations:
|
|
"helm.sh/resource-policy": keep
|
|
type: Opaque
|
|
data:
|
|
password: {{ randAlphaNum 16 | b64enc | quote }}
|
|
---
|
|
apiVersion: v1
|
|
kind: PersistentVolumeClaim
|
|
metadata:
|
|
name: {{ $redisName }}-data
|
|
namespace: {{ $ns }}
|
|
labels:
|
|
app: {{ $redisName }}
|
|
{{- include "cloudhost-app.labels" . | nindent 4 }}
|
|
annotations:
|
|
"helm.sh/resource-policy": keep
|
|
spec:
|
|
accessModes:
|
|
- ReadWriteOnce
|
|
resources:
|
|
requests:
|
|
storage: {{ .Values.redis.storageSize | default "1Gi" | quote }}
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: {{ $redisName }}
|
|
namespace: {{ $ns }}
|
|
labels:
|
|
app: {{ $redisName }}
|
|
{{- include "cloudhost-app.labels" . | nindent 4 }}
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: {{ $redisName }}
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: {{ $redisName }}
|
|
spec:
|
|
containers:
|
|
- name: redis
|
|
image: {{ printf "redis:%s-alpine" (.Values.redis.version | default "7.2") }}
|
|
args: ["--requirepass", "$(REDIS_PASSWORD)"]
|
|
ports:
|
|
- containerPort: 6379
|
|
env:
|
|
- name: REDIS_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ $redisName }}-secret
|
|
key: password
|
|
volumeMounts:
|
|
- name: redis-data
|
|
mountPath: /data
|
|
resources:
|
|
requests:
|
|
cpu: {{ .Values.redis.resources.cpuRequest | default "50m" | quote }}
|
|
memory: {{ .Values.redis.resources.memoryRequest | default "64Mi" | quote }}
|
|
limits:
|
|
cpu: {{ .Values.redis.resources.cpuLimit | default "200m" | quote }}
|
|
memory: {{ .Values.redis.resources.memoryLimit | default "256Mi" | quote }}
|
|
readinessProbe:
|
|
exec:
|
|
command: ["redis-cli", "ping"]
|
|
initialDelaySeconds: 5
|
|
periodSeconds: 10
|
|
livenessProbe:
|
|
exec:
|
|
command: ["redis-cli", "ping"]
|
|
initialDelaySeconds: 15
|
|
periodSeconds: 20
|
|
volumes:
|
|
- name: redis-data
|
|
persistentVolumeClaim:
|
|
claimName: {{ $redisName }}-data
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: {{ $redisName }}
|
|
namespace: {{ $ns }}
|
|
labels:
|
|
app: {{ $redisName }}
|
|
{{- include "cloudhost-app.labels" . | nindent 4 }}
|
|
spec:
|
|
type: ClusterIP
|
|
selector:
|
|
app: {{ $redisName }}
|
|
ports:
|
|
- port: 6379
|
|
targetPort: 6379
|
|
protocol: TCP
|
|
{{- end }}
|