kind: DaemonSet
apiVersion: apps/v1
metadata:
  name: physics-admission-controller
  namespace: physics-infra
  labels:
    app: physics-admission-controller
  annotations:
    kubernetes.io/description: |
      Launches the admisson controller with PHYSICS webhook that selects the right scheduler and provides the required co-allocation hints.
spec:
  selector:
    matchLabels:
      app: physics-admission-controller
  updateStrategy:
    type: RollingUpdate
  template:
    metadata:
      annotations:
        target.workload.openshift.io/management: '{"effect": "PreferredDuringScheduling"}'
      labels:
        app: physics-admission-controller
        namespace: physics-infra
    spec:
      containers:
      - name: physics-webhook
        image: docker.io/luis5tb/physics-webhook
        command:
        - python
        args:
        - webhook_server.py
        - --bind-address=0.0.0.0
        - --port=6443
        - --tls-private-key-file=/etc/webhook/tls.key
        - --tls-cert-file=/etc/webhook/tls.crt
        - --scheduler-label=physics-scheduler
        volumeMounts:
        - name: webhook-certs
          mountPath: /etc/webhook
          readOnly: True
        imagePullPolicy: Always
        resources:
          requests:
            cpu: 10m
      restartPolicy: Always
      nodeSelector:
        node-role.kubernetes.io/master: ""
      volumes:
      - name: webhook-certs
        secret:
          secretName: physics-admission-controller-secret
      tolerations:
      - key: "node-role.kubernetes.io/master"
        operator: Exists
        effect: NoSchedule
      - key: "node.kubernetes.io/not-ready"
        operator: Exists
        effect: NoSchedule
