apiVersion: apps/v1 kind: Deployment metadata: name: {{ .Release.Name }} labels: app.kubernetes.io/name: {{ .Chart.Name }} app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} app.kubernetes.io/component: worker annotations: version-source: {{ index .Chart.Annotations "version-source" | quote }} version-pattern: {{ index .Chart.Annotations "version-pattern" | quote }} spec: replicas: {{ .Values.replicas }} selector: matchLabels: app: {{ .Release.Name }} template: metadata: labels: app: {{ .Release.Name }} spec: {{- if .Values.hostNetwork }} hostNetwork: true dnsPolicy: ClusterFirstWithHostNet {{- end }} securityContext: fsGroup: 1000 runAsNonRoot: true runAsUser: 1000 {{- with .Values.image.pullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} containers: - name: worker image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} command: ["./worker"] ports: - name: metrics containerPort: {{ .Values.metricsPort }} protocol: TCP - name: http containerPort: {{ .Values.httpPort }} protocol: TCP env: - name: SERVICE_NAME value: worker - name: HTTP_PORT value: {{ .Values.httpPort | quote }} - name: METRICS_PORT value: {{ .Values.metricsPort | quote }} - name: LOG_LEVEL value: {{ .Values.logLevel | quote }} - name: NATS_URL valueFrom: secretKeyRef: name: {{ required "existingSecret is required" .Values.existingSecret }} key: {{ .Values.natsUrlKey }} - name: LOCATION_CREDENTIAL valueFrom: secretKeyRef: name: {{ .Values.existingSecret }} key: {{ .Values.credentialKey }} - name: WORKER_LOCATION_ID value: {{ required "locationId is required" .Values.locationId | quote }} - name: CHECK_JOB_STREAM value: {{ .Values.checkJobStream | quote }} - name: CHECK_JOB_SUBJECT value: {{ .Values.checkJobSubject | quote }} # The scheduler pre-creates this per-location durable consumer. - name: NATS_CONSUMER_NAME value: {{ .Values.consumerName | quote }} - name: WORKER_CONCURRENCY value: {{ .Values.concurrency | quote }} {{- with .Values.extraEnv }} {{- toYaml . | nindent 12 }} {{- 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.resources | nindent 12 }} securityContext: allowPrivilegeEscalation: false capabilities: drop: - ALL readOnlyRootFilesystem: false