|
| 1 | +{{- if .Values.csi.enable }} |
| 2 | +apiVersion: storage.k8s.io/v1 |
| 3 | +kind: CSIDriver |
| 4 | +metadata: |
| 5 | + name: csi.kubevirt.io |
| 6 | +spec: |
| 7 | + attachRequired: true |
| 8 | + podInfoOnMount: true |
| 9 | + fsGroupPolicy: ReadWriteOnceWithFSType |
| 10 | +--- |
| 11 | +apiVersion: v1 |
| 12 | +kind: ServiceAccount |
| 13 | +metadata: |
| 14 | + name: kubevirt-csi-controller-sa |
| 15 | + namespace: {{ .Release.Namespace }} |
| 16 | +--- |
| 17 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 18 | +kind: ClusterRole |
| 19 | +metadata: |
| 20 | + name: kubevirt-csi-controller-cr |
| 21 | +rules: |
| 22 | + - apiGroups: [''] |
| 23 | + resources: ['persistentvolumes'] |
| 24 | + verbs: ['create', 'delete', 'get', 'list', 'watch', 'update', 'patch'] |
| 25 | + - apiGroups: [''] |
| 26 | + resources: ['secrets'] |
| 27 | + verbs: ['get', 'list'] |
| 28 | + - apiGroups: [''] |
| 29 | + resources: ['persistentvolumeclaims'] |
| 30 | + verbs: ['get', 'list', 'watch', 'update'] |
| 31 | + - apiGroups: [""] |
| 32 | + resources: ["persistentvolumeclaims/status"] |
| 33 | + verbs: ["update", "patch"] |
| 34 | + - apiGroups: [''] |
| 35 | + resources: ['nodes'] |
| 36 | + verbs: ['get', 'list', 'watch'] |
| 37 | + - apiGroups: ['storage.k8s.io'] |
| 38 | + resources: ['volumeattachments'] |
| 39 | + verbs: ['get', 'list', 'watch', 'update', 'patch'] |
| 40 | + - apiGroups: ['storage.k8s.io'] |
| 41 | + resources: ['storageclasses'] |
| 42 | + verbs: ['get', 'list', 'watch'] |
| 43 | + - apiGroups: ['csi.storage.k8s.io'] |
| 44 | + resources: ['csidrivers'] |
| 45 | + verbs: ['get', 'list', 'watch', 'update', 'create'] |
| 46 | + - apiGroups: [''] |
| 47 | + resources: ['events'] |
| 48 | + verbs: ['list', 'watch', 'create', 'update', 'patch'] |
| 49 | + - apiGroups: ["snapshot.storage.k8s.io"] |
| 50 | + resources: ["volumesnapshotclasses"] |
| 51 | + verbs: ["get", "list", "watch"] |
| 52 | + - apiGroups: ["snapshot.storage.k8s.io"] |
| 53 | + resources: ["volumesnapshotcontents"] |
| 54 | + verbs: ["create", "get", "list", "watch", "update", "delete"] |
| 55 | + - apiGroups: ["snapshot.storage.k8s.io"] |
| 56 | + resources: ["volumesnapshots"] |
| 57 | + verbs: ["get", "list", "watch", "update"] |
| 58 | + - apiGroups: ["snapshot.storage.k8s.io"] |
| 59 | + resources: ["volumesnapshots/status"] |
| 60 | + verbs: ["update"] |
| 61 | + - apiGroups: [ "storage.k8s.io" ] |
| 62 | + resources: [ "volumeattachments/status" ] |
| 63 | + verbs: [ "get", "list", "watch", "update", "patch" ] |
| 64 | + - apiGroups: ["storage.k8s.io"] |
| 65 | + resources: ["csinodes"] |
| 66 | + verbs: ["get", "list", "watch"] |
| 67 | + - apiGroups: ["security.openshift.io"] |
| 68 | + resources: ["securitycontextconstraints"] |
| 69 | + verbs: ["use"] |
| 70 | + resourceNames: ["privileged"] |
| 71 | +--- |
| 72 | +kind: ClusterRoleBinding |
| 73 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 74 | +metadata: |
| 75 | + name: kubevirt-csi-controller-binding |
| 76 | +subjects: |
| 77 | + - kind: ServiceAccount |
| 78 | + name: kubevirt-csi-controller-sa |
| 79 | + namespace: {{ .Release.Namespace }} |
| 80 | +roleRef: |
| 81 | + kind: ClusterRole |
| 82 | + name: kubevirt-csi-controller-cr |
| 83 | + apiGroup: rbac.authorization.k8s.io |
| 84 | +--- |
| 85 | +apiVersion: v1 |
| 86 | +kind: ServiceAccount |
| 87 | +metadata: |
| 88 | + name: kubevirt-csi-node-sa |
| 89 | + namespace: {{ .Release.Namespace }} |
| 90 | +--- |
| 91 | +apiVersion: v1 |
| 92 | +kind: ServiceAccount |
| 93 | +metadata: |
| 94 | + name: kubevirt-csi-snapshot-sa |
| 95 | + namespace: {{ .Release.Namespace }} |
| 96 | +--- |
| 97 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 98 | +kind: ClusterRole |
| 99 | +metadata: |
| 100 | + name: kubevirt-csi-node-cr |
| 101 | +rules: |
| 102 | + - apiGroups: [""] |
| 103 | + resources: ["persistentvolumes"] |
| 104 | + verbs: ["get", "list", "watch", "update", "create", "delete"] |
| 105 | + - apiGroups: [""] |
| 106 | + resources: ["persistentvolumeclaims"] |
| 107 | + verbs: ["get", "list", "watch", "update"] |
| 108 | + - apiGroups: ["storage.k8s.io"] |
| 109 | + resources: ["storageclasses"] |
| 110 | + verbs: ["get", "list", "watch"] |
| 111 | + - apiGroups: [""] |
| 112 | + resources: ["nodes"] |
| 113 | + verbs: ["get", "list", "watch", "update", "patch"] |
| 114 | + - apiGroups: ["csi.storage.k8s.io"] |
| 115 | + resources: ["csinodeinfos"] |
| 116 | + verbs: ["get", "list", "watch"] |
| 117 | + - apiGroups: ["storage.k8s.io"] |
| 118 | + resources: ["csinodes"] |
| 119 | + verbs: ["get", "list", "watch"] |
| 120 | + - apiGroups: ["storage.k8s.io"] |
| 121 | + resources: ["volumeattachments"] |
| 122 | + verbs: ["get", "list", "watch", "update"] |
| 123 | + - apiGroups: ["storage.k8s.io"] |
| 124 | + resources: ["volumeattachments/status"] |
| 125 | + verbs: ["get", "list", "watch", "update", "patch"] |
| 126 | + - apiGroups: [""] |
| 127 | + resources: ["events"] |
| 128 | + verbs: ["list", "watch", "create", "update", "patch"] |
| 129 | + - apiGroups: ["security.openshift.io"] |
| 130 | + resources: ["securitycontextconstraints"] |
| 131 | + verbs: ["use"] |
| 132 | + resourceNames: ["privileged"] |
| 133 | + - apiGroups: ["snapshot.storage.k8s.io"] |
| 134 | + resources: ["volumesnapshotclasses"] |
| 135 | + verbs: ["list"] |
| 136 | + |
| 137 | +--- |
| 138 | +kind: ClusterRole |
| 139 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 140 | +metadata: |
| 141 | + name: external-snapshotter-runner |
| 142 | +rules: |
| 143 | + - apiGroups: [""] |
| 144 | + resources: ["events"] |
| 145 | + verbs: ["list", "watch", "create", "update", "patch"] |
| 146 | + - apiGroups: ["snapshot.storage.k8s.io"] |
| 147 | + resources: ["volumesnapshotclasses"] |
| 148 | + verbs: ["get", "list", "watch"] |
| 149 | + - apiGroups: ["snapshot.storage.k8s.io"] |
| 150 | + resources: ["volumesnapshotcontents"] |
| 151 | + verbs: ["create", "get", "list", "watch", "update", "delete", "patch"] |
| 152 | + - apiGroups: ["snapshot.storage.k8s.io"] |
| 153 | + resources: ["volumesnapshotcontents/status"] |
| 154 | + verbs: ["update", "patch"] |
| 155 | +--- |
| 156 | +kind: ClusterRoleBinding |
| 157 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 158 | +metadata: |
| 159 | + name: kubevirt-csi-node-binding |
| 160 | +subjects: |
| 161 | + - kind: ServiceAccount |
| 162 | + name: kubevirt-csi-node-sa |
| 163 | + namespace: {{ .Release.Namespace }} |
| 164 | +roleRef: |
| 165 | + kind: ClusterRole |
| 166 | + name: kubevirt-csi-node-cr |
| 167 | + apiGroup: rbac.authorization.k8s.io |
| 168 | +--- |
| 169 | +kind: ClusterRoleBinding |
| 170 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 171 | +metadata: |
| 172 | + name: csi-snapshotter-role |
| 173 | +subjects: |
| 174 | + - kind: ServiceAccount |
| 175 | + name: kubevirt-csi-snapshot-sa |
| 176 | + namespace: {{ .Release.Namespace }} |
| 177 | +roleRef: |
| 178 | + kind: ClusterRole |
| 179 | + # change the name also here if the ClusterRole gets renamed |
| 180 | + name: external-snapshotter-runner |
| 181 | + apiGroup: rbac.authorization.k8s.io |
| 182 | +--- |
| 183 | +kind: DaemonSet |
| 184 | +apiVersion: apps/v1 |
| 185 | +metadata: |
| 186 | + name: kubevirt-csi-node |
| 187 | + namespace: {{ .Release.Namespace }} |
| 188 | +spec: |
| 189 | + selector: |
| 190 | + matchLabels: |
| 191 | + app: kubevirt-csi-driver |
| 192 | + updateStrategy: |
| 193 | + type: RollingUpdate |
| 194 | + template: |
| 195 | + metadata: |
| 196 | + labels: |
| 197 | + app: kubevirt-csi-driver |
| 198 | + spec: |
| 199 | + serviceAccount: kubevirt-csi-node-sa |
| 200 | + priorityClassName: system-node-critical |
| 201 | + tolerations: |
| 202 | + - operator: Exists |
| 203 | + containers: |
| 204 | + - name: csi-driver |
| 205 | + securityContext: |
| 206 | + privileged: true |
| 207 | + allowPrivilegeEscalation: true |
| 208 | + imagePullPolicy: Always |
| 209 | + image: registry.dnation.cloud/test-mg/kubevirt-csi-driver:latest |
| 210 | + args: |
| 211 | + - "--endpoint=unix:/csi/csi.sock" |
| 212 | + - "--node-name=$(KUBE_NODE_NAME)" |
| 213 | + - "--run-node-service=true" |
| 214 | + - "--run-controller-service=false" |
| 215 | + - "--v=5" |
| 216 | + env: |
| 217 | + - name: KUBE_NODE_NAME |
| 218 | + valueFrom: |
| 219 | + fieldRef: |
| 220 | + fieldPath: spec.nodeName |
| 221 | + volumeMounts: |
| 222 | + - name: kubelet-dir |
| 223 | + mountPath: /var/lib/kubelet |
| 224 | + mountPropagation: "Bidirectional" |
| 225 | + - name: plugin-dir |
| 226 | + mountPath: /csi |
| 227 | + - name: device-dir |
| 228 | + mountPath: /dev |
| 229 | + - name: udev |
| 230 | + mountPath: /run/udev |
| 231 | + ports: |
| 232 | + - name: healthz |
| 233 | + containerPort: 10300 |
| 234 | + protocol: TCP |
| 235 | + livenessProbe: |
| 236 | + httpGet: |
| 237 | + path: /healthz |
| 238 | + port: healthz |
| 239 | + initialDelaySeconds: 10 |
| 240 | + timeoutSeconds: 3 |
| 241 | + periodSeconds: 10 |
| 242 | + failureThreshold: 5 |
| 243 | + resources: |
| 244 | + requests: |
| 245 | + memory: 50Mi |
| 246 | + cpu: 10m |
| 247 | + - name: csi-node-driver-registrar |
| 248 | + image: quay.io/openshift/origin-csi-node-driver-registrar:latest |
| 249 | + args: |
| 250 | + - "--csi-address=$(ADDRESS)" |
| 251 | + - "--kubelet-registration-path=$(DRIVER_REG_SOCK_PATH)" |
| 252 | + - "--v=5" |
| 253 | + lifecycle: |
| 254 | + preStop: |
| 255 | + exec: |
| 256 | + command: ["/bin/sh", "-c", "rm -rf /registration/csi.kubevirt.io-reg.sock /csi/csi.sock"] |
| 257 | + env: |
| 258 | + - name: ADDRESS |
| 259 | + value: /csi/csi.sock |
| 260 | + - name: DRIVER_REG_SOCK_PATH |
| 261 | + value: /var/lib/kubelet/plugins/csi.kubevirt.io/csi.sock |
| 262 | + volumeMounts: |
| 263 | + - name: plugin-dir |
| 264 | + mountPath: /csi |
| 265 | + - name: registration-dir |
| 266 | + mountPath: /registration |
| 267 | + resources: |
| 268 | + requests: |
| 269 | + memory: 20Mi |
| 270 | + cpu: 5m |
| 271 | + - name: csi-liveness-probe |
| 272 | + image: quay.io/openshift/origin-csi-livenessprobe:latest |
| 273 | + args: |
| 274 | + - "--csi-address=/csi/csi.sock" |
| 275 | + - "--probe-timeout=3s" |
| 276 | + - "--health-port=10300" |
| 277 | + volumeMounts: |
| 278 | + - name: plugin-dir |
| 279 | + mountPath: /csi |
| 280 | + resources: |
| 281 | + requests: |
| 282 | + memory: 20Mi |
| 283 | + cpu: 5m |
| 284 | + volumes: |
| 285 | + - name: kubelet-dir |
| 286 | + hostPath: |
| 287 | + path: /var/lib/kubelet |
| 288 | + type: Directory |
| 289 | + - name: plugin-dir |
| 290 | + hostPath: |
| 291 | + path: /var/lib/kubelet/plugins/csi.kubevirt.io/ |
| 292 | + type: DirectoryOrCreate |
| 293 | + - name: registration-dir |
| 294 | + hostPath: |
| 295 | + path: /var/lib/kubelet/plugins_registry/ |
| 296 | + type: Directory |
| 297 | + - name: device-dir |
| 298 | + hostPath: |
| 299 | + path: /dev |
| 300 | + type: Directory |
| 301 | + - name: udev |
| 302 | + hostPath: |
| 303 | + path: /run/udev |
| 304 | +--- |
| 305 | +apiVersion: v1 |
| 306 | +kind: ConfigMap |
| 307 | +metadata: |
| 308 | + name: driver-config |
| 309 | + namespace: {{ .Release.Namespace }} |
| 310 | +data: |
| 311 | + infraClusterNamespace: |
| 312 | + infraClusterLabels: csi-driver/cluster=tenant |
| 313 | +--- |
| 314 | +apiVersion: storage.k8s.io/v1 |
| 315 | +kind: StorageClass |
| 316 | +metadata: |
| 317 | + name: kubevirt |
| 318 | + annotations: |
| 319 | + storageclass.kubernetes.io/is-default-class: "true" |
| 320 | +provisioner: csi.kubevirt.io |
| 321 | +parameters: |
| 322 | + infraStorageClassName: standard |
| 323 | + bus: scsi |
| 324 | +--- |
| 325 | +apiVersion: snapshot.storage.k8s.io/v1 |
| 326 | +kind: VolumeSnapshotClass |
| 327 | +metadata: |
| 328 | + name: kubevirt-csi-snapclass |
| 329 | +driver: csi.kubevirt.io |
| 330 | +deletionPolicy: Delete |
| 331 | +{{- end }} |
0 commit comments