apiVersion: apps/v1
kind: Deployment
metadata:
  name: webhook-server
spec:
  replicas: 1
  selector:
    matchLabels:
      app: webhook-server
  template:
    metadata:
      labels:
        app: webhook-server
    spec:
      containers:
        - name: server
          command:
            - /webhook
          args:
            - --zap-devel
            - "false"
          env:
            - name: AWS_DEFAULT_REGION
              value: us-west-2
            - name: AWS_REGION
              value: us-west-2
            - name: KUBECONFIG
              value: /var/run/cp9/dedicated-api/webhook-server.kubeconfig
          image: cp9.local/dedicated-webhook-server:placeholder
          imagePullPolicy: IfNotPresent
          resources:
            limits:
              cpu: 500m
              memory: 500Mi
            requests:
              cpu: 100m
              memory: 100Mi
          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
          volumeMounts:
            - mountPath: /tmp/k8s-webhook-server/serving-certs
              name: cert
            - mountPath: /var/run/cp9/dedicated-api
              name: dedicated-api-kubeconfig
              readOnly: true
      serviceAccountName: webhook-server
      volumes:
        - name: cert
          secret:
            defaultMode: 420
            secretName: webhook-server-cert
        - name: dedicated-api-kubeconfig
          secret:
            secretName: dedicated-api-kubeconfigs
            items:
              - key: webhook-server.kubeconfig
                path: webhook-server.kubeconfig
