Skip to content

Commit

Permalink
chore: add common labels and annotations to pods (#25)
Browse files Browse the repository at this point in the history
* chore: add common labels and annotations to pods

* update prometheusrule and servicemonitor
  • Loading branch information
ravisingal authored Sep 27, 2024
1 parent 789c233 commit 1abf18f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
4 changes: 3 additions & 1 deletion helm/templates/prometheusrules.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- if and ( .Capabilities.APIVersions.Has "monitoring.coreos.com/v1" ) ( .Values.prometheusrule.enabled ) }}
{{- if .Values.prometheusrule.enabled }}
{{- if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1" }}
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
Expand Down Expand Up @@ -115,3 +116,4 @@ spec:
summary: "All zookeeper containers in the Zookeeper pods down or in CrashLookBackOff status"
message: "All zookeeper containers in the Zookeeper pods have been down or in CrashLookBackOff status for 3 minutes"
{{- end }}
{{- end }}
6 changes: 5 additions & 1 deletion helm/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{{- if and ( .Capabilities.APIVersions.Has "monitoring.coreos.com/v1" ) ( .Values.servicemonitor.enabled ) ( .Values.prometheus.jmx.enabled ) }}
{{- if .Values.servicemonitor.enabled }}
{{- if .Values.prometheus.jmx.enabled }}
{{- if .Capabilities.APIVersions.Has "monitoring.coreos.com/v1" }}
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
Expand Down Expand Up @@ -33,3 +35,5 @@ spec:
matchNames:
- {{ .Release.Namespace }}
{{- end }}
{{- end }}
{{- end }}
6 changes: 3 additions & 3 deletions helm/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ spec:
labels:
app: {{ include "zookeeper.name" . }}
release: {{ .Release.Name }}
{{- with .Values.podLabels }}
{{- with merge .Values.podLabels .Values.commonPodLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.podAnnotations }}
{{- with merge .Values.podAnnotations .Values.commonPodAnnotations }}
annotations:
{{- toYaml .Values.podAnnotations | nindent 8 }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
serviceAccountName: {{ template "zookeeper.serviceAccountName" . }}
Expand Down
4 changes: 4 additions & 0 deletions helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ podLabels: {}

podAnnotations: {}

commonPodLabels: {}

commonPodAnnotations: {}

serviceAccount:
create: true
name: ""
Expand Down

0 comments on commit 1abf18f

Please sign in to comment.