Skip to content

Commit

Permalink
Helm: Add service labels and annotations (grafana#8627)
Browse files Browse the repository at this point in the history
Support setting labels and annotations for all services
in the Helm chart.
Move label configuration for read, write and table
manager services to #component.service.labels to improve
consistency between components.
  • Loading branch information
rubenvw-ngdata committed Sep 7, 2023
1 parent 7f6c910 commit 9bc1c84
Show file tree
Hide file tree
Showing 17 changed files with 279 additions and 35 deletions.
106 changes: 98 additions & 8 deletions docs/sources/setup/install/helm/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -304,9 +304,18 @@ null
</td>
</tr>
<tr>
<td>backend.serviceLabels</td>
<td>backend.service.annotations</td>
<td>object</td>
<td>Labels for ingester service</td>
<td>Annotations for backend Service</td>
<td><pre lang="json">
{}
</pre>
</td>
</tr>
<tr>
<td>backend.service.labels</td>
<td>object</td>
<td>Additional labels for backend Service</td>
<td><pre lang="json">
{}
</pre>
Expand Down Expand Up @@ -2127,6 +2136,24 @@ null
"http_listen_port": 3100
}
</pre>
</td>
</tr>
<tr>
<td>loki.serviceAnnotations</td>
<td>object</td>
<td>Common annotations for all services</td>
<td><pre lang="json">
{}
</pre>
</td>
</tr>
<tr>
<td>loki.serviceLabels</td>
<td>object</td>
<td>Common labels for all services</td>
<td><pre lang="json">
{}
</pre>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -2496,6 +2523,24 @@ null
<td><pre lang="json">
{}
</pre>
</td>
</tr>
<tr>
<td>monitoring.lokiCanary.service.annotations</td>
<td>object</td>
<td>Annotations for loki-canary Service</td>
<td><pre lang="json">
{}
</pre>
</td>
</tr>
<tr>
<td>monitoring.lokiCanary.service.labels</td>
<td>object</td>
<td>Additional labels for loki-canary Service</td>
<td><pre lang="json">
{}
</pre>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -3304,9 +3349,18 @@ null
</td>
</tr>
<tr>
<td>read.serviceLabels</td>
<td>read.service.annotations</td>
<td>object</td>
<td>Labels for read service</td>
<td>Annotations for read Service</td>
<td><pre lang="json">
{}
</pre>
</td>
</tr>
<tr>
<td>read.service.labels</td>
<td>object</td>
<td>Additional labels for read Service</td>
<td><pre lang="json">
{}
</pre>
Expand Down Expand Up @@ -3661,6 +3715,24 @@ null
<td><pre lang="json">
{}
</pre>
</td>
</tr>
<tr>
<td>singleBinary.service.annotations</td>
<td>object</td>
<td>Annotations for single binary Service</td>
<td><pre lang="json">
{}
</pre>
</td>
</tr>
<tr>
<td>singleBinary.service.labels</td>
<td>object</td>
<td>Additional labels for single binary Service</td>
<td><pre lang="json">
{}
</pre>
</td>
</tr>
<tr>
Expand Down Expand Up @@ -3880,9 +3952,18 @@ false
</td>
</tr>
<tr>
<td>tableManager.serviceLabels</td>
<td>tableManager.service.annotations</td>
<td>object</td>
<td>Labels for table-manager service</td>
<td>Annotations for table-manager Service</td>
<td><pre lang="json">
{}
</pre>
</td>
</tr>
<tr>
<td>tableManager.service.labels</td>
<td>object</td>
<td>Additional labels for table-manager Service</td>
<td><pre lang="json">
{}
</pre>
Expand Down Expand Up @@ -4359,9 +4440,18 @@ null
</td>
</tr>
<tr>
<td>write.serviceLabels</td>
<td>write.service.annotations</td>
<td>object</td>
<td>Annotations for write Service</td>
<td><pre lang="json">
{}
</pre>
</td>
</tr>
<tr>
<td>write.service.labels</td>
<td>object</td>
<td>Labels for ingester service</td>
<td>Additional labels for write Service</td>
<td><pre lang="json">
{}
</pre>
Expand Down
5 changes: 5 additions & 0 deletions production/helm/loki/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ Entries should include a reference to the pull request that introduced the chang

[//]: # (<AUTOMATED_UPDATES_LOCATOR> : do not remove this line. This locator is used by the CI pipeline to automatically create a changelog entry for each new Loki release. Add other chart versions and respective changelog entries bellow this line.)

## 5.18.1

- [ENHANCEMENT] #8627 Add service labels and annotations for all services.
- [CHANGE] #8627 Move read, write and table manager labels from #component.serviceLabels to #component.service.labels to improve consistency.

## 5.18.0

- [CHANGE] Changed version of Loki to 2.9.0
Expand Down
2 changes: 1 addition & 1 deletion production/helm/loki/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: loki
description: Helm chart for Grafana Loki in simple, scalable mode
type: application
appVersion: 2.9.0
version: 5.18.0
version: 5.18.1
home: https://grafana.github.io/helm-charts
sources:
- https://github.com/grafana/loki
Expand Down
2 changes: 1 addition & 1 deletion production/helm/loki/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# loki

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

Helm chart for Grafana Loki in simple, scalable mode

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,21 @@ metadata:
namespace: {{ $.Release.Namespace }}
labels:
{{- include "loki.backendSelectorLabels" . | nindent 4 }}
{{- with .Values.loki.serviceLabels }}
{{- toYaml . | nindent 4}}
{{- end }}
{{- with .Values.backend.service.labels }}
{{- toYaml . | nindent 4}}
{{- end }}
variant: headless
prometheus.io/service-monitor: "false"
annotations:
{{- with .Values.loki.serviceAnnotations }}
{{- toYaml . | nindent 4}}
{{- end }}
{{- with .Values.backend.service.annotations }}
{{- toYaml . | nindent 4}}
{{- end }}
spec:
type: ClusterIP
clusterIP: None
Expand Down
14 changes: 12 additions & 2 deletions production/helm/loki/templates/backend/service-backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,18 @@ metadata:
namespace: {{ $.Release.Namespace }}
labels:
{{- include "loki.backendLabels" . | nindent 4 }}
{{- with .Values.backend.serviceLabels }}
{{- toYaml . | nindent 4 }}
{{- with .Values.loki.serviceLabels }}
{{- toYaml . | nindent 4}}
{{- end }}
{{- with .Values.backend.service.labels }}
{{- toYaml . | nindent 4}}
{{- end }}
annotations:
{{- with .Values.loki.serviceAnnotations }}
{{- toYaml . | nindent 4}}
{{- end }}
{{- with .Values.backend.service.annotations }}
{{- toYaml . | nindent 4}}
{{- end }}
spec:
type: ClusterIP
Expand Down
14 changes: 10 additions & 4 deletions production/helm/loki/templates/gateway/service-gateway.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,19 @@ metadata:
namespace: {{ $.Release.Namespace }}
labels:
{{- include "loki.gatewayLabels" . | nindent 4 }}
{{- with .Values.loki.serviceLabels }}
{{- toYaml . | nindent 4}}
{{- end }}
{{- with .Values.gateway.service.labels }}
{{- toYaml . | nindent 4 }}
{{- toYaml . | nindent 4}}
{{- end }}
{{- with .Values.gateway.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.loki.serviceAnnotations }}
{{- toYaml . | nindent 4}}
{{- end }}
{{- with .Values.gateway.service.annotations }}
{{- toYaml . | nindent 4}}
{{- end }}
spec:
type: {{ .Values.gateway.service.type }}
{{- with .Values.gateway.service.clusterIP }}
Expand Down
13 changes: 13 additions & 0 deletions production/helm/loki/templates/loki-canary/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@ metadata:
namespace: {{ $.Release.Namespace }}
labels:
{{- include "loki-canary.labels" $ | nindent 4 }}
{{- with $.Values.loki.serviceLabels }}
{{- toYaml . | nindent 4}}
{{- end }}
{{- with .service.labels }}
{{- toYaml . | nindent 4}}
{{- end }}
annotations:
{{- with $.Values.loki.serviceAnnotations }}
{{- toYaml . | nindent 4}}
{{- end }}
{{- with .service.annotations }}
{{- toYaml . | nindent 4}}
{{- end }}
spec:
type: ClusterIP
ports:
Expand Down
14 changes: 14 additions & 0 deletions production/helm/loki/templates/read/service-read-headless.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,21 @@ metadata:
namespace: {{ $.Release.Namespace }}
labels:
{{- include "loki.readSelectorLabels" . | nindent 4 }}
{{- with .Values.loki.serviceLabels }}
{{- toYaml . | nindent 4}}
{{- end }}
{{- with .Values.read.service.labels }}
{{- toYaml . | nindent 4}}
{{- end }}
variant: headless
prometheus.io/service-monitor: "false"
annotations:
{{- with .Values.loki.serviceAnnotations }}
{{- toYaml . | nindent 4}}
{{- end }}
{{- with .Values.read.service.annotations }}
{{- toYaml . | nindent 4}}
{{- end }}
spec:
type: ClusterIP
clusterIP: None
Expand Down
14 changes: 12 additions & 2 deletions production/helm/loki/templates/read/service-read.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,18 @@ metadata:
namespace: {{ $.Release.Namespace }}
labels:
{{- include "loki.readLabels" . | nindent 4 }}
{{- with .Values.read.serviceLabels }}
{{- toYaml . | nindent 4 }}
{{- with .Values.loki.serviceLabels }}
{{- toYaml . | nindent 4}}
{{- end }}
{{- with .Values.read.service.labels }}
{{- toYaml . | nindent 4}}
{{- end }}
annotations:
{{- with .Values.loki.serviceAnnotations }}
{{- toYaml . | nindent 4}}
{{- end }}
{{- with .Values.read.service.annotations }}
{{- toYaml . | nindent 4}}
{{- end }}
spec:
type: ClusterIP
Expand Down
13 changes: 13 additions & 0 deletions production/helm/loki/templates/single-binary/service-headless.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,21 @@ metadata:
namespace: {{ $.Release.Namespace }}
labels:
{{- include "loki.labels" . | nindent 4 }}
{{- with .Values.loki.serviceLabels }}
{{- toYaml . | nindent 4}}
{{- end }}
{{- with .Values.singleBinary.service.labels }}
{{- toYaml . | nindent 4}}
{{- end }}
variant: headless
prometheus.io/service-monitor: "false"
annotations:
{{- with .Values.loki.serviceAnnotations }}
{{- toYaml . | nindent 4}}
{{- end }}
{{- with .Values.singleBinary.service.annotations }}
{{- toYaml . | nindent 4}}
{{- end }}
spec:
clusterIP: None
ports:
Expand Down
13 changes: 13 additions & 0 deletions production/helm/loki/templates/single-binary/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@ metadata:
namespace: {{ $.Release.Namespace }}
labels:
{{- include "loki.labels" . | nindent 4 }}
{{- with .Values.loki.serviceLabels }}
{{- toYaml . | nindent 4}}
{{- end }}
{{- with .Values.singleBinary.service.labels }}
{{- toYaml . | nindent 4}}
{{- end }}
annotations:
{{- with .Values.loki.serviceAnnotations }}
{{- toYaml . | nindent 4}}
{{- end }}
{{- with .Values.singleBinary.service.annotations }}
{{- toYaml . | nindent 4}}
{{- end }}
spec:
type: ClusterIP
ports:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,20 @@ metadata:
name: {{ include "loki.fullname" . }}-table-manager
labels:
{{- include "loki.labels" . | nindent 4 }}
{{- with .Values.tableManager.serviceLabels }}
{{- toYaml . | nindent 4 }}
{{- with .Values.loki.serviceLabels }}
{{- toYaml . | nindent 4}}
{{- end }}
{{- with .Values.tableManager.service.labels }}
{{- toYaml . | nindent 4}}
{{- end }}
app.kubernetes.io/component: table-manager
{{- with .Values.loki.serviceAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.loki.serviceAnnotations }}
{{- toYaml . | nindent 4}}
{{- end }}
{{- with .Values.tableManager.service.annotations }}
{{- toYaml . | nindent 4}}
{{- end }}
spec:
type: ClusterIP
ports:
Expand Down
Loading

0 comments on commit 9bc1c84

Please sign in to comment.