apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ include "danswer-stack.fullname" . }}-indexing-model
  labels:
    {{- include "danswer-stack.labels" . | nindent 4 }}
spec:
  replicas: 1
  selector:
    matchLabels:
      {{- include "danswer-stack.selectorLabels" . | nindent 6 }}
      {{- if .Values.indexCapability.deploymentLabels }}
      {{- toYaml .Values.indexCapability.deploymentLabels | nindent 6 }}
      {{- end }}
  template:
    metadata:
      {{- with .Values.indexCapability.podAnnotations }}
      annotations:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      labels:
        {{- include "danswer-stack.labels" . | nindent 8 }}
        {{- with .Values.indexCapability.podLabels }}
        {{- toYaml . | nindent 8 }}
        {{- end }}
    spec:
      containers:
      - name: indexing-model-server
        image: danswer/danswer-model-server:latest
        imagePullPolicy: IfNotPresent
        command: [ "uvicorn", "model_server.main:app", "--host", "0.0.0.0", "--port", "9000", "--limit-concurrency", "10" ]
        ports:
        - containerPort: 9000
        envFrom:
          - configMapRef:
              name: {{ .Values.config.envConfigMapName }}
        env:
          - name: INDEXING_ONLY
            value: "{{ default "True" .Values.indexCapability.indexingOnly }}"
          {{- include "danswer-stack.envSecrets" . | nindent 10}}
        volumeMounts:
        {{- range .Values.indexCapability.volumeMounts }}
        - name: {{ .name }}
          mountPath: {{ .mountPath }}
        {{- end }}
      volumes:
      {{- range .Values.indexCapability.volumes }}
      - name: {{ .name }}
        persistentVolumeClaim:
          claimName: {{ .persistentVolumeClaim.claimName }}
      {{- end }}
