Files
helm-charts/probara/templates/deployment-status-page.yaml
2026-10-18 11:37:02 +03:00

116 lines
4.7 KiB
YAML

{{- if .Values.statusPage.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "monitoring-platform.fullname" . }}-status-page
labels:
{{- include "monitoring-platform.labels" . | nindent 4 }}
app.kubernetes.io/component: status-page
spec:
replicas: {{ .Values.statusPage.replicas }}
selector:
matchLabels:
{{- include "monitoring-platform.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: status-page
template:
metadata:
annotations:
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "monitoring-platform.selectorLabels" . | nindent 8 }}
app.kubernetes.io/component: status-page
spec:
{{- if .Values.serviceAccount.create }}
serviceAccountName: {{ include "monitoring-platform.serviceAccountName" . }}
{{- end }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- if .Values.postgresql.enabled }}
initContainers:
- name: wait-for-postgresql
image: busybox:1.36
command:
- /bin/sh
- -c
- |
until nc -z {{ include "monitoring-platform.postgresHost" . }} 5432; do
echo "Waiting for PostgreSQL..."
sleep 2
done
{{- end }}
containers:
- name: status-page
image: "{{ .Values.image.repository }}-status-page:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.global.imagePullPolicy }}
command: ["./status-page"]
ports:
- name: http
containerPort: {{ .Values.statusPage.httpPort }}
protocol: TCP
- name: metrics
containerPort: {{ .Values.statusPage.metricsPort }}
protocol: TCP
env:
- name: SERVICE_NAME
value: "status-page"
- name: HTTP_PORT
value: "{{ .Values.statusPage.httpPort }}"
- name: METRICS_PORT
value: "{{ .Values.statusPage.metricsPort }}"
- name: LOG_LEVEL
value: "{{ .Values.statusPage.logLevel }}"
{{- include "monitoring-platform.secretEnv" (dict "ctx" . "name" "POSTGRES_URL" "key" "postgres_url" "secret" .Values.postgresql.existingSecret "secretKey" .Values.postgresql.existingSecretKey) | nindent 8 }}
{{- include "monitoring-platform.secretEnv" (dict "ctx" . "name" "NATS_URL" "key" "nats_url" "secret" .Values.nats.existingSecret "secretKey" .Values.nats.existingSecretKey) | nindent 8 }}
{{- if .Values.statusPage.baseUrl }}
- name: STATUS_PAGE_BASE_URL
value: "{{ .Values.statusPage.baseUrl }}"
{{- end }}
{{- if .Values.statusPage.vapid.publicKey }}
# Rendered as a literal on purpose. The VAPID public key is published
# inside every status page as the applicationServerKey, so it is not a
# credential and does not belong in a Secret. Its private half below
# always goes through secretEnv.
- name: STATUS_PAGE_VAPID_PUBLIC_KEY
value: "{{ .Values.statusPage.vapid.publicKey }}"
{{- end }}
{{- if .Values.statusPage.vapid.subject }}
- name: STATUS_PAGE_VAPID_SUBJECT
value: "{{ .Values.statusPage.vapid.subject }}"
{{- end }}
{{- if include "monitoring-platform.hasSecret" (dict "ctx" . "value" .Values.secrets.statusPageVapidPrivateKey "secret" .Values.secrets.statusPageVapidPrivateKeyExistingSecret) }}
{{- include "monitoring-platform.secretEnv" (dict "ctx" . "name" "STATUS_PAGE_VAPID_PRIVATE_KEY" "key" "status_page_vapid_private_key" "secret" .Values.secrets.statusPageVapidPrivateKeyExistingSecret "secretKey" .Values.secrets.statusPageVapidPrivateKeyExistingSecretKey) | nindent 8 }}
{{- end }}
{{- with .Values.extraEnv }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.statusPage.extraEnv }}
{{- toYaml . | nindent 8 }}
{{- end }}
livenessProbe:
httpGet:
path: /healthz
port: http
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 3
failureThreshold: 3
readinessProbe:
httpGet:
path: /readyz
port: http
initialDelaySeconds: 5
periodSeconds: 5
timeoutSeconds: 3
failureThreshold: 3
resources:
{{- toYaml .Values.statusPage.resources | nindent 10 }}
securityContext:
{{- toYaml .Values.securityContext | nindent 10 }}
{{- with .Values.image.pullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}