#
# The Alluxio Open Foundation licenses this work under the Apache License, version 2.0
# (the "License"). You may not use this work except in compliance with the License, which is
# available at www.apache.org/licenses/LICENSE-2.0
#
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied, as more fully set forth in the License.
#
# See the NOTICE file distributed with this work for information regarding copyright ownership.
#

apiVersion: apps/v1
kind: StatefulSet
metadata:
  labels:
    control-plane: webhook-server
    controller-tools.k8s.io: "1.0"
  name: alluxio-webhook
  namespace: alluxio-system
spec:
  replicas: 1
  serviceName: webhook-service
  selector:
    matchLabels:
      control-plane: webhook-server
  template:
    metadata:
      labels:
        control-plane: webhook-server
    spec:
      serviceAccountName: alluxio
      tolerations:
      - operator: Exists
      hostNetwork: true
      containers:
        - command:
            - alluxio-webhook
          args:
            - "--development=true"
          image: alluxio/alluxio-webhook:v0.1.0-6236799
          imagePullPolicy: IfNotPresent
          name: webhook
          ports:
            - containerPort: 9443
              name: webhook-server
              protocol: TCP
            - containerPort: 38081
              name: metrics
              protocol: TCP
#          readinessProbe:
#            tcpSocket:
#              port: 9443
          resources:
             limits:
               cpu: 100m
               memory: 250Mi
             requests:
               cpu: 100m
               memory: 250Mi
          volumeMounts:
            - mountPath: /tmp/cert
              name: cert
              readOnly: true

      volumes:
        - name: cert
          secret:
            defaultMode: 420
            secretName: alluxio-webhook-certs
