Add rook-ceph operator chart
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
apiVersion: v2
|
||||
description: A simple library chart to share content between Rook's charts
|
||||
name: library
|
||||
type: library
|
||||
version: 0.0.1
|
||||
@@ -0,0 +1,32 @@
|
||||
{{/*
|
||||
ClusterRoleBindings needed for running a Rook CephCluster
|
||||
*/}}
|
||||
{{- define "library.cluster.clusterrolebindings" }}
|
||||
# Allow the ceph mgr to access cluster-wide resources necessary for the mgr modules
|
||||
kind: ClusterRoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: rook-ceph-mgr-cluster{{ template "library.suffix-cluster-namespace" . }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: rook-ceph-mgr-cluster
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: rook-ceph-mgr
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
---
|
||||
# Allow the ceph osd to access cluster-wide resources necessary for determining their topology location
|
||||
kind: ClusterRoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: rook-ceph-osd{{ template "library.suffix-cluster-namespace" . }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: rook-ceph-osd
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: rook-ceph-osd
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
{{- end }}
|
||||
@@ -0,0 +1,73 @@
|
||||
{{/*
|
||||
RBAC needed for enabling monitoring for a Rook CephCluster.
|
||||
These should be scoped to the namespace where the CephCluster is located.
|
||||
*/}}
|
||||
|
||||
{{- define "library.cluster.monitoring.roles" -}}
|
||||
kind: Role
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: rook-ceph-monitoring
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
rules:
|
||||
- apiGroups:
|
||||
- "monitoring.coreos.com"
|
||||
resources:
|
||||
- servicemonitors
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- create
|
||||
- update
|
||||
- delete
|
||||
---
|
||||
# Allow management of monitoring resources in the mgr
|
||||
kind: Role
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: rook-ceph-monitoring-mgr
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
rules:
|
||||
- apiGroups:
|
||||
- monitoring.coreos.com
|
||||
resources:
|
||||
- servicemonitors
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- create
|
||||
- update
|
||||
{{- end }}
|
||||
|
||||
{{- define "library.cluster.monitoring.rolebindings" }}
|
||||
# Allow the operator to get ServiceMonitors in this cluster's namespace
|
||||
kind: RoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: rook-ceph-monitoring
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: rook-ceph-monitoring
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: rook-ceph-system
|
||||
namespace: {{ .Values.operatorNamespace | default .Release.Namespace }} # namespace:operator
|
||||
---
|
||||
# Allow creation of monitoring resources in the mgr
|
||||
kind: RoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: rook-ceph-monitoring-mgr
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: rook-ceph-monitoring-mgr
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: rook-ceph-mgr
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
{{- end }}
|
||||
@@ -0,0 +1,95 @@
|
||||
{{/*
|
||||
RoleBindings needed to enable Pod Security Policies for a CephCluster.
|
||||
*/}}
|
||||
{{- define "library.cluster.psp.rolebindings" }}
|
||||
{{- if semverCompare "<1.25.0-0" .Capabilities.KubeVersion.GitVersion }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: rook-ceph-default-psp
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
labels:
|
||||
operator: rook
|
||||
storage-backend: ceph
|
||||
{{- include "library.rook-ceph.labels" . | nindent 4 }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: psp:rook
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: default
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: rook-ceph-osd-psp
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: psp:rook
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: rook-ceph-osd
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: rook-ceph-rgw-psp
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: psp:rook
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: rook-ceph-rgw
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: rook-ceph-mgr-psp
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: psp:rook
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: rook-ceph-mgr
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: rook-ceph-cmd-reporter-psp
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: psp:rook
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: rook-ceph-cmd-reporter
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: rook-ceph-purge-osd-psp
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: psp:rook
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: rook-ceph-purge-osd
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,151 @@
|
||||
{{/*
|
||||
Roles needed for running a Rook CephCluster
|
||||
*/}}
|
||||
{{- define "library.cluster.roles" }}
|
||||
kind: Role
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: rook-ceph-osd
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
rules:
|
||||
# this is needed for rook's "key-management" CLI to fetch the vault token from the secret when
|
||||
# validating the connection details and for key rotation operations.
|
||||
- apiGroups: [""]
|
||||
resources: ["secrets"]
|
||||
verbs: ["get","update"]
|
||||
- apiGroups: [""]
|
||||
resources: ["configmaps"]
|
||||
verbs: ["get", "list", "watch", "create", "update", "delete"]
|
||||
- apiGroups: ["ceph.rook.io"]
|
||||
resources: ["cephclusters", "cephclusters/finalizers"]
|
||||
verbs: ["get", "list", "create", "update", "delete"]
|
||||
---
|
||||
kind: Role
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: rook-ceph-rgw
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
rules:
|
||||
# Placeholder role so the rgw service account will
|
||||
# be generated in the csv. Remove this role and role binding
|
||||
# when fixing https://github.com/rook/rook/issues/10141.
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- configmaps
|
||||
verbs:
|
||||
- get
|
||||
---
|
||||
# Aspects of ceph-mgr that operate within the cluster's namespace
|
||||
kind: Role
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: rook-ceph-mgr
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- pods
|
||||
- services
|
||||
- pods/log
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- create
|
||||
- update
|
||||
- delete
|
||||
- apiGroups:
|
||||
- batch
|
||||
resources:
|
||||
- jobs
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- create
|
||||
- update
|
||||
- delete
|
||||
- apiGroups:
|
||||
- ceph.rook.io
|
||||
resources:
|
||||
- cephclients
|
||||
- cephclusters
|
||||
- cephblockpools
|
||||
- cephfilesystems
|
||||
- cephnfses
|
||||
- cephobjectstores
|
||||
- cephobjectstoreusers
|
||||
- cephobjectrealms
|
||||
- cephobjectzonegroups
|
||||
- cephobjectzones
|
||||
- cephbuckettopics
|
||||
- cephbucketnotifications
|
||||
- cephrbdmirrors
|
||||
- cephfilesystemmirrors
|
||||
- cephfilesystemsubvolumegroups
|
||||
- cephblockpoolradosnamespaces
|
||||
- cephcosidrivers
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- create
|
||||
- update
|
||||
- delete
|
||||
- patch
|
||||
- apiGroups:
|
||||
- apps
|
||||
resources:
|
||||
- deployments/scale
|
||||
- deployments
|
||||
verbs:
|
||||
- patch
|
||||
- delete
|
||||
- apiGroups:
|
||||
- ''
|
||||
resources:
|
||||
- persistentvolumeclaims
|
||||
verbs:
|
||||
- delete
|
||||
---
|
||||
kind: Role
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: rook-ceph-cmd-reporter
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- pods
|
||||
- configmaps
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- create
|
||||
- update
|
||||
- delete
|
||||
---
|
||||
# Aspects of ceph osd purge job that require access to the cluster namespace
|
||||
kind: Role
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: rook-ceph-purge-osd
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
rules:
|
||||
- apiGroups: [""]
|
||||
resources: ["configmaps"]
|
||||
verbs: ["get"]
|
||||
- apiGroups: ["apps"]
|
||||
resources: ["deployments"]
|
||||
verbs: ["get", "delete" ]
|
||||
- apiGroups: ["batch"]
|
||||
resources: ["jobs"]
|
||||
verbs: ["get", "list", "delete" ]
|
||||
- apiGroups: [""]
|
||||
resources: ["persistentvolumeclaims"]
|
||||
verbs: ["get", "update", "delete", "list"]
|
||||
{{- end }}
|
||||
@@ -0,0 +1,108 @@
|
||||
{{/*
|
||||
RoleBindings needed for running a Rook CephCluster
|
||||
*/}}
|
||||
{{- define "library.cluster.rolebindings" }}
|
||||
# Allow the operator to create resources in this cluster's namespace
|
||||
kind: RoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: rook-ceph-cluster-mgmt
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: rook-ceph-cluster-mgmt
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: rook-ceph-system
|
||||
namespace: {{ .Values.operatorNamespace | default .Release.Namespace }} # namespace:operator
|
||||
---
|
||||
# Allow the osd pods in this namespace to work with configmaps
|
||||
kind: RoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: rook-ceph-osd
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: rook-ceph-osd
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: rook-ceph-osd
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
---
|
||||
# Allow the rgw pods in this namespace to work with configmaps
|
||||
kind: RoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: rook-ceph-rgw
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: rook-ceph-rgw
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: rook-ceph-rgw
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
---
|
||||
# Allow the ceph mgr to access resources scoped to the CephCluster namespace necessary for mgr modules
|
||||
kind: RoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: rook-ceph-mgr
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: rook-ceph-mgr
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: rook-ceph-mgr
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
---
|
||||
# Allow the ceph mgr to access resources in the Rook operator namespace necessary for mgr modules
|
||||
kind: RoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: rook-ceph-mgr-system{{ template "library.suffix-cluster-namespace" . }}
|
||||
namespace: {{ .Values.operatorNamespace | default .Release.Namespace }} # namespace:operator
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: rook-ceph-mgr-system
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: rook-ceph-mgr
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
---
|
||||
kind: RoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: rook-ceph-cmd-reporter
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: rook-ceph-cmd-reporter
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: rook-ceph-cmd-reporter
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
---
|
||||
# Allow the osd purge job to run in this namespace
|
||||
kind: RoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
metadata:
|
||||
name: rook-ceph-purge-osd
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: rook-ceph-purge-osd
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: rook-ceph-purge-osd
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
{{- end }}
|
||||
@@ -0,0 +1,60 @@
|
||||
{{/*
|
||||
ServiceAccounts needed for running a Rook CephCluster
|
||||
*/}}
|
||||
{{- define "library.cluster.serviceaccounts" }}
|
||||
# Service account for Ceph OSDs
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: rook-ceph-osd
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
labels:
|
||||
operator: rook
|
||||
storage-backend: ceph
|
||||
{{- include "library.rook-ceph.labels" . | nindent 4 }}
|
||||
{{ include "library.imagePullSecrets" . }}
|
||||
---
|
||||
# Service account for Ceph mgrs
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: rook-ceph-mgr
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
labels:
|
||||
operator: rook
|
||||
storage-backend: ceph
|
||||
{{- include "library.rook-ceph.labels" . | nindent 4 }}
|
||||
{{ include "library.imagePullSecrets" . }}
|
||||
---
|
||||
# Service account for the job that reports the Ceph version in an image
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: rook-ceph-cmd-reporter
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
labels:
|
||||
operator: rook
|
||||
storage-backend: ceph
|
||||
{{- include "library.rook-ceph.labels" . | nindent 4 }}
|
||||
{{ include "library.imagePullSecrets" . }}
|
||||
---
|
||||
# Service account for job that purges OSDs from a Rook-Ceph cluster
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: rook-ceph-purge-osd
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
{{ include "library.imagePullSecrets" . }}
|
||||
---
|
||||
# Service account for RGW server
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: rook-ceph-rgw
|
||||
namespace: {{ .Release.Namespace }} # namespace:cluster
|
||||
labels:
|
||||
operator: rook
|
||||
storage-backend: ceph
|
||||
{{- include "library.rook-ceph.labels" . | nindent 4 }}
|
||||
{{ include "library.imagePullSecrets" . }}
|
||||
{{ end }}
|
||||
@@ -0,0 +1,13 @@
|
||||
{{/*
|
||||
Define imagePullSecrets option to pass to all service accounts
|
||||
*/}}
|
||||
{{- define "library.imagePullSecrets" }}
|
||||
{{- if .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{ toYaml .Values.imagePullSecrets }}
|
||||
{{- else }}
|
||||
{{/* if the secrets are not included, include a comment for generating common.yaml */}}
|
||||
# imagePullSecrets:
|
||||
# - name: my-registry-secret
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,9 @@
|
||||
{{/*
|
||||
Common labels
|
||||
*/}}
|
||||
{{- define "library.rook-ceph.labels" -}}
|
||||
app.kubernetes.io/part-of: rook-ceph-operator
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
app.kubernetes.io/created-by: helm
|
||||
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
|
||||
{{- end }}
|
||||
@@ -0,0 +1,18 @@
|
||||
{{/*
|
||||
Some ClusterRoles or Roles in the operator namespace need to be bound to service accounts in the
|
||||
CephCluster namespace.
|
||||
If the cluster namespace is the same as the operator namespace, we want a binding with a basic name.
|
||||
This is the case for the rook-ceph (Rook-Ceph Operator) chart.
|
||||
If the cluster namespace is different from the operator namespace, we want to name the binding
|
||||
(in the operator namespace) with a suffixed that has the cluster namespace. This is the case for
|
||||
some instances of the rook-ceph-cluster (CephCluster) chart
|
||||
*/}}
|
||||
|
||||
{{- define "library.suffix-cluster-namespace" -}}
|
||||
{{/* the operator chart won't set .Values.operatorNamespace, so default to .Release.Namespace */}}
|
||||
{{- $operatorNamespace := .Values.operatorNamespace | default .Release.Namespace -}}
|
||||
{{- $clusterNamespace := .Release.Namespace -}}
|
||||
{{- if ne $clusterNamespace $operatorNamespace -}}
|
||||
{{ printf "-%s" $clusterNamespace }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
Reference in New Issue
Block a user