apiVersion: apps/v1
kind: Deployment
metadata:
  name: infra-webhook
spec:
  replicas: 1
  selector:
    matchLabels:
      app: infra-webhook
  template:
    metadata:
      labels:
        app: infra-webhook
    spec:
      containers:
        - name: infra-webhook
          args:
            - --zap-devel
            - "false"
          command:
            - /webhook
          env:
            - name: KUBECONFIG
              value: /.kube/config
            - name: AWS_DEFAULT_REGION
              value: us-west-2
            - name: AWS_REGION
              value: us-west-2
          image: 385595570414.dkr.ecr.us-west-2.amazonaws.com/tidbcloud/infra-webhook
          imagePullPolicy: IfNotPresent
          livenessProbe:
            failureThreshold: 3
            httpGet:
              path: /healthz
              port: 8081
              scheme: HTTP
            initialDelaySeconds: 15
            periodSeconds: 20
            successThreshold: 1
            timeoutSeconds: 1
          ports:
            - containerPort: 9443
              name: webhook-server
              protocol: TCP
          readinessProbe:
            failureThreshold: 10
            httpGet:
              path: /readyz
              port: 8081
              scheme: HTTP
            initialDelaySeconds: 5
            periodSeconds: 5
            successThreshold: 1
            timeoutSeconds: 1
          resources:
            limits:
              memory: 500Mi
            requests:
              cpu: 100m
              memory: 100Mi
          volumeMounts:
            - mountPath: /.kube
              name: kubeconfig
            - mountPath: /tmp/k8s-webhook-server/serving-certs
              name: cert
      serviceAccount: infra-webhook
      volumes:
        - name: kubeconfig
          secret:
            defaultMode: 420
            secretName: infra-webhook-infra-kubeconfig # infra apisrever kubeconfig
        - name: cert
          secret:
            defaultMode: 420
            secretName: infra-webhook-cert-v2
