---
kind: DaemonSet
apiVersion: apps/v1
metadata:
  name: multus-admission-controller
  namespace: openshift-multus
  labels:
    app: multus-admission-controller
  annotations:
    kubernetes.io/description: |
      This daemon set launches the Multus admisson controller component on each node.
    release.openshift.io/version: "{{.ReleaseVersion}}"
    networkoperator.openshift.io/non-critical: ""
spec:
  selector:
    matchLabels:
      app: multus-admission-controller
      namespace: openshift-multus
  updateStrategy:
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: multus-admission-controller
        namespace: openshift-multus
        component: network
        type: infra
        openshift.io/component: network
    spec:
      containers:
      - name: multus-admission-controller
        image: {{.MultusAdmissionControllerImage}}
        command:
        - /usr/bin/webhook
        args:
        - -bind-address=0.0.0.0
        - -port=6443
        - -tls-private-key-file=/etc/webhook/tls.key
        - -tls-cert-file=/etc/webhook/tls.crt
        - -alsologtostderr=true
        - -metrics-listen-address=127.0.0.1:9091
        volumeMounts:
        - name: webhook-certs
          mountPath: /etc/webhook
          readOnly: True
        imagePullPolicy: IfNotPresent
        resources:
          requests:
            cpu: 10m
        ports:
        - name: metrics-port
          containerPort: 9091
      - name: kube-rbac-proxy
        image: {{.KubeRBACProxyImage}}
        args:
        - --logtostderr
        - --secure-listen-address=:8443
        - --tls-cipher-suites=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_RSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256,TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
        - --upstream=http://127.0.0.1:9091/
        - --tls-private-key-file=/etc/webhook/tls.key
        - --tls-cert-file=/etc/webhook/tls.crt
        ports:
        - containerPort: 8443
          name: https
        resources:
          requests:
            cpu: 10m
            memory: 20Mi
        terminationMessagePolicy: FallbackToLogsOnError
        volumeMounts:
        - name: webhook-certs
          mountPath: /etc/webhook
          readOnly: True
      serviceAccountName: multus
      priorityClassName: "system-cluster-critical"
      restartPolicy: Always
      nodeSelector:
        node-role.kubernetes.io/master: ""
      volumes:
      - name: webhook-certs
        secret:
          secretName: multus-admission-controller-secret
      tolerations:
      - key: "node-role.kubernetes.io/master"
        operator: Exists
        effect: NoSchedule
