<commit_before>{{/*
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
      - prometheusrules
    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: {{ .Release.Namespace }} # namespace:cluster
---
# 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 }}
<commit_msg>helm: use operatorNamespace if exists for monitoring RBAC<commit_after>{{/*
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
      - prometheusrules
    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 }}

{'fraction_non_alphanumeric': 0.11254272942413884, 'fraction_numerical': 0.005259006047856955, 'mean_word_length': 3.470035252643948, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5447577', 'n_tokens_mistral': 1235, 'n_tokens_neox': 1217, 'n_words': 303}