Skip to content

Commit 4b4536b

Browse files
authored
Actually, RBAC rules are additive, so we can simply add this RBAC rule and let the agent create their own again (#176)
Signed-off-by: Pete Wall <[email protected]>
1 parent 1552099 commit 4b4536b

File tree

17 files changed

+1855
-1742
lines changed

17 files changed

+1855
-1742
lines changed

charts/k8s-monitoring/templates/grafana-agent-logs-rbac.yaml

Lines changed: 0 additions & 98 deletions
This file was deleted.

charts/k8s-monitoring/templates/grafana-agent-rbac.yaml

Lines changed: 0 additions & 86 deletions
This file was deleted.

charts/k8s-monitoring/templates/platform_specific/openshift/security-context-constraint.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{{- if and (eq .Values.cluster.platform "openshift") .Values.logs.enabled .Values.logs.pod_logs.enabled }}
2+
---
23
apiVersion: security.openshift.io/v1
34
kind: SecurityContextConstraints
45
metadata:
@@ -45,4 +46,31 @@ volumes:
4546
- hostPath
4647
- projected
4748
- secret
49+
---
50+
apiVersion: rbac.authorization.k8s.io/v1
51+
kind: ClusterRole
52+
metadata:
53+
name: {{ include "grafana-agent.fullname" (index .Subcharts "grafana-agent-logs") }}-scc
54+
rules:
55+
- verbs:
56+
- use
57+
apiGroups:
58+
- security.openshift.io
59+
resources:
60+
- securitycontextconstraints
61+
resourceNames:
62+
- {{ include "grafana-agent.fullname" (index .Subcharts "grafana-agent-logs") }}
63+
---
64+
apiVersion: rbac.authorization.k8s.io/v1
65+
kind: ClusterRoleBinding
66+
metadata:
67+
name: {{ include "grafana-agent.fullname" (index .Subcharts "grafana-agent-logs") }}-scc
68+
roleRef:
69+
apiGroup: rbac.authorization.k8s.io
70+
kind: ClusterRole
71+
name: {{ include "grafana-agent.fullname" (index .Subcharts "grafana-agent-logs") }}-scc
72+
subjects:
73+
- kind: ServiceAccount
74+
name: {{ include "grafana-agent.serviceAccountName" (index .Subcharts "grafana-agent-logs") }}
75+
namespace: {{ .Release.Namespace }}
4876
{{- end }}

charts/k8s-monitoring/values.schema.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
},
1818
"name": {
1919
"type": "string"
20+
},
21+
"platform": {
22+
"type": "string",
23+
"enum": ["", "openshift"]
2024
}
2125
}
2226
},

charts/k8s-monitoring/values.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -622,10 +622,6 @@ grafana-agent:
622622
configMap:
623623
name: kubernetes-monitoring-telemetry
624624

625-
# This chart creates the ClusterRole and ClusterRoleBinding for Grafana Agent
626-
rbac:
627-
create: false
628-
629625
# Settings for the Grafana Agent deployment
630626
# You can use this sections to make modifications to the Grafana Agent deployment.
631627
# See https://github.com/grafana/agent/tree/main/operations/helm/charts/grafana-agent for available values.
@@ -668,7 +664,3 @@ grafana-agent-logs:
668664
# creation attempt.
669665
crds:
670666
create: false
671-
672-
# This chart creates the ClusterRole and ClusterRoleBinding for Grafana Agent for logs
673-
rbac:
674-
create: false

0 commit comments

Comments
 (0)