Update rook-ceph kubernetes deployment
[infra/stack/kubernetes.git] / apps / ceph / kubespray / playbooks / roles / install / templates / common.yaml.j2
1 # ============LICENSE_START=======================================================
2 #  Copyright (C) 2021 The Nordix Foundation. All rights reserved.
3 # ================================================================================
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 #      http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #
16 # SPDX-License-Identifier: Apache-2.0
17 # ============LICENSE_END=========================================================
18
19 ###################################################################################################################
20 # Create the common resources that are necessary to start the operator and the ceph cluster.
21 # These resources *must* be created before the operator.yaml and cluster.yaml or their variants.
22 # The samples all assume that a single operator will manage a single cluster crd in the same "rook-ceph" namespace.
23 #
24 # If the operator needs to manage multiple clusters (in different namespaces), see the section below
25 # for "cluster-specific resources". The resources below that section will need to be created for each namespace
26 # where the operator needs to manage the cluster. The resources above that section do not be created again.
27 #
28 # Most of the sections are prefixed with a 'OLM' keyword which is used to build our CSV for an OLM (Operator Life Cycle manager)
29 ###################################################################################################################
30
31 # Namespace where the operator and other rook resources are created
32 apiVersion: v1
33 kind: Namespace
34 metadata:
35   name: "{{ rook_namespace }}" # namespace:cluster
36 # OLM: BEGIN OBJECTBUCKET ROLEBINDING
37 ---
38 kind: ClusterRoleBinding
39 apiVersion: rbac.authorization.k8s.io/v1
40 metadata:
41   name: rook-ceph-object-bucket
42 roleRef:
43   apiGroup: rbac.authorization.k8s.io
44   kind: ClusterRole
45   name: rook-ceph-object-bucket
46 subjects:
47   - kind: ServiceAccount
48     name: rook-ceph-system
49     namespace: "{{ rook_namespace }}" # namespace:operator
50 # OLM: END OBJECTBUCKET ROLEBINDING
51 # OLM: BEGIN OPERATOR ROLE
52 ---
53 apiVersion: v1
54 kind: ServiceAccount
55 metadata:
56   name: rook-ceph-admission-controller
57   namespace: "{{ rook_namespace }}" # namespace:operator
58 ---
59 kind: ClusterRole
60 apiVersion: rbac.authorization.k8s.io/v1
61 metadata:
62   name: rook-ceph-admission-controller-role
63 rules:
64   - apiGroups: ["ceph.rook.io"]
65     resources: ["*"]
66     verbs: ["get", "watch", "list"]
67 ---
68 kind: ClusterRoleBinding
69 apiVersion: rbac.authorization.k8s.io/v1
70 metadata:
71   name: rook-ceph-admission-controller-rolebinding
72 subjects:
73   - kind: ServiceAccount
74     name: rook-ceph-admission-controller
75     apiGroup: ""
76     namespace: "{{ rook_namespace }}" # namespace:operator
77 roleRef:
78   kind: ClusterRole
79   name: rook-ceph-admission-controller-role
80   apiGroup: rbac.authorization.k8s.io
81 ---
82 # The cluster role for managing all the cluster-specific resources in a namespace
83 apiVersion: rbac.authorization.k8s.io/v1
84 kind: ClusterRole
85 metadata:
86   name: rook-ceph-cluster-mgmt
87   labels:
88     operator: rook
89     storage-backend: ceph
90 rules:
91 - apiGroups:
92   - ""
93   - apps
94   - extensions
95   resources:
96   - secrets
97   - pods
98   - pods/log
99   - services
100   - configmaps
101   - deployments
102   - daemonsets
103   verbs:
104   - get
105   - list
106   - watch
107   - patch
108   - create
109   - update
110   - delete
111 ---
112 # The role for the operator to manage resources in its own namespace
113 apiVersion: rbac.authorization.k8s.io/v1
114 kind: Role
115 metadata:
116   name: rook-ceph-system
117   namespace: "{{ rook_namespace }}" # namespace:operator
118   labels:
119     operator: rook
120     storage-backend: ceph
121 rules:
122 - apiGroups:
123   - ""
124   resources:
125   - pods
126   - configmaps
127   - services
128   verbs:
129   - get
130   - list
131   - watch
132   - patch
133   - create
134   - update
135   - delete
136 - apiGroups:
137   - apps
138   - extensions
139   resources:
140   - daemonsets
141   - statefulsets
142   - deployments
143   verbs:
144   - get
145   - list
146   - watch
147   - create
148   - update
149   - delete
150 ---
151 # The cluster role for managing the Rook CRDs
152 apiVersion: rbac.authorization.k8s.io/v1
153 kind: ClusterRole
154 metadata:
155   name: rook-ceph-global
156   labels:
157     operator: rook
158     storage-backend: ceph
159 rules:
160 - apiGroups:
161   - ""
162   resources:
163   # Pod access is needed for fencing
164   - pods
165   # Node access is needed for determining nodes where mons should run
166   - nodes
167   - nodes/proxy
168   - services
169   verbs:
170   - get
171   - list
172   - watch
173 - apiGroups:
174   - ""
175   resources:
176   - events
177     # PVs and PVCs are managed by the Rook provisioner
178   - persistentvolumes
179   - persistentvolumeclaims
180   - endpoints
181   verbs:
182   - get
183   - list
184   - watch
185   - patch
186   - create
187   - update
188   - delete
189 - apiGroups:
190   - storage.k8s.io
191   resources:
192   - storageclasses
193   verbs:
194   - get
195   - list
196   - watch
197 - apiGroups:
198   - batch
199   resources:
200   - jobs
201   verbs:
202   - get
203   - list
204   - watch
205   - create
206   - update
207   - delete
208 - apiGroups:
209   - ceph.rook.io
210   resources:
211   - "*"
212   verbs:
213   - "*"
214 - apiGroups:
215   - rook.io
216   resources:
217   - "*"
218   verbs:
219   - "*"
220 - apiGroups:
221   - policy
222   - apps
223   - extensions
224   resources:
225   # This is for the clusterdisruption controller
226   - poddisruptionbudgets
227   # This is for both clusterdisruption and nodedrain controllers
228   - deployments
229   - replicasets
230   verbs:
231   - "*"
232 - apiGroups:
233   - healthchecking.openshift.io
234   resources:
235   - machinedisruptionbudgets
236   verbs:
237   - get
238   - list
239   - watch
240   - create
241   - update
242   - delete
243 - apiGroups:
244   - machine.openshift.io
245   resources:
246   - machines
247   verbs:
248   - get
249   - list
250   - watch
251   - create
252   - update
253   - delete
254 - apiGroups:
255   - storage.k8s.io
256   resources:
257   - csidrivers
258   verbs:
259   - create
260   - delete
261   - get
262   - update
263 - apiGroups:
264   - k8s.cni.cncf.io
265   resources:
266   - network-attachment-definitions
267   verbs:
268   - get
269 ---
270 # Aspects of ceph-mgr that require cluster-wide access
271 kind: ClusterRole
272 apiVersion: rbac.authorization.k8s.io/v1
273 metadata:
274   name: rook-ceph-mgr-cluster
275   labels:
276     operator: rook
277     storage-backend: ceph
278 rules:
279 - apiGroups:
280   - ""
281   resources:
282   - configmaps
283   - nodes
284   - nodes/proxy
285   verbs:
286   - get
287   - list
288   - watch
289 - apiGroups:
290   - ""
291   resources:
292   - events
293   verbs:
294   - create
295   - patch
296   - list
297   - get
298   - watch
299 ---
300 kind: ClusterRole
301 apiVersion: rbac.authorization.k8s.io/v1
302 metadata:
303   name: rook-ceph-object-bucket
304   labels:
305     operator: rook
306     storage-backend: ceph
307 rules:
308 - apiGroups:
309   - ""
310   verbs:
311   - "*"
312   resources:
313   - secrets
314   - configmaps
315 - apiGroups:
316     - storage.k8s.io
317   resources:
318     - storageclasses
319   verbs:
320     - get
321     - list
322     - watch
323 - apiGroups:
324   - "objectbucket.io"
325   verbs:
326   - "*"
327   resources:
328   - "*"
329 # OLM: END OPERATOR ROLE
330 # OLM: BEGIN SERVICE ACCOUNT SYSTEM
331 ---
332 # The rook system service account used by the operator, agent, and discovery pods
333 apiVersion: v1
334 kind: ServiceAccount
335 metadata:
336   name: rook-ceph-system
337   namespace: "{{ rook_namespace }}" # namespace:operator
338   labels:
339     operator: rook
340     storage-backend: ceph
341 # imagePullSecrets:
342 # - name: my-registry-secret
343
344 # OLM: END SERVICE ACCOUNT SYSTEM
345 # OLM: BEGIN OPERATOR ROLEBINDING
346 ---
347 # Grant the operator, agent, and discovery agents access to resources in the namespace
348 kind: RoleBinding
349 apiVersion: rbac.authorization.k8s.io/v1
350 metadata:
351   name: rook-ceph-system
352   namespace: "{{ rook_namespace }}" # namespace:operator
353   labels:
354     operator: rook
355     storage-backend: ceph
356 roleRef:
357   apiGroup: rbac.authorization.k8s.io
358   kind: Role
359   name: rook-ceph-system
360 subjects:
361 - kind: ServiceAccount
362   name: rook-ceph-system
363   namespace: "{{ rook_namespace }}" # namespace:operator
364 ---
365 # Grant the rook system daemons cluster-wide access to manage the Rook CRDs, PVCs, and storage classes
366 kind: ClusterRoleBinding
367 apiVersion: rbac.authorization.k8s.io/v1
368 metadata:
369   name: rook-ceph-global
370   labels:
371     operator: rook
372     storage-backend: ceph
373 roleRef:
374   apiGroup: rbac.authorization.k8s.io
375   kind: ClusterRole
376   name: rook-ceph-global
377 subjects:
378 - kind: ServiceAccount
379   name: rook-ceph-system
380   namespace: "{{ rook_namespace }}" # namespace:operator
381 # OLM: END OPERATOR ROLEBINDING
382 #################################################################################################################
383 # Beginning of cluster-specific resources. The example will assume the cluster will be created in the "rook-ceph"
384 # namespace. If you want to create the cluster in a different namespace, you will need to modify these roles
385 # and bindings accordingly.
386 #################################################################################################################
387 # Service account for the Ceph OSDs. Must exist and cannot be renamed.
388 # OLM: BEGIN SERVICE ACCOUNT OSD
389 ---
390 apiVersion: v1
391 kind: ServiceAccount
392 metadata:
393   name: rook-ceph-osd
394   namespace: "{{ rook_namespace }}" # namespace:cluster
395 # imagePullSecrets:
396 # - name: my-registry-secret
397
398 # OLM: END SERVICE ACCOUNT OSD
399 # OLM: BEGIN SERVICE ACCOUNT MGR
400 ---
401 # Service account for the Ceph Mgr. Must exist and cannot be renamed.
402 apiVersion: v1
403 kind: ServiceAccount
404 metadata:
405   name: rook-ceph-mgr
406   namespace: "{{ rook_namespace }}" # namespace:cluster
407 # imagePullSecrets:
408 # - name: my-registry-secret
409
410 # OLM: END SERVICE ACCOUNT MGR
411 # OLM: BEGIN CMD REPORTER SERVICE ACCOUNT
412 ---
413 apiVersion: v1
414 kind: ServiceAccount
415 metadata:
416   name: rook-ceph-cmd-reporter
417   namespace: "{{ rook_namespace }}" # namespace:cluster
418 # OLM: END CMD REPORTER SERVICE ACCOUNT
419 # OLM: BEGIN CLUSTER ROLE
420 ---
421 kind: Role
422 apiVersion: rbac.authorization.k8s.io/v1
423 metadata:
424   name: rook-ceph-osd
425   namespace: "{{ rook_namespace }}" # namespace:cluster
426 rules:
427 - apiGroups: [""]
428   resources: ["configmaps"]
429   verbs: [ "get", "list", "watch", "create", "update", "delete" ]
430 - apiGroups: ["ceph.rook.io"]
431   resources: ["cephclusters", "cephclusters/finalizers"]
432   verbs: [ "get", "list", "create", "update", "delete" ]
433 ---
434 kind: ClusterRole
435 apiVersion: rbac.authorization.k8s.io/v1
436 metadata:
437   name: rook-ceph-osd
438 rules:
439 - apiGroups:
440   - ""
441   resources:
442   - nodes
443   verbs:
444   - get
445   - list
446 ---
447 # Aspects of ceph-mgr that require access to the system namespace
448 kind: ClusterRole
449 apiVersion: rbac.authorization.k8s.io/v1
450 metadata:
451   name: rook-ceph-mgr-system
452 rules:
453 - apiGroups:
454   - ""
455   resources:
456   - configmaps
457   verbs:
458   - get
459   - list
460   - watch
461 ---
462 # Aspects of ceph-mgr that operate within the cluster's namespace
463 kind: Role
464 apiVersion: rbac.authorization.k8s.io/v1
465 metadata:
466   name: rook-ceph-mgr
467   namespace: "{{ rook_namespace }}" # namespace:cluster
468 rules:
469 - apiGroups:
470   - ""
471   resources:
472   - pods
473   - services
474   - pods/log
475   verbs:
476   - get
477   - list
478   - watch
479   - delete
480 - apiGroups:
481   - batch
482   resources:
483   - jobs
484   verbs:
485   - get
486   - list
487   - watch
488   - create
489   - update
490   - delete
491 - apiGroups:
492   - ceph.rook.io
493   resources:
494   - "*"
495   verbs:
496   - "*"
497 # OLM: END CLUSTER ROLE
498 # OLM: BEGIN CMD REPORTER ROLE
499 ---
500 kind: Role
501 apiVersion: rbac.authorization.k8s.io/v1
502 metadata:
503   name: rook-ceph-cmd-reporter
504   namespace: "{{ rook_namespace }}" # namespace:cluster
505 rules:
506 - apiGroups:
507   - ""
508   resources:
509   - pods
510   - configmaps
511   verbs:
512   - get
513   - list
514   - watch
515   - create
516   - update
517   - delete
518 # OLM: END CMD REPORTER ROLE
519 # OLM: BEGIN CLUSTER ROLEBINDING
520 ---
521 # Allow the operator to create resources in this cluster's namespace
522 kind: RoleBinding
523 apiVersion: rbac.authorization.k8s.io/v1
524 metadata:
525   name: rook-ceph-cluster-mgmt
526   namespace: "{{ rook_namespace }}" # namespace:cluster
527 roleRef:
528   apiGroup: rbac.authorization.k8s.io
529   kind: ClusterRole
530   name: rook-ceph-cluster-mgmt
531 subjects:
532 - kind: ServiceAccount
533   name: rook-ceph-system
534   namespace: "{{ rook_namespace }}" # namespace:operator
535 ---
536 # Allow the osd pods in this namespace to work with configmaps
537 kind: RoleBinding
538 apiVersion: rbac.authorization.k8s.io/v1
539 metadata:
540   name: rook-ceph-osd
541   namespace: "{{ rook_namespace }}" # namespace:cluster
542 roleRef:
543   apiGroup: rbac.authorization.k8s.io
544   kind: Role
545   name: rook-ceph-osd
546 subjects:
547 - kind: ServiceAccount
548   name: rook-ceph-osd
549   namespace: "{{ rook_namespace }}" # namespace:cluster
550 ---
551 # Allow the ceph mgr to access the cluster-specific resources necessary for the mgr modules
552 kind: RoleBinding
553 apiVersion: rbac.authorization.k8s.io/v1
554 metadata:
555   name: rook-ceph-mgr
556   namespace: "{{ rook_namespace }}" # namespace:cluster
557 roleRef:
558   apiGroup: rbac.authorization.k8s.io
559   kind: Role
560   name: rook-ceph-mgr
561 subjects:
562 - kind: ServiceAccount
563   name: rook-ceph-mgr
564   namespace: "{{ rook_namespace }}" # namespace:cluster
565 ---
566 # Allow the ceph mgr to access the rook system resources necessary for the mgr modules
567 kind: RoleBinding
568 apiVersion: rbac.authorization.k8s.io/v1
569 metadata:
570   name: rook-ceph-mgr-system
571   namespace: "{{ rook_namespace }}"  # namespace:operator
572 roleRef:
573   apiGroup: rbac.authorization.k8s.io
574   kind: ClusterRole
575   name: rook-ceph-mgr-system
576 subjects:
577 - kind: ServiceAccount
578   name: rook-ceph-mgr
579   namespace: "{{ rook_namespace }}" # namespace:cluster
580 ---
581 # Allow the ceph mgr to access cluster-wide resources necessary for the mgr modules
582 kind: ClusterRoleBinding
583 apiVersion: rbac.authorization.k8s.io/v1
584 metadata:
585   name: rook-ceph-mgr-cluster
586 roleRef:
587   apiGroup: rbac.authorization.k8s.io
588   kind: ClusterRole
589   name: rook-ceph-mgr-cluster
590 subjects:
591 - kind: ServiceAccount
592   name: rook-ceph-mgr
593   namespace: "{{ rook_namespace }}" # namespace:cluster
594
595 ---
596 # Allow the ceph osd to access cluster-wide resources necessary for determining their topology location
597 kind: ClusterRoleBinding
598 apiVersion: rbac.authorization.k8s.io/v1
599 metadata:
600   name: rook-ceph-osd
601 roleRef:
602   apiGroup: rbac.authorization.k8s.io
603   kind: ClusterRole
604   name: rook-ceph-osd
605 subjects:
606 - kind: ServiceAccount
607   name: rook-ceph-osd
608   namespace: "{{ rook_namespace }}" # namespace:cluster
609
610 # OLM: END CLUSTER ROLEBINDING
611 # OLM: BEGIN CMD REPORTER ROLEBINDING
612 ---
613 kind: RoleBinding
614 apiVersion: rbac.authorization.k8s.io/v1
615 metadata:
616   name: rook-ceph-cmd-reporter
617   namespace: "{{ rook_namespace }}" # namespace:cluster
618 roleRef:
619   apiGroup: rbac.authorization.k8s.io
620   kind: Role
621   name: rook-ceph-cmd-reporter
622 subjects:
623 - kind: ServiceAccount
624   name: rook-ceph-cmd-reporter
625   namespace: "{{ rook_namespace }}" # namespace:cluster
626 # OLM: END CMD REPORTER ROLEBINDING
627 #################################################################################################################
628 # Beginning of pod security policy resources. The example will assume the cluster will be created in the
629 # "rook-ceph" namespace. If you want to create the cluster in a different namespace, you will need to modify
630 # the roles and bindings accordingly.
631 #################################################################################################################
632 # OLM: BEGIN CLUSTER POD SECURITY POLICY
633 ---
634 apiVersion: policy/v1beta1
635 kind: PodSecurityPolicy
636 metadata:
637   # Note: Kubernetes matches PSPs to deployments alphabetically. In some environments, this PSP may
638   # need to be renamed with a value that will match before others.
639   name: 00-rook-privileged
640   annotations:
641     seccomp.security.alpha.kubernetes.io/allowedProfileNames: 'runtime/default'
642     seccomp.security.alpha.kubernetes.io/defaultProfileName:  'runtime/default'
643 spec:
644   privileged: true
645   allowedCapabilities:
646     # required by CSI
647     - SYS_ADMIN
648   # fsGroup - the flexVolume agent has fsGroup capabilities and could potentially be any group
649   fsGroup:
650     rule: RunAsAny
651   # runAsUser, supplementalGroups - Rook needs to run some pods as root
652   # Ceph pods could be run as the Ceph user, but that user isn't always known ahead of time
653   runAsUser:
654     rule: RunAsAny
655   supplementalGroups:
656     rule: RunAsAny
657   # seLinux - seLinux context is unknown ahead of time; set if this is well-known
658   seLinux:
659     rule: RunAsAny
660   volumes:
661     # recommended minimum set
662     - configMap
663     - downwardAPI
664     - emptyDir
665     - persistentVolumeClaim
666     - secret
667     - projected
668     # required for Rook
669     - hostPath
670     - flexVolume
671   # allowedHostPaths can be set to Rook's known host volume mount points when they are fully-known
672   # allowedHostPaths:
673   #   - pathPrefix: "/run/udev"  # for OSD prep
674   #     readOnly: false
675   #   - pathPrefix: "/dev"  # for OSD prep
676   #     readOnly: false
677   #   - pathPrefix: "/var/lib/rook"  # or whatever the dataDirHostPath value is set to
678   #     readOnly: false
679   # Ceph requires host IPC for setting up encrypted devices
680   hostIPC: true
681   # Ceph OSDs need to share the same PID namespace
682   hostPID: true
683   # hostNetwork can be set to 'false' if host networking isn't used
684   hostNetwork: true
685   hostPorts:
686     # Ceph messenger protocol v1
687     - min: 6789
688       max: 6790 # <- support old default port
689     # Ceph messenger protocol v2
690     - min: 3300
691       max: 3300
692     # Ceph RADOS ports for OSDs, MDSes
693     - min: 6800
694       max: 7300
695     # # Ceph dashboard port HTTP (not recommended)
696     # - min: 7000
697     #   max: 7000
698     # Ceph dashboard port HTTPS
699     - min: 8443
700       max: 8443
701     # Ceph mgr Prometheus Metrics
702     - min: 9283
703       max: 9283
704 # OLM: END CLUSTER POD SECURITY POLICY
705 # OLM: BEGIN POD SECURITY POLICY BINDINGS
706 ---
707 apiVersion: rbac.authorization.k8s.io/v1
708 kind: ClusterRole
709 metadata:
710   name: 'psp:rook'
711 rules:
712   - apiGroups:
713       - policy
714     resources:
715       - podsecuritypolicies
716     resourceNames:
717       - 00-rook-privileged
718     verbs:
719       - use
720 ---
721 apiVersion: rbac.authorization.k8s.io/v1
722 kind: ClusterRoleBinding
723 metadata:
724   name: rook-ceph-system-psp
725 roleRef:
726   apiGroup: rbac.authorization.k8s.io
727   kind: ClusterRole
728   name: 'psp:rook'
729 subjects:
730   - kind: ServiceAccount
731     name: rook-ceph-system
732     namespace: "{{ rook_namespace }}" # namespace:operator
733 ---
734 apiVersion: rbac.authorization.k8s.io/v1
735 kind: RoleBinding
736 metadata:
737   name: rook-ceph-default-psp
738   namespace: "{{ rook_namespace }}" # namespace:cluster
739 roleRef:
740   apiGroup: rbac.authorization.k8s.io
741   kind: ClusterRole
742   name: psp:rook
743 subjects:
744 - kind: ServiceAccount
745   name: default
746   namespace: "{{ rook_namespace }}" # namespace:cluster
747 ---
748 apiVersion: rbac.authorization.k8s.io/v1
749 kind: RoleBinding
750 metadata:
751   name: rook-ceph-osd-psp
752   namespace: "{{ rook_namespace }}" # namespace:cluster
753 roleRef:
754   apiGroup: rbac.authorization.k8s.io
755   kind: ClusterRole
756   name: psp:rook
757 subjects:
758 - kind: ServiceAccount
759   name: rook-ceph-osd
760   namespace: "{{ rook_namespace }}" # namespace:cluster
761 ---
762 apiVersion: rbac.authorization.k8s.io/v1
763 kind: RoleBinding
764 metadata:
765   name: rook-ceph-mgr-psp
766   namespace: "{{ rook_namespace }}" # namespace:cluster
767 roleRef:
768   apiGroup: rbac.authorization.k8s.io
769   kind: ClusterRole
770   name: psp:rook
771 subjects:
772 - kind: ServiceAccount
773   name: rook-ceph-mgr
774   namespace: "{{ rook_namespace }}" # namespace:cluster
775 ---
776 apiVersion: rbac.authorization.k8s.io/v1
777 kind: RoleBinding
778 metadata:
779   name: rook-ceph-cmd-reporter-psp
780   namespace: "{{ rook_namespace }}" # namespace:cluster
781 roleRef:
782   apiGroup: rbac.authorization.k8s.io
783   kind: ClusterRole
784   name: psp:rook
785 subjects:
786 - kind: ServiceAccount
787   name: rook-ceph-cmd-reporter
788   namespace: "{{ rook_namespace }}" # namespace:cluster
789 # OLM: END CLUSTER POD SECURITY POLICY BINDINGS
790 # OLM: BEGIN CSI CEPHFS SERVICE ACCOUNT
791 ---
792 apiVersion: v1
793 kind: ServiceAccount
794 metadata:
795   name: rook-csi-cephfs-plugin-sa
796   namespace: "{{ rook_namespace }}" # namespace:operator
797 ---
798 apiVersion: v1
799 kind: ServiceAccount
800 metadata:
801   name: rook-csi-cephfs-provisioner-sa
802   namespace: "{{ rook_namespace }}" # namespace:operator
803 # OLM: END CSI CEPHFS SERVICE ACCOUNT
804 # OLM: BEGIN CSI CEPHFS ROLE
805 ---
806 kind: Role
807 apiVersion: rbac.authorization.k8s.io/v1
808 metadata:
809   name: cephfs-external-provisioner-cfg
810   namespace: "{{ rook_namespace }}" # namespace:operator
811 rules:
812   - apiGroups: [""]
813     resources: ["endpoints"]
814     verbs: ["get", "watch", "list", "delete", "update", "create"]
815   - apiGroups: [""]
816     resources: ["configmaps"]
817     verbs: ["get", "list", "create", "delete"]
818   - apiGroups: ["coordination.k8s.io"]
819     resources: ["leases"]
820     verbs: ["get", "watch", "list", "delete", "update", "create"]
821 # OLM: END CSI CEPHFS ROLE
822 # OLM: BEGIN CSI CEPHFS ROLEBINDING
823 ---
824 kind: RoleBinding
825 apiVersion: rbac.authorization.k8s.io/v1
826 metadata:
827   name: cephfs-csi-provisioner-role-cfg
828   namespace: "{{ rook_namespace }}" # namespace:operator
829 subjects:
830   - kind: ServiceAccount
831     name: rook-csi-cephfs-provisioner-sa
832     namespace: "{{ rook_namespace }}" # namespace:operator
833 roleRef:
834   kind: Role
835   name: cephfs-external-provisioner-cfg
836   apiGroup: rbac.authorization.k8s.io
837 # OLM: END CSI CEPHFS ROLEBINDING
838 # OLM: BEGIN CSI CEPHFS CLUSTER ROLE
839 ---
840 kind: ClusterRole
841 apiVersion: rbac.authorization.k8s.io/v1
842 metadata:
843   name: cephfs-csi-nodeplugin
844 rules:
845   - apiGroups: [""]
846     resources: ["nodes"]
847     verbs: ["get", "list", "update"]
848   - apiGroups: [""]
849     resources: ["namespaces"]
850     verbs: ["get", "list"]
851   - apiGroups: [""]
852     resources: ["persistentvolumes"]
853     verbs: ["get", "list", "watch", "update"]
854   - apiGroups: ["storage.k8s.io"]
855     resources: ["volumeattachments"]
856     verbs: ["get", "list", "watch", "update"]
857   - apiGroups: [""]
858     resources: ["configmaps"]
859     verbs: ["get", "list"]
860 ---
861 kind: ClusterRole
862 apiVersion: rbac.authorization.k8s.io/v1
863 metadata:
864   name: cephfs-external-provisioner-runner
865 rules:
866   - apiGroups: [""]
867     resources: ["secrets"]
868     verbs: ["get", "list"]
869   - apiGroups: [""]
870     resources: ["persistentvolumes"]
871     verbs: ["get", "list", "watch", "create", "delete", "update", "patch"]
872   - apiGroups: [""]
873     resources: ["persistentvolumeclaims"]
874     verbs: ["get", "list", "watch", "update"]
875   - apiGroups: ["storage.k8s.io"]
876     resources: ["storageclasses"]
877     verbs: ["get", "list", "watch"]
878   - apiGroups: [""]
879     resources: ["events"]
880     verbs: ["list", "watch", "create", "update", "patch"]
881   - apiGroups: ["snapshot.storage.k8s.io"]
882     resources: ["volumesnapshots"]
883     verbs: ["get", "list", "watch", "update"]
884   - apiGroups: ["snapshot.storage.k8s.io"]
885     resources: ["volumesnapshotcontents"]
886     verbs: ["create", "get", "list", "watch", "update", "delete"]
887   - apiGroups: ["snapshot.storage.k8s.io"]
888     resources: ["volumesnapshotclasses"]
889     verbs: ["get", "list", "watch"]
890   - apiGroups: ["snapshot.storage.k8s.io"]
891     resources: ["volumesnapshotcontents/status"]
892     verbs: ["update"]
893   - apiGroups: ["apiextensions.k8s.io"]
894     resources: ["customresourcedefinitions"]
895     verbs: ["create", "list", "watch", "delete", "get", "update"]
896   - apiGroups: ["snapshot.storage.k8s.io"]
897     resources: ["volumesnapshots/status"]
898     verbs: ["update"]
899   - apiGroups: ["storage.k8s.io"]
900     resources: ["volumeattachments"]
901     verbs: ["get", "list", "watch", "update", "patch"]
902   - apiGroups: ["storage.k8s.io"]
903     resources: ["volumeattachments/status"]
904     verbs: ["patch"]
905   - apiGroups: [""]
906     resources: ["nodes"]
907     verbs: ["get", "list", "watch"]
908   - apiGroups: [""]
909     resources: ["persistentvolumeclaims/status"]
910     verbs: ["update", "patch"]
911 # OLM: END CSI CEPHFS CLUSTER ROLE
912 # OLM: BEGIN CSI CEPHFS CLUSTER ROLEBINDING
913 ---
914 apiVersion: rbac.authorization.k8s.io/v1
915 kind: ClusterRoleBinding
916 metadata:
917   name: rook-csi-cephfs-plugin-sa-psp
918 roleRef:
919   apiGroup: rbac.authorization.k8s.io
920   kind: ClusterRole
921   name: 'psp:rook'
922 subjects:
923   - kind: ServiceAccount
924     name: rook-csi-cephfs-plugin-sa
925     namespace: "{{ rook_namespace }}" # namespace:operator
926 ---
927 apiVersion: rbac.authorization.k8s.io/v1
928 kind: ClusterRoleBinding
929 metadata:
930   name: rook-csi-cephfs-provisioner-sa-psp
931 roleRef:
932   apiGroup: rbac.authorization.k8s.io
933   kind: ClusterRole
934   name: 'psp:rook'
935 subjects:
936   - kind: ServiceAccount
937     name: rook-csi-cephfs-provisioner-sa
938     namespace: "{{ rook_namespace }}" # namespace:operator
939 ---
940 kind: ClusterRoleBinding
941 apiVersion: rbac.authorization.k8s.io/v1
942 metadata:
943   name: cephfs-csi-nodeplugin
944 subjects:
945   - kind: ServiceAccount
946     name: rook-csi-cephfs-plugin-sa
947     namespace: "{{ rook_namespace }}" # namespace:operator
948 roleRef:
949   kind: ClusterRole
950   name: cephfs-csi-nodeplugin
951   apiGroup: rbac.authorization.k8s.io
952
953 ---
954 kind: ClusterRoleBinding
955 apiVersion: rbac.authorization.k8s.io/v1
956 metadata:
957   name: cephfs-csi-provisioner-role
958 subjects:
959   - kind: ServiceAccount
960     name: rook-csi-cephfs-provisioner-sa
961     namespace: "{{ rook_namespace }}" # namespace:operator
962 roleRef:
963   kind: ClusterRole
964   name: cephfs-external-provisioner-runner
965   apiGroup: rbac.authorization.k8s.io
966 # OLM: END CSI CEPHFS CLUSTER ROLEBINDING
967 # OLM: BEGIN CSI RBD SERVICE ACCOUNT
968 ---
969 apiVersion: v1
970 kind: ServiceAccount
971 metadata:
972   name: rook-csi-rbd-plugin-sa
973   namespace: "{{ rook_namespace }}" # namespace:operator
974 ---
975 apiVersion: v1
976 kind: ServiceAccount
977 metadata:
978   name: rook-csi-rbd-provisioner-sa
979   namespace: "{{ rook_namespace }}" # namespace:operator
980 # OLM: END CSI RBD SERVICE ACCOUNT
981 # OLM: BEGIN CSI RBD ROLE
982 ---
983 kind: Role
984 apiVersion: rbac.authorization.k8s.io/v1
985 metadata:
986   name: rbd-external-provisioner-cfg
987   namespace: "{{ rook_namespace }}" # namespace:operator
988 rules:
989   - apiGroups: [""]
990     resources: ["endpoints"]
991     verbs: ["get", "watch", "list", "delete", "update", "create"]
992   - apiGroups: [""]
993     resources: ["configmaps"]
994     verbs: ["get", "list", "watch", "create", "delete", "update"]
995   - apiGroups: ["coordination.k8s.io"]
996     resources: ["leases"]
997     verbs: ["get", "watch", "list", "delete", "update", "create"]
998 # OLM: END CSI RBD ROLE
999 # OLM: BEGIN CSI RBD ROLEBINDING
1000 ---
1001 kind: RoleBinding
1002 apiVersion: rbac.authorization.k8s.io/v1
1003 metadata:
1004   name: rbd-csi-provisioner-role-cfg
1005   namespace: "{{ rook_namespace }}" # namespace:operator
1006 subjects:
1007   - kind: ServiceAccount
1008     name: rook-csi-rbd-provisioner-sa
1009     namespace: "{{ rook_namespace }}" # namespace:operator
1010 roleRef:
1011   kind: Role
1012   name: rbd-external-provisioner-cfg
1013   apiGroup: rbac.authorization.k8s.io
1014 # OLM: END CSI RBD ROLEBINDING
1015 # OLM: BEGIN CSI RBD CLUSTER ROLE
1016 ---
1017 kind: ClusterRole
1018 apiVersion: rbac.authorization.k8s.io/v1
1019 metadata:
1020   name: rbd-csi-nodeplugin
1021 rules:
1022   - apiGroups: [""]
1023     resources: ["secrets"]
1024     verbs: ["get", "list"]
1025   - apiGroups: [""]
1026     resources: ["nodes"]
1027     verbs: ["get", "list", "update"]
1028   - apiGroups: [""]
1029     resources: ["namespaces"]
1030     verbs: ["get", "list"]
1031   - apiGroups: [""]
1032     resources: ["persistentvolumes"]
1033     verbs: ["get", "list", "watch", "update"]
1034   - apiGroups: ["storage.k8s.io"]
1035     resources: ["volumeattachments"]
1036     verbs: ["get", "list", "watch", "update"]
1037   - apiGroups: [""]
1038     resources: ["configmaps"]
1039     verbs: ["get", "list"]
1040 ---
1041 kind: ClusterRole
1042 apiVersion: rbac.authorization.k8s.io/v1
1043 metadata:
1044   name: rbd-external-provisioner-runner
1045 rules:
1046   - apiGroups: [""]
1047     resources: ["secrets"]
1048     verbs: ["get", "list", "watch"]
1049   - apiGroups: [""]
1050     resources: ["persistentvolumes"]
1051     verbs: ["get", "list", "watch", "create", "delete", "update", "patch"]
1052   - apiGroups: [""]
1053     resources: ["persistentvolumeclaims"]
1054     verbs: ["get", "list", "watch", "update"]
1055   - apiGroups: ["storage.k8s.io"]
1056     resources: ["volumeattachments"]
1057     verbs: ["get", "list", "watch", "update", "patch"]
1058   - apiGroups: ["storage.k8s.io"]
1059     resources: ["volumeattachments/status"]
1060     verbs: ["patch"]
1061   - apiGroups: [""]
1062     resources: ["nodes"]
1063     verbs: ["get", "list", "watch"]
1064   - apiGroups: ["storage.k8s.io"]
1065     resources: ["storageclasses"]
1066     verbs: ["get", "list", "watch"]
1067   - apiGroups: [""]
1068     resources: ["events"]
1069     verbs: ["list", "watch", "create", "update", "patch"]
1070   - apiGroups: ["snapshot.storage.k8s.io"]
1071     resources: ["volumesnapshots"]
1072     verbs: ["get", "list", "watch", "update"]
1073   - apiGroups: ["snapshot.storage.k8s.io"]
1074     resources: ["volumesnapshotcontents"]
1075     verbs: ["create", "get", "list", "watch", "update", "delete"]
1076   - apiGroups: ["snapshot.storage.k8s.io"]
1077     resources: ["volumesnapshotclasses"]
1078     verbs: ["get", "list", "watch"]
1079   - apiGroups: ["snapshot.storage.k8s.io"]
1080     resources: ["volumesnapshotcontents/status"]
1081     verbs: ["update"]
1082   - apiGroups: ["apiextensions.k8s.io"]
1083     resources: ["customresourcedefinitions"]
1084     verbs: ["create", "list", "watch", "delete", "get", "update"]
1085   - apiGroups: ["snapshot.storage.k8s.io"]
1086     resources: ["volumesnapshots/status"]
1087     verbs: ["update"]
1088   - apiGroups: [""]
1089     resources: ["persistentvolumeclaims/status"]
1090     verbs: ["update", "patch"]
1091   - apiGroups: [""]
1092     resources: ["configmaps"]
1093     verbs: [ "get"]
1094 # OLM: END CSI RBD CLUSTER ROLE
1095 # OLM: BEGIN CSI RBD CLUSTER ROLEBINDING
1096 ---
1097 apiVersion: rbac.authorization.k8s.io/v1
1098 kind: ClusterRoleBinding
1099 metadata:
1100   name: rook-csi-rbd-plugin-sa-psp
1101 roleRef:
1102   apiGroup: rbac.authorization.k8s.io
1103   kind: ClusterRole
1104   name: 'psp:rook'
1105 subjects:
1106   - kind: ServiceAccount
1107     name: rook-csi-rbd-plugin-sa
1108     namespace: "{{ rook_namespace }}" # namespace:operator
1109 ---
1110 apiVersion: rbac.authorization.k8s.io/v1
1111 kind: ClusterRoleBinding
1112 metadata:
1113   name: rook-csi-rbd-provisioner-sa-psp
1114 roleRef:
1115   apiGroup: rbac.authorization.k8s.io
1116   kind: ClusterRole
1117   name: 'psp:rook'
1118 subjects:
1119   - kind: ServiceAccount
1120     name: rook-csi-rbd-provisioner-sa
1121     namespace: "{{ rook_namespace }}" # namespace:operator
1122 ---
1123 kind: ClusterRoleBinding
1124 apiVersion: rbac.authorization.k8s.io/v1
1125 metadata:
1126   name: rbd-csi-nodeplugin
1127 subjects:
1128   - kind: ServiceAccount
1129     name: rook-csi-rbd-plugin-sa
1130     namespace: "{{ rook_namespace }}" # namespace:operator
1131 roleRef:
1132   kind: ClusterRole
1133   name: rbd-csi-nodeplugin
1134   apiGroup: rbac.authorization.k8s.io
1135 ---
1136 kind: ClusterRoleBinding
1137 apiVersion: rbac.authorization.k8s.io/v1
1138 metadata:
1139   name: rbd-csi-provisioner-role
1140 subjects:
1141   - kind: ServiceAccount
1142     name: rook-csi-rbd-provisioner-sa
1143     namespace: "{{ rook_namespace }}" # namespace:operator
1144 roleRef:
1145   kind: ClusterRole
1146   name: rbd-external-provisioner-runner
1147   apiGroup: rbac.authorization.k8s.io
1148 # OLM: END CSI RBD CLUSTER ROLEBINDING