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

apiVersion: apps/v1
kind: Deployment
metadata:
  labels: {{ include "labels.admin" . | nindent 4 }}
  name: "{{ include "name" . }}-admin"
  namespace: {{ .Release.Namespace }}
  {{- if .Values.secrets.infisical.enabled }}
  annotations:
    secrets.infisical.com/auto-reload: "true"
  {{- end }}
spec:
  progressDeadlineSeconds: 600
  replicas: {{ .Values.admin.replicas }}
  revisionHistoryLimit: 10
  selector:
    matchLabels: {{ include "labels.admin" . | nindent 6 }}
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels: {{ include "labels.admin" . | nindent 8 }}
    spec:
      {{- include "dnsConfig" . | nindent 6 }}
      {{- include "image.imagePullSecrets" . | nindent 6 }}
      initContainers: 
        {{ include "initContainerParquetMetadata" . | nindent 8 }}
      containers: {{ include "containerAdmin" . | nindent 8 }}
      nodeSelector: {{ toYaml .Values.admin.nodeSelector | nindent 8 }}
      tolerations: {{ toYaml .Values.admin.tolerations | nindent 8 }}
      volumes:
        {{ include "volumeParquetMetadata" . | nindent 8 }}
      securityContext: {{ include "securityContext" . | nindent 8 }}
