Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(helm/chart/rbac): allow granular configuration clusterRole's permissions #6829

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions operations/helm/charts/grafana-agent/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ This document contains a historical list of changes between releases. Only
changes that impact end-user behavior are listed; changes to documentation or
internal API changes are not present.

Main (unreleased)
-----------------

### Features
- Allow granular configuration `clusterRole`'s permissions. (@hainenber)


0.37.0 (2024-03-14)
----------

Expand Down
7 changes: 7 additions & 0 deletions operations/helm/charts/grafana-agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@ use the older mode (called "static mode"), set the `agent.mode` value to
| ingress.pathType | string | `"Prefix"` | |
| ingress.tls | list | `[]` | |
| nameOverride | string | `nil` | Overrides the chart's name. Used to change the infix in the resource names. |
| rbac.allowDiscoveryKubernetes | bool | `true` | Grant rules to allow created RBAC resources to work with `discovery.kubernetes` component. |
| rbac.allowEventHandler | bool | `true` | Grant rules to allow created RBAC resources to work with `eventhandler` integration. |
| rbac.allowLokiSource | bool | `true` | Grant rules to allow created RBAC resources to work with `loki.source.kubernetes` and `loki.source.podlogs` component. |
| rbac.allowMimirRulesKubernetes | bool | `true` | Grant rules to allow created RBAC resources to work with `mimir.rules.kubernetes` component. |
| rbac.allowOtelcolProcessorK8sAttributes | bool | `true` | Grant rules to allow created RBAC resources to work with `otelcol.processor.k8sattributes` component. |
| rbac.allowPrometheusKubernetes | bool | `true` | Grant rules to allow created RBAC resources to work with `prometheus.kubernetes.*` components. |
| rbac.allowRemoteKubernetes | bool | `true` | Grant rules to allow created RBAC resources to work with `remote.kubernetes.*` components. |
| rbac.create | bool | `true` | Whether to create RBAC resources for the agent. |
| service.annotations | object | `{}` | |
| service.clusterIP | string | `""` | Cluster IP, can be set to None, empty "" or an IP address |
Expand Down
14 changes: 14 additions & 0 deletions operations/helm/charts/grafana-agent/templates/rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
labels:
{{- include "grafana-agent.labels" . | nindent 4 }}
rules:
{{- if .Values.rbac.allowDiscoveryKubernetes }}
# Rules which allow discovery.kubernetes to function.
- apiGroups:
- ""
Expand All @@ -24,6 +25,8 @@ rules:
- get
- list
- watch
{{- end }}
{{- if .Values.rbac.allowLokiSource }}
# Rules which allow loki.source.kubernetes and loki.source.podlogs to work.
- apiGroups:
- ""
Expand All @@ -43,6 +46,8 @@ rules:
- get
- list
- watch
{{- end }}
{{- if .Values.rbac.allowMimirRulesKubernetes }}
# Rules which allow mimir.rules.kubernetes to work.
- apiGroups: ["monitoring.coreos.com"]
resources:
Expand All @@ -55,6 +60,8 @@ rules:
- /metrics
verbs:
- get
{{- end }}
{{- if .Values.rbac.allowPrometheusKubernetes }}
# Rules for prometheus.kubernetes.*
- apiGroups: ["monitoring.coreos.com"]
resources:
Expand All @@ -65,6 +72,8 @@ rules:
- get
- list
- watch
{{- end }}
{{- if .Values.rbac.allowEventHandler }}
# Rules which allow eventhandler to work.
- apiGroups:
- ""
Expand All @@ -74,6 +83,8 @@ rules:
- get
- list
- watch
{{- end }}
{{- if .Values.rbac.allowRemoteKubernetes }}
# needed for remote.kubernetes.*
- apiGroups: [""]
resources:
Expand All @@ -83,13 +94,16 @@ rules:
- get
- list
- watch
{{- end }}
{{- if .Values.rbac.allowOtelcolProcessorK8sAttributes }}
# needed for otelcol.processor.k8sattributes
- apiGroups: ["apps"]
resources: ["replicasets"]
verbs: ["get", "list", "watch"]
- apiGroups: ["extensions"]
resources: ["replicasets"]
verbs: ["get", "list", "watch"]
{{- end }}

---

Expand Down
14 changes: 14 additions & 0 deletions operations/helm/charts/grafana-agent/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,20 @@ image:
rbac:
# -- Whether to create RBAC resources for the agent.
create: true
# -- Grant rules to allow created RBAC resources to work with `discovery.kubernetes` component.
allowDiscoveryKubernetes: true
# -- Grant rules to allow created RBAC resources to work with `loki.source.kubernetes` and `loki.source.podlogs` component.
allowLokiSource: true
# -- Grant rules to allow created RBAC resources to work with `mimir.rules.kubernetes` component.
allowMimirRulesKubernetes: true
# -- Grant rules to allow created RBAC resources to work with `prometheus.kubernetes.*` components.
allowPrometheusKubernetes: true
# -- Grant rules to allow created RBAC resources to work with `eventhandler` integration.
allowEventHandler: true
# -- Grant rules to allow created RBAC resources to work with `remote.kubernetes.*` components.
allowRemoteKubernetes: true
# -- Grant rules to allow created RBAC resources to work with `otelcol.processor.k8sattributes` component.
allowOtelcolProcessorK8sAttributes: true

serviceAccount:
# -- Whether to create a service account for the Grafana Agent deployment.
Expand Down
Loading