Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[prometheus-statsd-exporter] Add DaemonSet option to statsd exporter and update helm chart options #4588

2 changes: 1 addition & 1 deletion charts/prometheus-statsd-exporter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
name: prometheus-statsd-exporter
description: A Helm chart for prometheus stats-exporter
version: 0.13.1
version: 0.14.0
appVersion: v0.26.1
home: https://github.com/prometheus/statsd_exporter
sources:
Expand Down
132 changes: 132 additions & 0 deletions charts/prometheus-statsd-exporter/templates/daemonset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
{{- if (eq .Values.kind "DaemonSet") }}
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: {{ include "prometheus-statsd-exporter.fullname" . }}
labels:
{{- include "prometheus-statsd-exporter.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
revisionHistoryLimit: {{ .Values.deploymentRevisionHistoryLimit | default 10 }}
{{- with .Values.updateStrategy }}
updateStrategy:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
selector:
matchLabels:
{{- include "prometheus-statsd-exporter.selectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
{{- with .Values.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "prometheus-statsd-exporter.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "prometheus-statsd-exporter.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- if .Values.priorityClassName }}
priorityClassName: {{ .Values.priorityClassName }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12 }}
{{- with .Values.extraEnv }}
env:
{{- range $key, $value := . }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }}
{{- end }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
args:
- --web.listen-address=:{{ .Values.service.port }}
- --web.telemetry-path={{ .Values.service.path }}
{{- if .Values.statsd.udpPort }}
- --statsd.listen-udp=:{{ .Values.statsd.udpPort }}
{{- else }}
- --statsd.listen-udp=
{{- end }}
{{- if .Values.statsd.tcpPort }}
- --statsd.listen-tcp=:{{ .Values.statsd.tcpPort }}
{{- else }}
- --statsd.listen-tcp=
{{- end }}
- --statsd.cache-size={{ .Values.statsd.cacheSize }}
- --statsd.event-queue-size={{ .Values.statsd.eventQueueSize }}
- --statsd.event-flush-threshold={{ .Values.statsd.eventFlushThreshold }}
- --statsd.event-flush-interval={{ .Values.statsd.eventFlushInterval }}
{{- if or .Values.statsd.mappingConfigMapName .Values.statsd.mappingConfig }}
- --statsd.mapping-config=/etc/prometheus-statsd-exporter/statsd-mapping.conf
{{- end }}
{{- if .Values.extraArgs }}
{{- toYaml .Values.extraArgs | nindent 12 }}
{{- end }}
ports:
- name: http
containerPort: {{ .Values.service.port }}
protocol: TCP
{{- if .Values.statsd.tcpPort }}
- name: statsd-tcp
containerPort: {{ .Values.statsd.tcpPort }}
protocol: TCP
{{- end }}
{{- if .Values.statsd.udpPort }}
- name: statsd-udp
containerPort: {{ .Values.statsd.udpPort }}
protocol: UDP
{{- end }}
livenessProbe:
{{- toYaml .Values.livenessProbe | nindent 12 }}
readinessProbe:
{{- toYaml .Values.readinessProbe | nindent 12 }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- if or .Values.statsd.mappingConfigMapName .Values.statsd.mappingConfig }}
volumeMounts:
- name: statsd-mapping-config
mountPath: /etc/prometheus-statsd-exporter
{{- end }}
{{- if .Values.lifecycle }}
lifecycle:
{{- toYaml .Values.lifecycle | nindent 12 }}
{{- end }}
{{- if or .Values.statsd.mappingConfigMapName .Values.statsd.mappingConfig }}
volumes:
- name: statsd-mapping-config
configMap:
name: {{ template "prometheus-statsd-exporter.configMapName" . }}
items:
- key: {{ .Values.statsd.mappingConfigMapKey | default "statsd.mappingConf" }}
path: statsd-mapping.conf
{{- end }}
{{- with .Values.nodeSelector }}
dnsPolicy: {{ .Values.dnsPolicy }}
hostNetwork: {{ .Values.hostNetwork }}
hostPID: {{ .Values.hostPID }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
12 changes: 12 additions & 0 deletions charts/prometheus-statsd-exporter/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if (eq .Values.kind "Deployment") }}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand All @@ -8,6 +9,10 @@ spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
revisionHistoryLimit: {{ .Values.deploymentRevisionHistoryLimit | default 10 }}
{{- with .Values.strategy }}
strategy:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
selector:
matchLabels:
Expand All @@ -29,6 +34,9 @@ spec:
serviceAccountName: {{ include "prometheus-statsd-exporter.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
{{- if .Values.priorityClassName }}
priorityClassName: {{ .Values.priorityClassName }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
securityContext:
Expand Down Expand Up @@ -104,6 +112,9 @@ spec:
path: statsd-mapping.conf
{{- end }}
{{- with .Values.nodeSelector }}
dnsPolicy: {{ .Values.dnsPolicy }}
hostNetwork: {{ .Values.hostNetwork }}
hostPID: {{ .Values.hostPID }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
Expand All @@ -119,3 +130,4 @@ spec:
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
14 changes: 14 additions & 0 deletions charts/prometheus-statsd-exporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.

kind: Deployment

replicaCount: 1
# deploymentRevisionHistoryLimit: 10

Expand Down Expand Up @@ -120,6 +122,8 @@ securityContext: {}
# runAsNonRoot: true
# runAsUser: 1000

priorityClassName: ''

service:
type: ClusterIP
# The address on which to expose the web interface and generated Prometheus metrics.
Expand Down Expand Up @@ -167,10 +171,20 @@ autoscaling:
# Ref. https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/
lifecycle: {}

dnsPolicy: ClusterFirst

hostNetwork: false

hostPID: false

nodeSelector: {}

tolerations: []

affinity: {}

topologySpreadConstraints: []

strategy: {}

updateStrategy: {}