apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
  name: ovs-cni-amd64
  namespace: kube-system
  labels:
    tier: node
    app: ovs-cni
spec:
  template:
    metadata:
      labels:
        tier: node
        app: ovs-cni
    spec:
      serviceAccountName: ovs-cni-marker
      hostNetwork: true
      nodeSelector:
        beta.kubernetes.io/arch: amd64
      tolerations:
        - key: node-role.kubernetes.io/master
          operator: Exists
          effect: NoSchedule
      containers:
        - name: ovs-cni-plugin
          image: quay.io/kubevirt/ovs-cni-plugin@sha256:b3ff427b973f9e8622dedc8d469efa646c708d2cf72080a3fd149d1297025b23
          imagePullPolicy: IfNotPresent
          resources:
            requests:
              cpu: "100m"
              memory: "50Mi"
            limits:
              cpu: "100m"
              memory: "50Mi"
          securityContext:
            privileged: true
          volumeMounts:
            - name: cnibin
              mountPath: /host/opt/cni/bin
        - name: ovs-cni-marker
          image: quay.io/kubevirt/ovs-cni-marker@sha256:8b937290a5b140b0307d09e542041dbc76ff038dadc19bfe9ead35cf392a4cda
          imagePullPolicy: IfNotPresent
          securityContext:
            privileged: true
          args:
            - -node-name
            - $(NODE_NAME)
            - -ovs-socket
            - unix:///host/var/run/openvswitch/db.sock
          volumeMounts:
            - name: ovs-var-run
              mountPath: /host/var/run/openvswitch
          env:
            - name: NODE_NAME
              valueFrom:
                fieldRef:
                  fieldPath: spec.nodeName
      volumes:
        - name: cnibin
          hostPath:
            path: /opt/cni/bin
        - name: ovs-var-run
          hostPath:
            path: /var/run/openvswitch
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
  name: ovs-cni-marker-cr
rules:
  - apiGroups:
      - ""
    resources:
      - nodes
      - nodes/status
    verbs:
      - get
      - update
      - patch
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
  name: ovs-cni-marker-crb
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: ovs-cni-marker-cr
subjects:
  - kind: ServiceAccount
    name: ovs-cni-marker
    namespace: kube-system
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: ovs-cni-marker
  namespace: kube-system
