Skip to content

Commit 6f0c43b

Browse files
authored
Merge pull request #1989 from kube-logging/aslafy-z-patch-4
feat(chart): aggregated view clusterrole
2 parents 49ef75a + 038a021 commit 6f0c43b

File tree

3 files changed

+48
-2
lines changed

3 files changed

+48
-2
lines changed

charts/logging-operator/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ Use `createCustomResource=false` with Helm v3 to avoid trying to create CRDs fro
5555
| http.service | object | `{"annotations":{},"clusterIP":"None","labels":{},"type":"ClusterIP"}` | Service definition for query http service. |
5656
| rbac.enabled | bool | `true` | Create rbac service account and roles. |
5757
| rbac.retainOnDelete | bool | `false` | Keep the operators RBAC resources after the operator is deleted to allow removing pending finalizers. |
58+
| rbac.createAggregatedViewClusterRole | bool | `false` | Create ClusterRole that extend the existing view ClusterRole to interact with logging-operator CRDs # Ref: https://kubernetes.io/docs/reference/access-authn-authz/rbac/#aggregated-clusterroles |
59+
| rbac.createAggregatedEditClusterRole | bool | `true` | Create ClusterRole that extend the existing edit ClusterRole to interact with logging-operator CRDs # Ref: https://kubernetes.io/docs/reference/access-authn-authz/rbac/#aggregated-clusterroles |
60+
| rbac.createAggregatedAdminClusterRole | bool | `true` | Create ClusterRole that extend the existing admin ClusterRole to interact with logging-operator CRDs # Ref: https://kubernetes.io/docs/reference/access-authn-authz/rbac/#aggregated-clusterroles |
5861
| monitoring.serviceMonitor.enabled | bool | `false` | Create a Prometheus Operator ServiceMonitor object. |
5962
| monitoring.serviceMonitor.additionalLabels | object | `{}` | |
6063
| monitoring.serviceMonitor.metricRelabelings | list | `[]` | |

charts/logging-operator/templates/userrole.yaml

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
{{- if .Values.rbac.enabled }}
2+
{{- if or .Values.rbac.createAggregatedEditClusterRole .Values.rbac.createAggregatedAdminClusterRole }}
23
---
34
apiVersion: rbac.authorization.k8s.io/v1
45
kind: ClusterRole
56
metadata:
67
name: {{ template "logging-operator.fullname" . }}-edit
78
labels:
8-
rbac.authorization.k8s.io/aggregate-to-admin: "true"
9+
{{- if .Values.rbac.createAggregatedEditClusterRole }}
910
rbac.authorization.k8s.io/aggregate-to-edit: "true"
11+
{{- end }}
12+
{{- if .Values.rbac.createAggregatedAdminClusterRole }}
13+
rbac.authorization.k8s.io/aggregate-to-admin: "true"
14+
{{- end }}
1015
{{ include "logging-operator.labels" . | indent 4 }}
1116
rules:
1217
- apiGroups:
@@ -38,3 +43,33 @@ rules:
3843
- update
3944
- watch
4045
{{- end }}
46+
{{- if .Values.rbac.createAggregatedViewClusterRole }}
47+
---
48+
apiVersion: rbac.authorization.k8s.io/v1
49+
kind: ClusterRole
50+
metadata:
51+
name: {{ template "logging-operator.fullname" . }}-view
52+
labels:
53+
rbac.authorization.k8s.io/aggregate-to-view: "true"
54+
{{ include "logging-operator.labels" . | indent 4 }}
55+
rules:
56+
- apiGroups:
57+
- logging.banzaicloud.io
58+
resources:
59+
- flows
60+
- outputs
61+
verbs:
62+
- get
63+
- list
64+
- watch
65+
- apiGroups:
66+
- logging.banzaicloud.io
67+
resources:
68+
- syslogngflows
69+
- syslogngoutputs
70+
verbs:
71+
- get
72+
- list
73+
- watch
74+
{{- end }}
75+
{{- end }}

charts/logging-operator/values.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,17 @@ rbac:
6767
enabled: true
6868
# -- Keep the operators RBAC resources after the operator is deleted to allow removing pending finalizers.
6969
retainOnDelete: false
70-
7170
# specify service account manually
7271
# serviceAccountName: custom
72+
# -- Create ClusterRole that extend the existing view ClusterRole to interact with logging-operator CRDs
73+
## Ref: https://kubernetes.io/docs/reference/access-authn-authz/rbac/#aggregated-clusterroles
74+
createAggregatedViewClusterRole: false
75+
# -- Create ClusterRole that extend the existing edit ClusterRole to interact with logging-operator CRDs
76+
## Ref: https://kubernetes.io/docs/reference/access-authn-authz/rbac/#aggregated-clusterroles
77+
createAggregatedEditClusterRole: true
78+
# -- Create ClusterRole that extend the existing admin ClusterRole to interact with logging-operator CRDs
79+
## Ref: https://kubernetes.io/docs/reference/access-authn-authz/rbac/#aggregated-clusterroles
80+
createAggregatedAdminClusterRole: true
7381

7482
monitoring:
7583
serviceMonitor:

0 commit comments

Comments
 (0)