{{- if .Values.scheduler.enabled }} apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "monitoring-platform.fullname" . }}-scheduler labels: {{- include "monitoring-platform.labels" . | nindent 4 }} app.kubernetes.io/component: scheduler spec: replicas: {{ .Values.scheduler.replicas }} selector: matchLabels: {{- include "monitoring-platform.selectorLabels" . | nindent 6 }} app.kubernetes.io/component: scheduler template: metadata: annotations: {{- with .Values.podAnnotations }} {{- toYaml . | nindent 8 }} {{- end }} labels: {{- include "monitoring-platform.selectorLabels" . | nindent 8 }} app.kubernetes.io/component: scheduler 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: scheduler image: "{{ .Values.image.repository }}-scheduler:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.global.imagePullPolicy }} command: ["./scheduler"] ports: - name: metrics containerPort: {{ .Values.scheduler.metricsPort }} protocol: TCP env: - name: SERVICE_NAME value: "scheduler" - name: HTTP_PORT value: "{{ .Values.scheduler.metricsPort }}" - name: METRICS_PORT value: "{{ .Values.scheduler.metricsPort }}" - name: LOG_LEVEL value: "{{ .Values.scheduler.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.scheduler.checkJobStream }}" - name: CHECK_JOB_SUBJECT value: "{{ .Values.scheduler.checkJobSubject }}" - name: SCHEDULE_INTERVAL_SECONDS value: "{{ .Values.scheduler.intervalSeconds }}" - name: RETENTION_CLEANUP_ENABLED value: "{{ .Values.scheduler.retentionCleanupEnabled }}" - name: RETENTION_CLEANUP_HOUR_UTC value: "{{ .Values.scheduler.retentionCleanupHourUTC }}" - name: RETENTION_CLEANUP_BATCH_SIZE value: "{{ .Values.scheduler.retentionCleanupBatchSize }}" - name: RETENTION_CLEANUP_MAX_ROWS_PER_RUN value: "{{ .Values.scheduler.retentionCleanupMaxRowsPerRun }}" {{- if include "monitoring-platform.hasSecret" (dict "ctx" . "value" .Values.secrets.probaraSecretsKey "secret" .Values.secrets.probaraSecretsKeyExistingSecret) }} # The scheduler decrypts encrypted monitor configs at dispatch time and # location credentials in results ingest; without the key those # monitors silently fail to schedule. {{- 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 .Values.extraEnv }} {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.scheduler.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.scheduler.resources | nindent 10 }} securityContext: {{- toYaml .Values.securityContext | nindent 10 }} {{- with .Values.image.pullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} {{- end }}