{{- if .Values.alerter.enabled }} apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "monitoring-platform.fullname" . }}-alerter labels: {{- include "monitoring-platform.labels" . | nindent 4 }} app.kubernetes.io/component: alerter spec: replicas: {{ .Values.alerter.replicas }} selector: matchLabels: {{- include "monitoring-platform.selectorLabels" . | nindent 6 }} app.kubernetes.io/component: alerter template: metadata: annotations: {{- with .Values.podAnnotations }} {{- toYaml . | nindent 8 }} {{- end }} labels: {{- include "monitoring-platform.selectorLabels" . | nindent 8 }} app.kubernetes.io/component: alerter spec: {{- if .Values.serviceAccount.create }} serviceAccountName: {{ include "monitoring-platform.serviceAccountName" . }} {{- end }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} {{- if or .Values.postgresql.enabled .Values.nats.enabled }} initContainers: {{- if .Values.postgresql.enabled }} - 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 }} {{- if .Values.nats.enabled }} - name: wait-for-nats image: busybox:1.36 command: - /bin/sh - -c - | until nc -z {{ include "monitoring-platform.natsHost" . }} 4222; do echo "Waiting for NATS..." sleep 2 done {{- end }} {{- end }} containers: - name: alerter image: "{{ .Values.image.repository }}-alerter:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.global.imagePullPolicy }} command: ["./alerter"] ports: - name: metrics containerPort: {{ .Values.alerter.metricsPort }} protocol: TCP env: - name: SERVICE_NAME value: "alerter" - name: HTTP_PORT value: "{{ .Values.alerter.metricsPort }}" - name: METRICS_PORT value: "{{ .Values.alerter.metricsPort }}" - name: LOG_LEVEL value: "{{ .Values.alerter.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 include "monitoring-platform.hasSecret" (dict "ctx" . "value" .Values.secrets.probaraSecretsKey "secret" .Values.secrets.probaraSecretsKeyExistingSecret) }} {{- include "monitoring-platform.secretEnv" (dict "ctx" . "name" "PROBARA_SECRETS_KEY" "key" "probara_secrets_key" "secret" .Values.secrets.probaraSecretsKeyExistingSecret "secretKey" .Values.secrets.probaraSecretsKeyExistingSecretKey) | nindent 8 }} {{- end }} {{- with (include "monitoring-platform.smtpEnv" .) }} {{- . | nindent 8 }} {{- end }} {{- with .Values.extraEnv }} {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.alerter.extraEnv }} {{- toYaml . | nindent 8 }} {{- end }} livenessProbe: httpGet: path: /healthz port: metrics initialDelaySeconds: 10 periodSeconds: 10 timeoutSeconds: 3 failureThreshold: 3 readinessProbe: httpGet: path: /readyz port: metrics initialDelaySeconds: 5 periodSeconds: 5 timeoutSeconds: 3 failureThreshold: 3 resources: {{- toYaml .Values.alerter.resources | nindent 10 }} securityContext: {{- toYaml .Values.securityContext | nindent 10 }} {{- with .Values.image.pullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} {{- end }}