Skip to content

Commit

Permalink
[loki-distributed] Add overrides-exporter
Browse files Browse the repository at this point in the history
Signed-off-by: Romain BELORGEY <[email protected]>
  • Loading branch information
RomainBelorgey committed Mar 29, 2024
1 parent 7b85764 commit 2af23e4
Show file tree
Hide file tree
Showing 6 changed files with 257 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/loki-distributed/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: loki-distributed
description: Helm chart for Grafana Loki in microservices mode
type: application
appVersion: 2.9.5
version: 0.78.4
version: 0.78.5
home: https://grafana.github.io/helm-charts
sources:
- https://github.com/grafana/loki
Expand Down
19 changes: 18 additions & 1 deletion charts/loki-distributed/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# loki-distributed

![Version: 0.78.4](https://img.shields.io/badge/Version-0.78.4-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.9.5](https://img.shields.io/badge/AppVersion-2.9.5-informational?style=flat-square)
![Version: 0.78.5](https://img.shields.io/badge/Version-0.78.5-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.9.5](https://img.shields.io/badge/AppVersion-2.9.5-informational?style=flat-square)

Helm chart for Grafana Loki in microservices mode

Expand Down Expand Up @@ -476,6 +476,23 @@ kubectl delete statefulset RELEASE_NAME-loki-distributed-querier -n LOKI_NAMESPA
| networkPolicy.metrics.cidrs | list | `[]` | Specifies specific network CIDRs which are allowed to access the metrics port. In case you use namespaceSelector, you also have to specify your kubelet networks here. The metrics ports are also used for probes. |
| networkPolicy.metrics.namespaceSelector | object | `{}` | Specifies the namespaces which are allowed to access the metrics port |
| networkPolicy.metrics.podSelector | object | `{}` | Specifies the Pods which are allowed to access the metrics port. As this is cross-namespace communication, you also need the namespaceSelector. |
| overridesExporter.enabled | bool | `false` | Specifies whether the overrides-exporter should be enabled |
| overridesExporter.extraArgs | list | `[]` | Additional CLI args for the overrides-exporter |
| overridesExporter.extraContainers | list | `[]` | Containers to add to the overrides-exporter pods |
| overridesExporter.extraEnv | list | `[]` | Environment variables to add to the overrides-exporter pods |
| overridesExporter.extraEnvFrom | list | `[]` | Environment variables from secrets or configmaps to add to the overrides-exporter pods |
| overridesExporter.extraVolumeMounts | list | `[]` | Volume mounts to add to the overrides-exporter pods |
| overridesExporter.extraVolumes | list | `[]` | Volumes to add to the overrides-exporter pods |
| overridesExporter.image.registry | string | `nil` | The Docker registry for the overrides-exporter image. Overrides `loki.image.registry` |
| overridesExporter.image.repository | string | `nil` | Docker image repository for the overrides-exporter image. Overrides `loki.image.repository` |
| overridesExporter.image.tag | string | `nil` | Docker image tag for the overrides-exporter image. Overrides `loki.image.tag` |
| overridesExporter.nodeSelector | object | `{}` | Node selector for overrides-exporter pods |
| overridesExporter.podAnnotations | object | `{}` | Annotations for overrides-exporter pods |
| overridesExporter.podLabels | object | `{}` | Labels for overrides-exporter pods |
| overridesExporter.priorityClassName | string | `nil` | The name of the PriorityClass for overrides-exporter pods |
| overridesExporter.resources | object | `{}` | Resource requests and limits for the overrides-exporter |
| overridesExporter.serviceLabels | object | `{}` | Labels for overrides-exporter service |
| overridesExporter.tolerations | list | `[]` | Tolerations for overrides-exporter pods |
| prometheusRule.annotations | object | `{}` | PrometheusRule annotations |
| prometheusRule.enabled | bool | `false` | If enabled, a PrometheusRule resource for Prometheus Operator is created |
| prometheusRule.groups | list | `[]` | Contents of Prometheus rules file |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{{/*
overrides-exporter fullname
*/}}
{{- define "loki.overridesExporterFullname" -}}
{{ include "loki.fullname" . }}-overrides-exporter
{{- end }}

{{/*
overrides-exporter common labels
*/}}
{{- define "loki.overridesExporterLabels" -}}
{{ include "loki.labels" . }}
app.kubernetes.io/component: overrides-exporter
{{- end }}

{{/*
overrides-exporter selector labels
*/}}
{{- define "loki.overridesExporterSelectorLabels" -}}
{{ include "loki.selectorLabels" . }}
app.kubernetes.io/component: overrides-exporter
{{- end }}

{{/*
overrides-exporter image
*/}}
{{- define "loki.overridesExporterImage" -}}
{{- $dict := dict "loki" .Values.loki.image "service" .Values.overridesExporter.image "global" .Values.global.image "defaultVersion" .Chart.AppVersion -}}
{{- include "loki.lokiImage" $dict -}}
{{- end }}

{{/*
overrides-exporter priority class name
*/}}
{{- define "loki.overridesExporterPriorityClassName" -}}
{{- $pcn := coalesce .Values.global.priorityClassName .Values.overridesExporter.priorityClassName -}}
{{- if $pcn }}
priorityClassName: {{ $pcn }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
{{- if .Values.overridesExporter.enabled -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "loki.overridesExporterFullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "loki.overridesExporterLabels" . | nindent 4 }}
{{- with .Values.loki.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
replicas: 1
strategy:
{{- toYaml .Values.overridesExporter.strategy | nindent 4 }}
revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }}
selector:
matchLabels:
{{- include "loki.overridesExporterSelectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
{{- include "loki.config.checksum" . | nindent 8 }}
{{- with .Values.loki.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.overridesExporter.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "loki.overridesExporterSelectorLabels" . | nindent 8 }}
{{- with .Values.loki.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.overridesExporter.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
serviceAccountName: {{ include "loki.serviceAccountName" . }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- include "loki.overridesExporterPriorityClassName" . | nindent 6 }}
securityContext:
{{- toYaml .Values.loki.podSecurityContext | nindent 8 }}
{{- with .Values.overridesExporter.initContainers }}
initContainers:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: overrides-exporter
image: {{ include "loki.overridesExporterImage" . }}
imagePullPolicy: {{ .Values.loki.image.pullPolicy }}
{{- if or .Values.loki.command .Values.overridesExporter.command }}
command:
- {{ coalesce .Values.overridesExporter.command .Values.loki.command | quote }}
{{- end }}
args:
- -config.file=/etc/loki/config/config.yaml
- -target=overrides-exporter
{{- with .Values.overridesExporter.extraArgs }}
{{- toYaml . | nindent 12 }}
{{- end }}
ports:
- name: http
containerPort: 3100
protocol: TCP
{{- with .Values.overridesExporter.extraEnv }}
env:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.overridesExporter.extraEnvFrom }}
envFrom:
{{- toYaml . | nindent 12 }}
{{- end }}
securityContext:
{{- toYaml .Values.loki.containerSecurityContext | nindent 12 }}
{{- toYaml .Values.loki.readinessProbe | nindent 12 }}
{{- toYaml .Values.loki.livenessProbe | nindent 12 }}
volumeMounts:
- name: config
mountPath: /etc/loki/config
- name: runtime-config
mountPath: /var/{{ include "loki.name" . }}-runtime
- name: data
mountPath: /var/loki
{{- with .Values.overridesExporter.extraVolumeMounts }}
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.overridesExporter.resources }}
resources:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.overridesExporter.lifecycle }}
lifecycle:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- if .Values.overridesExporter.extraContainers }}
{{- toYaml .Values.overridesExporter.extraContainers | nindent 8}}
{{- end }}
{{- with .Values.overridesExporter.affinity }}
affinity:
{{- tpl . $ | nindent 8 }}
{{- end }}
{{- with .Values.overridesExporter.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.overridesExporter.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: config
{{- if .Values.loki.existingSecretForConfig }}
secret:
secretName: {{ .Values.loki.existingSecretForConfig }}
{{- else if .Values.loki.configAsSecret }}
secret:
secretName: {{ include "loki.fullname" . }}-config
{{- else }}
configMap:
name: {{ include "loki.fullname" . }}
{{- end }}
- name: runtime-config
configMap:
name: {{ template "loki.fullname" . }}-runtime
{{- with .Values.overridesExporter.extraVolumes }}
{{- toYaml . | nindent 8 }}
{{- end }}
- name: data
emptyDir: {}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{{- if .Values.overridesExporter.enabled -}}
apiVersion: v1
kind: Service
metadata:
name: {{ include "loki.overridesExporterFullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "loki.overridesExporterLabels" . | nindent 4 }}
{{- with .Values.overridesExporter.serviceLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.loki.serviceAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
type: ClusterIP
ports:
- name: http
port: 3100
targetPort: http
protocol: TCP
selector:
{{- include "loki.overridesExporterSelectorLabels" . | nindent 4 }}
{{- end -}}
38 changes: 38 additions & 0 deletions charts/loki-distributed/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1692,6 +1692,44 @@ indexGateway:
appProtocol:
grpc: ""

# Configuration for the overrides-exporter
overridesExporter:
# -- Specifies whether the overrides-exporter should be enabled
enabled: false
image:
# -- The Docker registry for the overrides-exporter image. Overrides `loki.image.registry`
registry: null
# -- Docker image repository for the overrides-exporter image. Overrides `loki.image.repository`
repository: null
# -- Docker image tag for the overrides-exporter image. Overrides `loki.image.tag`
tag: null
# -- The name of the PriorityClass for overrides-exporter pods
priorityClassName: null
# -- Labels for overrides-exporter pods
podLabels: {}
# -- Annotations for overrides-exporter pods
podAnnotations: {}
# -- Labels for overrides-exporter service
serviceLabels: {}
# -- Additional CLI args for the overrides-exporter
extraArgs: []
# -- Environment variables to add to the overrides-exporter pods
extraEnv: []
# -- Environment variables from secrets or configmaps to add to the overrides-exporter pods
extraEnvFrom: []
# -- Volume mounts to add to the overrides-exporter pods
extraVolumeMounts: []
# -- Volumes to add to the overrides-exporter pods
extraVolumes: []
# -- Resource requests and limits for the overrides-exporter
resources: {}
# -- Containers to add to the overrides-exporter pods
extraContainers: []
# -- Node selector for overrides-exporter pods
nodeSelector: {}
# -- Tolerations for overrides-exporter pods
tolerations: []

memcached:
readinessProbe:
tcpSocket:
Expand Down

0 comments on commit 2af23e4

Please sign in to comment.