|
| 1 | +{{- if .Values.worker.enabled }} |
| 2 | +{{- include "sim.validateSecrets" . }} |
| 3 | +apiVersion: apps/v1 |
| 4 | +kind: Deployment |
| 5 | +metadata: |
| 6 | + name: {{ include "sim.fullname" . }}-worker |
| 7 | + namespace: {{ .Release.Namespace }} |
| 8 | + labels: |
| 9 | + {{- include "sim.worker.labels" . | nindent 4 }} |
| 10 | +spec: |
| 11 | + replicas: {{ .Values.worker.replicaCount }} |
| 12 | + selector: |
| 13 | + matchLabels: |
| 14 | + {{- include "sim.worker.selectorLabels" . | nindent 6 }} |
| 15 | + template: |
| 16 | + metadata: |
| 17 | + annotations: |
| 18 | + {{- with .Values.podAnnotations }} |
| 19 | + {{- toYaml . | nindent 8 }} |
| 20 | + {{- end }} |
| 21 | + labels: |
| 22 | + {{- include "sim.worker.selectorLabels" . | nindent 8 }} |
| 23 | + {{- with .Values.podLabels }} |
| 24 | + {{- toYaml . | nindent 8 }} |
| 25 | + {{- end }} |
| 26 | + spec: |
| 27 | + {{- with .Values.global.imagePullSecrets }} |
| 28 | + imagePullSecrets: |
| 29 | + {{- toYaml . | nindent 8 }} |
| 30 | + {{- end }} |
| 31 | + serviceAccountName: {{ include "sim.serviceAccountName" . }} |
| 32 | + {{- include "sim.podSecurityContext" .Values.worker | nindent 6 }} |
| 33 | + {{- include "sim.nodeSelector" .Values.worker | nindent 6 }} |
| 34 | + {{- include "sim.tolerations" .Values | nindent 6 }} |
| 35 | + {{- include "sim.affinity" .Values | nindent 6 }} |
| 36 | + containers: |
| 37 | + - name: worker |
| 38 | + image: {{ include "sim.image" (dict "context" . "image" .Values.worker.image) }} |
| 39 | + imagePullPolicy: {{ .Values.worker.image.pullPolicy }} |
| 40 | + command: ["bun", "apps/sim/dist/worker.cjs"] |
| 41 | + ports: |
| 42 | + - name: health |
| 43 | + containerPort: {{ .Values.worker.healthPort }} |
| 44 | + protocol: TCP |
| 45 | + env: |
| 46 | + - name: DATABASE_URL |
| 47 | + value: {{ include "sim.databaseUrl" . | quote }} |
| 48 | + {{- if .Values.app.env.REDIS_URL }} |
| 49 | + - name: REDIS_URL |
| 50 | + value: {{ .Values.app.env.REDIS_URL | quote }} |
| 51 | + {{- end }} |
| 52 | + - name: WORKER_PORT |
| 53 | + value: {{ .Values.worker.healthPort | quote }} |
| 54 | + {{- if .Values.telemetry.enabled }} |
| 55 | + - name: OTEL_EXPORTER_OTLP_ENDPOINT |
| 56 | + value: "http://{{ include "sim.fullname" . }}-otel-collector:4318" |
| 57 | + - name: OTEL_SERVICE_NAME |
| 58 | + value: sim-worker |
| 59 | + - name: OTEL_SERVICE_VERSION |
| 60 | + value: {{ .Chart.AppVersion | quote }} |
| 61 | + - name: OTEL_RESOURCE_ATTRIBUTES |
| 62 | + value: "service.name=sim-worker,service.version={{ .Chart.AppVersion }},deployment.environment={{ .Values.worker.env.NODE_ENV }}" |
| 63 | + {{- end }} |
| 64 | + {{- range $key, $value := .Values.worker.env }} |
| 65 | + - name: {{ $key }} |
| 66 | + value: {{ $value | quote }} |
| 67 | + {{- end }} |
| 68 | + {{- with .Values.extraEnvVars }} |
| 69 | + {{- toYaml . | nindent 12 }} |
| 70 | + {{- end }} |
| 71 | + envFrom: |
| 72 | + - secretRef: |
| 73 | + name: {{ include "sim.appSecretName" . }} |
| 74 | + {{- if .Values.postgresql.enabled }} |
| 75 | + - secretRef: |
| 76 | + name: {{ include "sim.postgresqlSecretName" . }} |
| 77 | + {{- else if .Values.externalDatabase.enabled }} |
| 78 | + - secretRef: |
| 79 | + name: {{ include "sim.externalDbSecretName" . }} |
| 80 | + {{- end }} |
| 81 | + livenessProbe: |
| 82 | + httpGet: |
| 83 | + path: /health/live |
| 84 | + port: health |
| 85 | + initialDelaySeconds: 10 |
| 86 | + periodSeconds: 30 |
| 87 | + timeoutSeconds: 5 |
| 88 | + failureThreshold: 3 |
| 89 | + readinessProbe: |
| 90 | + httpGet: |
| 91 | + path: /health |
| 92 | + port: health |
| 93 | + initialDelaySeconds: 10 |
| 94 | + periodSeconds: 30 |
| 95 | + timeoutSeconds: 5 |
| 96 | + failureThreshold: 3 |
| 97 | + {{- include "sim.resources" .Values.worker | nindent 10 }} |
| 98 | + {{- include "sim.securityContext" .Values.worker | nindent 10 }} |
| 99 | +{{- end }} |
0 commit comments