mirror of https://github.com/grafana/loki
Loki Helm: add sidecar to find loki rules in configmaps and secrets (#9399)
**Disclaimer: this work has been done by @Jeinhaus in the [legacy repo](https://github.com/grafana/helm-charts/pull/1625), I have simply migrated here and tested it in our own infrastructure** --- **What this PR does / why we need it**: This PR adds a sidecar to the loki chart that queries the Kubernetes API to find Configmaps and/or Secrets that contain loki rules, similar to the way the grafana chart does it for dashboards, plugins or sources. **Special notes for your reviewer**: **Checklist** - [X] Reviewed the [`CONTRIBUTING.md`](https://github.com/grafana/loki/blob/main/CONTRIBUTING.md) guide (**required**) - [X] Documentation added - [ ] ~Tests updated~ - [x] `CHANGELOG.md` updated - [ ] ~Changes that require user attention or interaction to upgrade are documented in `docs/sources/upgrading/_index.md`~ *`CHANGELOG.md` updated*: I have not update the CHANGELOG as I can see that it hasn't been updated since the start of version 5. As this been automated now? Or should I had the change logs somewhere else? Or perhaps simply format my commit in a certain way so it gets generated? Apologies if this was documented somewhere and I missed it. --------- Co-authored-by: Julian Einhaus <julianeinhaus@gmx.de> Co-authored-by: bwlkr <billynwalker@gmail.com> Co-authored-by: Michel Hollands <42814411+MichelHollands@users.noreply.github.com>pull/10510/head helm-loki-5.19.0
parent
cc1b0dbc24
commit
c0f96a34eb
@ -0,0 +1,20 @@ |
||||
{{- if and (not .Values.rbac.namespaced) (not .Values.rbac.useExistingRole) }} |
||||
kind: ClusterRole |
||||
apiVersion: rbac.authorization.k8s.io/v1 |
||||
metadata: |
||||
labels: |
||||
{{- include "loki.labels" . | nindent 4 }} |
||||
{{- with .Values.annotations }} |
||||
annotations: |
||||
{{ toYaml . | indent 4 }} |
||||
{{- end }} |
||||
name: {{ template "loki.fullname" . }}-clusterrole |
||||
{{- if .Values.sidecar.rules.enabled }} |
||||
rules: |
||||
- apiGroups: [""] # "" indicates the core API group |
||||
resources: ["configmaps", "secrets"] |
||||
verbs: ["get", "watch", "list"] |
||||
{{- else }} |
||||
rules: [] |
||||
{{- end }} |
||||
{{- end }} |
@ -0,0 +1,24 @@ |
||||
{{- if and (not .Values.rbac.namespaced) }} |
||||
kind: ClusterRoleBinding |
||||
apiVersion: rbac.authorization.k8s.io/v1 |
||||
metadata: |
||||
name: {{ template "loki.fullname" . }}-clusterrolebinding |
||||
labels: |
||||
{{- include "loki.labels" . | nindent 4 }} |
||||
{{- with .Values.annotations }} |
||||
annotations: |
||||
{{ toYaml . | indent 4 }} |
||||
{{- end }} |
||||
subjects: |
||||
- kind: ServiceAccount |
||||
name: {{ template "loki.serviceAccountName" . }} |
||||
namespace: {{ .Release.Namespace }} |
||||
roleRef: |
||||
kind: ClusterRole |
||||
{{- if (not .Values.rbac.useExistingRole) }} |
||||
name: {{ template "loki.fullname" . }}-clusterrole |
||||
{{- else }} |
||||
name: {{ .Values.rbac.useExistingRole }} |
||||
{{- end }} |
||||
apiGroup: rbac.authorization.k8s.io |
||||
{{- end -}} |
Loading…
Reference in new issue