mirror of
https://github.com/shadoll/helm-charts.git
synced 2026-11-26 19:30:47 +00:00
125 lines
4.7 KiB
YAML
125 lines
4.7 KiB
YAML
{{- if .Values.worker.enabled }}
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: {{ include "monitoring-platform.fullname" . }}-worker
|
|
labels:
|
|
{{- include "monitoring-platform.labels" . | nindent 4 }}
|
|
app.kubernetes.io/component: worker
|
|
spec:
|
|
replicas: {{ .Values.worker.replicas }}
|
|
selector:
|
|
matchLabels:
|
|
{{- include "monitoring-platform.selectorLabels" . | nindent 6 }}
|
|
app.kubernetes.io/component: worker
|
|
template:
|
|
metadata:
|
|
annotations:
|
|
{{- with .Values.podAnnotations }}
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
labels:
|
|
{{- include "monitoring-platform.selectorLabels" . | nindent 8 }}
|
|
app.kubernetes.io/component: worker
|
|
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: worker
|
|
image: "{{ .Values.image.repository }}-worker:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
|
imagePullPolicy: {{ .Values.global.imagePullPolicy }}
|
|
command: ["./worker"]
|
|
ports:
|
|
- name: metrics
|
|
containerPort: {{ .Values.worker.metricsPort }}
|
|
protocol: TCP
|
|
- name: http
|
|
containerPort: {{ .Values.worker.httpPort }}
|
|
protocol: TCP
|
|
env:
|
|
- name: SERVICE_NAME
|
|
value: "worker"
|
|
- name: HTTP_PORT
|
|
value: "{{ .Values.worker.httpPort }}"
|
|
- name: METRICS_PORT
|
|
value: "{{ .Values.worker.metricsPort }}"
|
|
- name: LOG_LEVEL
|
|
value: "{{ .Values.worker.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 }}
|
|
- name: CHECK_JOB_STREAM
|
|
value: "{{ .Values.worker.checkJobStream }}"
|
|
- name: CHECK_JOB_SUBJECT
|
|
value: "{{ .Values.worker.checkJobSubject }}"
|
|
- name: NATS_CONSUMER_NAME
|
|
value: "{{ .Values.worker.consumerName }}"
|
|
- name: WORKER_CONCURRENCY
|
|
value: "{{ .Values.worker.concurrency }}"
|
|
{{- 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.worker.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.worker.resources | nindent 10 }}
|
|
securityContext:
|
|
{{- toYaml .Values.securityContext | nindent 10 }}
|
|
{{- with .Values.image.pullSecrets }}
|
|
imagePullSecrets:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- end }}
|