{{- if .Values.frontend.enabled }} {{- $apiProxyTarget := .Values.frontend.apiProxyTarget | default (printf "http://%s-api:%v" (include "monitoring-platform.fullname" .) .Values.api.httpPort) }} apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "monitoring-platform.fullname" . }}-frontend labels: {{- include "monitoring-platform.labels" . | nindent 4 }} app.kubernetes.io/component: frontend spec: replicas: {{ .Values.frontend.replicas }} selector: matchLabels: {{- include "monitoring-platform.selectorLabels" . | nindent 6 }} app.kubernetes.io/component: frontend template: metadata: annotations: {{- with .Values.podAnnotations }} {{- toYaml . | nindent 8 }} {{- end }} labels: {{- include "monitoring-platform.selectorLabels" . | nindent 8 }} app.kubernetes.io/component: frontend spec: {{- if .Values.serviceAccount.create }} serviceAccountName: {{ include "monitoring-platform.serviceAccountName" . }} {{- end }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} {{- if .Values.api.enabled }} initContainers: - name: wait-for-api image: busybox:1.36 command: - /bin/sh - -c - | until nc -z {{ include "monitoring-platform.fullname" . }}-api {{ .Values.api.httpPort }}; do echo "Waiting for API..." sleep 2 done {{- end }} containers: - name: frontend image: "{{ .Values.frontend.image.repository }}:{{ .Values.frontend.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.global.imagePullPolicy | default .Values.frontend.image.pullPolicy }} ports: - name: http containerPort: {{ .Values.frontend.httpPort }} protocol: TCP env: - name: NEXT_PUBLIC_API_URL value: "{{ .Values.frontend.apiUrl }}" - name: NEXT_PUBLIC_STATUS_PAGE_URL value: "{{ .Values.frontend.statusPageUrl | default .Values.statusPage.baseUrl }}" - name: API_PROXY_TARGET value: "{{ $apiProxyTarget }}" {{- with .Values.extraEnv }} {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.frontend.extraEnv }} {{- toYaml . | nindent 8 }} {{- end }} livenessProbe: httpGet: path: / port: http initialDelaySeconds: 30 periodSeconds: 10 timeoutSeconds: 3 failureThreshold: 3 readinessProbe: httpGet: path: / port: http initialDelaySeconds: 10 periodSeconds: 5 timeoutSeconds: 3 failureThreshold: 3 resources: {{- toYaml .Values.frontend.resources | nindent 10 }} securityContext: {{- toYaml .Values.securityContext | nindent 10 }} {{- with .Values.frontend.image.pullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} {{- end }}