{{- if .Values.api.enabled }} apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "memora.fullname" . }}-api labels: {{- include "memora.api.labels" . | nindent 4 }} spec: {{- if not .Values.autoscaling.enabled }} replicas: {{ .Values.api.replicaCount }} {{- end }} selector: matchLabels: {{- include "memora.api.selectorLabels" . | nindent 6 }} template: metadata: annotations: checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }} checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }} {{- with .Values.podAnnotations }} {{- toYaml . | nindent 8 }} {{- end }} labels: {{- include "memora.api.selectorLabels" . | nindent 8 }} spec: {{- if .Values.serviceAccount.create }} serviceAccountName: {{ include "memora.serviceAccountName" . }} {{- end }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: - name: api securityContext: {{- toYaml .Values.securityContext | nindent 10 }} image: "{{ .Values.api.image.repository }}:{{ .Values.api.image.tag }}" imagePullPolicy: {{ .Values.api.image.pullPolicy }} ports: - name: http containerPort: {{ .Values.api.service.targetPort }} protocol: TCP env: - name: MEMORA_API_DATABASE_URL value: {{ include "memora.databaseUrl" . | quote }} {{- if not .Values.postgresql.enabled }} - name: POSTGRES_PASSWORD valueFrom: secretKeyRef: name: {{ include "memora.fullname" . }}-secret key: postgres-password {{- end }} - name: MEMORA_API_LLM_PROVIDER valueFrom: configMapKeyRef: name: {{ include "memora.fullname" . }}-config key: llm-provider - name: MEMORA_API_LLM_MODEL valueFrom: configMapKeyRef: name: {{ include "memora.fullname" . }}-config key: llm-model {{- if and .Values.api.secrets (hasKey .Values.api.secrets "MEMORA_API_LLM_API_KEY") }} - name: MEMORA_API_LLM_API_KEY valueFrom: secretKeyRef: name: {{ include "memora.fullname" . }}-secret key: llm-api-key {{- end }} {{- if and .Values.api.secrets (hasKey .Values.api.secrets "MEMORA_API_LLM_BASE_URL") }} - name: MEMORA_API_LLM_BASE_URL valueFrom: secretKeyRef: name: {{ include "memora.fullname" . }}-secret key: llm-base-url {{- end }} livenessProbe: {{- toYaml .Values.api.livenessProbe | nindent 10 }} readinessProbe: {{- toYaml .Values.api.readinessProbe | nindent 10 }} resources: {{- toYaml .Values.api.resources | nindent 10 }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} {{- end }}