Skip to content

Commit

Permalink
[prometheus-kafka-exporter] Support additional labels on pod and depl…
Browse files Browse the repository at this point in the history
…oyment (#4247)

* feat(prometheus-kafka-exporter): Allow configuration of custom labels on deployment and pod

Signed-off-by: Mats Andresen <[email protected]>

* Update Chart.yaml

Signed-off-by: zeritti <[email protected]>

* Update pod and deployment labels

Signed-off-by: zeritti <[email protected]>

* Do not render empty annotations and resources

Signed-off-by: zeritti <[email protected]>

* Update README file

Signed-off-by: zeritti <[email protected]>

* Update README for textlint

Signed-off-by: zeritti <[email protected]>

---------

Signed-off-by: Mats Andresen <[email protected]>
Signed-off-by: zeritti <[email protected]>
Co-authored-by: zeritti <[email protected]>
  • Loading branch information
maandr and zeritti authored Feb 24, 2024
1 parent a98a65d commit b400181
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 12 deletions.
2 changes: 1 addition & 1 deletion charts/prometheus-kafka-exporter/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ appVersion: "v1.7.0"
description: A Helm chart to export the metrics from Kafka in Prometheus format using the kafka-exporter from https://github.com/danielqsj/kafka_exporter
name: prometheus-kafka-exporter
home: https://github.com/danielqsj/kafka_exporter
version: 2.8.0
version: 2.9.0
kubeVersion: ">=1.19.0-0"
sources:
- https://gkarthiks.github.io/helm-charts/charts/prometheus-kafka-exporter
Expand Down
10 changes: 5 additions & 5 deletions charts/prometheus-kafka-exporter/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# prometheus-kafka-exporter
# Prometheus Kafka Exporter

A Prometheus exporter for [Apacher Kafka](https://kafka.apache.org/) metrics.

Expand All @@ -12,14 +12,14 @@ This chart bootstraps a [Kafka Exporter](https://github.com/danielqsj/kafka_expo
Helm v2 is no longer supported from chart version 2.0.0.

## Get Repository Info

<!-- textlint-disable terminology -->
```console
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
```

_See [`helm repo`](https://helm.sh/docs/helm/helm_repo/) for command documentation._

_See [helm repo](https://helm.sh/docs/helm/helm_repo/) for command documentation._
<!-- textlint-enable -->
## Install Chart

```console
Expand All @@ -44,7 +44,7 @@ _See [helm uninstall](https://helm.sh/docs/helm/helm_uninstall/) for command doc
## Upgrading Chart

```console
helm upgrade [RELEASE_NAME] [CHART] --install
helm upgrade [RELEASE_NAME] prometheus-community/prometheus-kafka-exporter --install
```

_See [helm upgrade](https://helm.sh/docs/helm/helm_upgrade/) for command documentation._
Expand Down
16 changes: 12 additions & 4 deletions charts/prometheus-kafka-exporter/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ metadata:
chart: {{ template "prometheus-kafka-exporter.chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
{{- with .Values.deploymentLabels }}
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
Expand All @@ -15,11 +18,15 @@ spec:
release: {{ .Release.Name }}
template:
metadata:
annotations:
{{ toYaml .Values.annotations | indent 8 }}
{{- with .Values.annotations }}
annotations: {{ toYaml . | nindent 8 }}
{{- end }}
labels:
app: {{ template "prometheus-kafka-exporter.name" . }}
release: {{ .Release.Name }}
{{- with .Values.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
{{- if .Values.securityContext }}
securityContext:
Expand Down Expand Up @@ -115,8 +122,9 @@ spec:
readinessProbe:
{{- toYaml .Values.readiness.probe | trim | nindent 12 }}
{{- end }}
resources:
{{ toYaml .Values.resources | indent 12 }}
{{- with .Values.resources }}
resources: {{ toYaml . | nindent 12 }}
{{- end }}
{{- with .Values.containerSecurityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
Expand Down
5 changes: 3 additions & 2 deletions charts/prometheus-kafka-exporter/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ apiVersion: v1
kind: Service
metadata:
name: {{ template "prometheus-kafka-exporter.fullname" . }}
annotations:
{{ toYaml .Values.service.annotations | indent 4 }}
{{- with .Values.service.annotations }}
annotations: {{ toYaml . | nindent 4 }}
{{- end }}
labels:
app: {{ template "prometheus-kafka-exporter.name" . }}
chart: {{ template "prometheus-kafka-exporter.chart" . }}
Expand Down
7 changes: 7 additions & 0 deletions charts/prometheus-kafka-exporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ command: []

imagePullSecrets: []

# Additional labels for deployment
deploymentLabels: {}

global:
# To help compatibility with other charts which use global.imagePullSecrets.
# Allow either an array of {name: pullSecret} maps (k8s-style), or an array of strings (more common helm-style).
Expand Down Expand Up @@ -126,6 +129,9 @@ prometheus:
# replacement: $1
# action: replace

# Additional labels for pod
podLabels: {}

resources: {}
# We usually recommend not to specify default resources and to leave this as a conscious
# choice for the user. This also increases chances charts run on environments with little
Expand All @@ -140,6 +146,7 @@ resources: {}

nodeSelector: {}

# Annotations to attach to pod
annotations: {}

tolerations: []
Expand Down

0 comments on commit b400181

Please sign in to comment.