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

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