# SPDX-License-Identifier: Apache-2.0
# Copyright 2022 The HuggingFace Authors.

apiVersion: apps/v1
kind: Deployment
metadata:
  labels: {{ include "labels.api" . | nindent 4 }}
  name: "{{ include "name" . }}-api"
  namespace: {{ .Release.Namespace }}
spec:
  progressDeadlineSeconds: 600
  replicas: {{ .Values.api.replicas }}
  revisionHistoryLimit: 10
  selector:
    matchLabels: {{ include "labels.api" . | nindent 6 }}
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels: {{ include "labels.api" . | nindent 8 }}
    spec:
      {{- include "image.imagePullSecrets" . | nindent 6 }}
      containers: {{ include "containerApi" . | nindent 8 }}
      nodeSelector: {{ toYaml .Values.api.nodeSelector | nindent 8 }}
      tolerations: {{ toYaml .Values.api.tolerations | nindent 8 }}
      volumes: {{ include "volumeData" . | nindent 8 }}
      securityContext: {{ include "securityContext" . | nindent 8 }}
