Skip to content

Commit

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

* update prometheusrule and servicemonitor

* update trivy ignore file
  • Loading branch information
ravisingal authored Sep 27, 2024
1 parent 9d474df commit f52ed31
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .trivyignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# com.google.protobuf:protobuf-java
CVE-2024-7254 exp:2024-10-31
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 @@ -92,3 +93,4 @@ spec:
summary: "One or more Kafka containers restarted too often"
message: "One or more Kafka containers were restarted too often within the last 5 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 @@ -32,3 +34,5 @@ spec:
matchNames:
- {{ .Release.Namespace }}
{{- end }}
{{- end }}
{{- end }}
8 changes: 4 additions & 4 deletions helm/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ spec:
labels:
app: {{ include "kafka.name" . }}
release: {{ .Release.Name }}
{{- with .Values.podLabels }}
{{- with merge .Values.podLabels .Values.commonPodLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.podAnnotations }}
{{- end }}
{{- with merge .Values.podAnnotations .Values.commonPodAnnotations }}
annotations:
{{- toYaml .Values.podAnnotations | nindent 8 }}
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
serviceAccountName: {{ template "kafka.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 f52ed31

Please sign in to comment.