apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: longhorn-webhook
  name: longhorn-webhook
  namespace: longhorn-system
spec:
  replicas: 2
  selector:
    matchLabels:
      app: longhorn-webhook
  template:
    metadata:
      labels:
        app: longhorn-webhook
    spec:
      affinity:
        podAntiAffinity:
          preferredDuringSchedulingIgnoredDuringExecution:
          - weight: 1
            podAffinityTerm:
              labelSelector:
                matchExpressions:
                - key: app
                  operator: In
                  values:
                  - longhorn-webhook
              topologyKey: kubernetes.io/hostname
      containers:
      - name: longhorn-webhook
        image: longhornio/longhorn-manager:master-head
        imagePullPolicy: IfNotPresent
        command:
        - longhorn-manager
        - webhook
        - --service-account
        - longhorn-service-account
        ports:
        - containerPort: 9443
          name: webhook
        readinessProbe:
          tcpSocket:
            port: 9443
        env:
        - name: POD_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
#      imagePullSecrets:
#      - name: ""
#      priorityClassName:
#      tolerations:
#      - key: "key"
#        operator: "Equal"
#        value: "value"
#        effect: "NoSchedule"
#      nodeSelector:
#        label-key1: "label-value1"
#        label-key2: "label-value2"
      serviceAccountName: longhorn-service-account
