kind: ServiceAccount
apiVersion: v1
metadata:
  name: cdi-sa
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: cdi
rules:
- apiGroups: [""]
  resources: ["events"]
  verbs: ["create", "update", "patch"]
- apiGroups: [""]
  resources: ["persistentvolumeclaims"]
  verbs: ["get", "list", "watch", "create", "update", "patch"]
- apiGroups: [""]
  resources: ["pods"]
  verbs: ["get", "list", "watch", "create"]
- apiGroups: [""]
  resources: ["secrets"]
  verbs: ["get", "list", "watch", "create"]
- apiGroups: ["cdi.io"]
  resources: ["datavolumes"]
  verbs: ["get", "list", "watch", "update"]
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
  name: cdi-sa
roleRef:
  kind: ClusterRole
  name: cdi
  apiGroup: rbac.authorization.k8s.io
subjects:
  - kind: ServiceAccount
    name: cdi-sa
    namespace: default  # update accordingly based on the namespace you are deploying in
---
apiVersion: apps/v1beta2
kind: Deployment
metadata:
  name: cdi-deployment
  labels:
    app: containerized-data-importer
spec:
  selector:
    matchLabels:
      app: containerized-data-importer
  replicas: 1
  template:
    metadata:
      labels:
        app: containerized-data-importer
    spec:
      serviceAccountName: cdi-sa
      containers:
      - name: cdi-controller
        image: kubevirt/cdi-controller:v0.5.0
        imagePullPolicy: IfNotPresent
        args: ["-v=1"] # default verbosity; change to 2 or 3 for more detailed logging
---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  labels:
    cdi.io: ""
  name: datavolumes.cdi.io
spec:
  group: cdi.io
  names:
    kind: DataVolume
    plural: datavolumes
    shortNames:
    - dv
    - dvs
    singular: datavolume
  scope: Namespaced
  version: v1alpha1

