apiVersion: apps/v1
kind: Deployment
metadata:
  name: sriov-network-operator
spec:
  replicas: 1
  selector:
    matchLabels:
      name: sriov-network-operator
  updateStrategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 33%
  template:
    metadata:
      labels:
        name: sriov-network-operator
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: node-role.kubernetes.io/master
                operator: Exists
      tolerations:
      - effect: NoSchedule
        key: node-role.kubernetes.io/master
        operator: Exists
      serviceAccountName: sriov-network-operator
      priorityClassName: "system-node-critical"
      containers:
        - name: sriov-network-operator
          # Replace this with the built image name
          image: $SRIOV_NETWORK_OPERATOR_IMAGE
          command:
          - sriov-network-operator
          imagePullPolicy: IfNotPresent
          resources:
            requests:
              cpu: 100m
              memory: 100Mi
          env:
            - name: WATCH_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: SRIOV_CNI_IMAGE
              value: $SRIOV_CNI_IMAGE
            - name: SRIOV_INFINIBAND_CNI_IMAGE
              value: $SRIOV_INFINIBAND_CNI_IMAGE
            - name: SRIOV_DEVICE_PLUGIN_IMAGE
              value: $SRIOV_DEVICE_PLUGIN_IMAGE
            - name: NETWORK_RESOURCES_INJECTOR_IMAGE
              value: $NETWORK_RESOURCES_INJECTOR_IMAGE
            - name: OPERATOR_NAME
              value: sriov-network-operator
            - name: SRIOV_NETWORK_CONFIG_DAEMON_IMAGE
              value: $SRIOV_NETWORK_CONFIG_DAEMON_IMAGE
            - name: SRIOV_NETWORK_WEBHOOK_IMAGE
              value: $SRIOV_NETWORK_WEBHOOK_IMAGE
            - name: RESOURCE_PREFIX
              value: $RESOURCE_PREFIX
            - name: ENABLE_ADMISSION_CONTROLLER
              value: "$ENABLE_ADMISSION_CONTROLLER"
            - name: NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
            - name: POD_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
            - name: RELEASE_VERSION
              value: 4.3.0
            - name: SRIOV_CNI_BIN_PATH
              value: $CNI_BIN_PATH
            - name: CLUSTER_TYPE
              value: $CLUSTER_TYPE
            - name: WEBHOOK_CA_BUNDLE
              value: "$WEBHOOK_CA_BUNDLE"
