Files
helm-charts/rallly/templates/rallly.deployment.yaml
T
jklein 2de85ea30e Mount an emptyDir for the Next.js cache in rallly (5.0.0+up4.12.3)
The chart mounted no volumes at all while running with
readOnlyRootFilesystem: true, so every Next.js write to
/app/apps/web/.next/cache failed. The image optimizer's failure even
surfaced as an unhandledRejection, so this was more than log noise.

The cache path is now a writable emptyDir; path and an optional
sizeLimit are configurable under rallly.cache. The hardening is
untouched — the pod's existing fsGroup (1000) is what makes the mounted
volume writable for uid 20000.

Verified in a throwaway k3d cluster which paths the app actually writes:
with a fully writable root filesystem and the cache mounted, the only
path the container touches is the cache directory itself. /tmp, $HOME
(=/app) and the rest of the root filesystem stay untouched, so no second
mount is needed.

Also drops the vestigial "capabilities.add: []": Trivy's AVD-KSV-0022 for
rallly (#84) comes from the older chart version deployed in the cluster,
which rendered a null list entry under add:. Reproduced with trivy config
against both renderings; the app needs no capabilities.

Major bump: runtime behavior changes, a volume is added.

Fixes #60
2026-08-23 19:33:06 +02:00

168 lines
6.7 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-{{ .Chart.Name }}-deployment
labels:
app: {{ .Release.Name }}-{{ .Chart.Name }}-deployment
spec:
replicas: {{ include "rallly.replicas" (dict "scaleDown" .Values.scaleDown "replicas" .Values.rallly.replicas) }}
selector:
matchLabels:
app: {{ .Release.Name }}-{{ .Chart.Name }}-deployment
template:
metadata:
name: {{ .Release.Name }}-{{ .Chart.Name }}-deployment
labels:
app: {{ .Release.Name }}-{{ .Chart.Name }}-deployment
spec:
automountServiceAccountToken: false
securityContext:
{{- toYaml .Values.rallly.securityContext.pod | nindent 8 }}
containers:
- name: {{ .Release.Name }}-{{ .Chart.Name }}-deployment
image: "lukevella/rallly:{{ .Chart.AppVersion }}"
imagePullPolicy: IfNotPresent
env:
- name: NEXT_PUBLIC_BASE_URL
value: "https://{{ .Values.ingress.domain }}"
- name: SECRET_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-{{ .Chart.Name }}-secret
key: secret-key
- name: SUPPORT_EMAIL
value: "{{ required "A Support-Email must be provided" .Values.rallly.supportEmail }}"
{{- if .Values.rallly.smtp.enabled }}
- name: NOREPLY_EMAIL
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-{{ .Chart.Name }}-smtp-secret
key: no-reply-email
- name: NOREPLY_EMAIL_NAME
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-{{ .Chart.Name }}-smtp-secret
key: no-reply-email-name
- name: SMTP_HOST
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-{{ .Chart.Name }}-smtp-secret
key: host
- name: SMTP_PORT
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-{{ .Chart.Name }}-smtp-secret
key: port
- name: SMTP_SECURE
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-{{ .Chart.Name }}-smtp-secret
key: secure
- name: SMTP_USER
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-{{ .Chart.Name }}-smtp-secret
key: user
- name: SMTP_PWD
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-{{ .Chart.Name }}-smtp-secret
key: password
- name: SMTP_REJECT_UNAUTHORIZED
value: "{{ .Values.rallly.smtp.rejectUnauthorized }}"
- name: SMTP_TLS_SERVERNAME
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-{{ .Chart.Name }}-smtp-secret
key: tls-servername
{{- end }}
- name: EMAIL_LOGIN_ENABLED
value: "false"
- name: REGISTRATION_ENABLED
value: "false"
- name: OIDC_NAME
value: "{{ .Values.rallly.oidc.name }}"
- name: OIDC_NAME_CLAIM_PATH
value: "{{ .Values.rallly.oidc.nameClaimPath }}"
- name: OIDC_EMAIL_CLAIM_PATH
value: "{{ .Values.rallly.oidc.emailClaimPath }}"
- name: OIDC_PICTURE_CLAIM_PATH
value: "{{ .Values.rallly.oidc.pictureClaimPath }}"
- name: OIDC_DISCOVERY_URL
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-{{ .Chart.Name }}-oidc-secret
key: discovery-url
- name: OIDC_CLIENT_ID
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-{{ .Chart.Name }}-oidc-secret
key: client-id
- name: OIDC_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-{{ .Chart.Name }}-oidc-secret
key: client-secret
- name: ALLOWED_EMAILS
value: "{{ .Values.rallly.allowedEmails }}"
- name: INITIAL_ADMIN_EMAIL
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-{{ .Chart.Name }}-secret
key: initial-admin-email
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-{{ .Chart.Name }}-database-secret
key: database-url
# TODO: Add Storage Configuration
{{- range $value := .Values.rallly.env }}
{{- if $value.value }}
- name: {{ $value.name }}
value: {{ tpl $value.value $ }}
{{- else if $value.valueFrom }}
{{- if $value.valueFrom.secretKeyRef }}
- name: {{ $value.name }}
valueFrom:
secretKeyRef:
name: {{ tpl $value.valueFrom.secretKeyRef.name $ }}
key: {{ tpl $value.valueFrom.secretKeyRef.key $ }}
{{- else if $value.valueFrom.configMapKeyRef }}
- name: {{ $value.name }}
valueFrom:
configMapKeyRef:
name: {{ tpl $value.valueFrom.configMapKeyRef.name $ }}
key: {{ tpl $value.valueFrom.configMapKeyRef.key $ }}
{{- end }}
{{- end }}
{{- end }}
ports:
- containerPort: 3000
protocol: TCP
name: http
livenessProbe:
{{ toYaml .Values.rallly.livenessProbe | nindent 12}}
readinessProbe:
{{ toYaml .Values.rallly.readinessProbe | nindent 12}}
startupProbe:
{{ toYaml .Values.rallly.startupProbe | nindent 12}}
resources:
{{- include "rallly.resources" .Values.rallly.resources | nindent 12 }}
securityContext:
{{- toYaml .Values.rallly.securityContext.container | nindent 12 }}
volumeMounts:
# Next.js writes prerendered pages and optimized images into its
# cache directory; with a read-only root filesystem this must be a
# writable volume (see rallly.cache in values.yaml).
- name: next-cache
mountPath: {{ required "A cache path must be provided (rallly.cache.path)" .Values.rallly.cache.path | quote }}
volumes:
- name: next-cache
{{- if .Values.rallly.cache.sizeLimit }}
emptyDir:
sizeLimit: {{ .Values.rallly.cache.sizeLimit | quote }}
{{- else }}
emptyDir: {}
{{- end }}
restartPolicy: Always