Skip to content

Commit f093760

Browse files
NielDBNiel De Boever
andauthored
feat(helm): Add commonLabels and commonAnnotations (#870)
* Add commonLabels and commonAnnotations * Bump chart to 0.14.0 & update README.md --------- Co-authored-by: Niel De Boever <niel@Niels-MacBook-Pro-3.local>
1 parent d74005e commit f093760

File tree

12 files changed

+45
-14
lines changed

12 files changed

+45
-14
lines changed

helm/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ apiVersion: v2
22
name: sql-exporter
33
description: Database-agnostic SQL exporter for Prometheus
44
type: application
5-
version: 0.13.5
5+
version: 0.14.0
66
appVersion: 0.18.6
77
keywords:
88
- exporter

helm/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# sql-exporter
22

3-
![Version: 0.13.5](https://img.shields.io/badge/Version-0.13.5-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.18.6](https://img.shields.io/badge/AppVersion-0.18.6-informational?style=flat-square)
3+
![Version: 0.14.0](https://img.shields.io/badge/Version-0.14.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.18.6](https://img.shields.io/badge/AppVersion-0.18.6-informational?style=flat-square)
44

55
Database-agnostic SQL exporter for Prometheus
66

@@ -52,6 +52,8 @@ as an example.
5252
|-----|------|---------|-------------|
5353
| nameOverride | string | `""` | Provide a name in place of `sql-exporter` |
5454
| fullnameOverride | string | `""` | String to fully override "sql-exporter.fullname" |
55+
| commonLabels | object | `{}` | Common labels to add to all deployed resources |
56+
| commonAnnotations | object | `{}` | Common annotations to add to all the deployed resources |
5557
| image.repository | string | `"burningalchemist/sql_exporter"` | Image repository |
5658
| image.pullPolicy | string | `"IfNotPresent"` | Image pull policy |
5759
| image.tag | string | `appVersion` value from `Chart.yaml` | Image tag |

helm/templates/_helpers.tpl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ helm.sh/chart: {{ include "sql-exporter.chart" . }}
5151
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
5252
{{- end }}
5353
app.kubernetes.io/managed-by: {{ .Release.Service }}
54+
{{- if .Values.commonLabels }}
55+
{{ toYaml .Values.commonLabels }}
56+
{{- end }}
5457
{{- end }}
5558

5659
{{/*
@@ -61,6 +64,15 @@ app.kubernetes.io/name: {{ include "sql-exporter.name" . }}
6164
app.kubernetes.io/instance: {{ .Release.Name }}
6265
{{- end }}
6366

67+
{{/*
68+
Common annotations
69+
*/}}
70+
{{- define "sql-exporter.annotations" -}}
71+
{{- if .Values.commonAnnotations }}
72+
{{ toYaml .Values.commonAnnotations }}
73+
{{- end }}
74+
{{- end }}
75+
6476
{{/*
6577
Create the name of the service account to use
6678
*/}}

helm/templates/configmap.collectors.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ metadata:
55
name: {{ include "sql-exporter.fullname" . }}
66
labels:
77
{{- include "sql-exporter.labels" . | nindent 4 }}
8+
annotations:
9+
{{- include "sql-exporter.annotations" . | nindent 4 }}
810
data:
911
{{- range $k, $v := .Values.collectorFiles }}
1012
{{ $k }}: |-

helm/templates/deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ metadata:
44
name: {{ include "sql-exporter.fullname" . }}
55
labels:
66
{{- include "sql-exporter.labels" . | nindent 4 }}
7+
annotations:
8+
{{- include "sql-exporter.annotations" . | nindent 4 }}
79
spec:
810
replicas: {{ .Values.replicaCount }}
911
selector:

helm/templates/ingress.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ metadata:
88
{{- with .Values.ingress.labels }}
99
{{- toYaml . | nindent 4 }}
1010
{{- end }}
11-
{{- with .Values.ingress.annotations }}
1211
annotations:
13-
{{- toYaml . | nindent 4 }}
14-
{{- end }}
12+
{{- include "sql-exporter.annotations" . | nindent 4 }}
13+
{{- with .Values.ingress.annotations }}
14+
{{- toYaml . | nindent 4 }}
15+
{{- end }}
1516
spec:
1617
{{- if .Values.ingress.ingressClassName }}
1718
ingressClassName: {{ .Values.ingress.ingressClassName }}

helm/templates/secret.configuration.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ metadata:
88
name: {{ include "sql-exporter.fullname" . }}
99
labels:
1010
{{- include "sql-exporter.labels" . | nindent 4 }}
11+
annotations:
12+
{{- include "sql-exporter.annotations" . | nindent 4 }}
1113
type: Opaque
1214
stringData:
1315
sql_exporter.yml: |-

helm/templates/secret.tls.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ metadata:
88
name: {{ include "sql-exporter.tls.name" . }}
99
labels:
1010
{{- include "sql-exporter.labels" . | nindent 4 }}
11+
annotations:
12+
{{- include "sql-exporter.annotations" . | nindent 4 }}
1113
type: Opaque
1214
data:
1315
tls.crt: {{ (tpl (.Values.ingress.tls.crt | required "crt is required if you want to create tls secret.") .) | required "crt is required if you want to create tls secret." | b64enc | quote }}

helm/templates/service.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ metadata:
77
{{- with .Values.service.labels }}
88
{{- toYaml . | nindent 4 }}
99
{{- end }}
10-
{{- with .Values.service.annotations }}
1110
annotations:
12-
{{- toYaml . | nindent 4 }}
13-
{{- end }}
11+
{{- include "sql-exporter.annotations" . | nindent 4 }}
12+
{{- with .Values.service.annotations }}
13+
{{- toYaml . | nindent 4 }}
14+
{{- end }}
1415
spec:
1516
type: {{ .Values.service.type }}
1617
ports:

helm/templates/serviceaccount.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@ apiVersion: v1
33
kind: ServiceAccount
44
metadata:
55
name: {{ template "sql-exporter.fullname" . }}
6-
{{- with .Values.serviceAccount.annotations}}
7-
annotations:
8-
{{- toYaml . | nindent 4 }}
9-
{{- end }}
106
labels:
7+
{{- include "sql-exporter.labels" . | nindent 4 }}
118
{{- with .Values.serviceAccount.labels }}
12-
{{- toYaml . | nindent 4 }}
9+
{{- toYaml . | nindent 4 }}
10+
{{- end }}
11+
annotations:
12+
{{- include "sql-exporter.annotations" . | nindent 4 }}
13+
{{- with .Values.serviceAccount.annotations}}
14+
{{- toYaml . | nindent 4 }}
1315
{{- end }}
14-
{{- include "sql-exporter.labels" . | nindent 4 }}
1516
automountServiceAccountToken: {{ default "false" .Values.serviceAccount.automountServiceAccountToken }}
1617
{{- end }}

0 commit comments

Comments
 (0)