From 165a41990bdd88188353c85b7c7101ee4364efdb Mon Sep 17 00:00:00 2001 From: Thomas <9749173+uhthomas@users.noreply.github.com> Date: Wed, 29 May 2024 16:31:26 +0100 Subject: [PATCH 1/8] [prometheus-smartctl-exporter] add rule for device temperature (#4572) Signed-off-by: Thomas Way Signed-off-by: Lukas Monkevicius --- charts/prometheus-smartctl-exporter/Chart.yaml | 2 +- charts/prometheus-smartctl-exporter/rules/rules.txt | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/charts/prometheus-smartctl-exporter/Chart.yaml b/charts/prometheus-smartctl-exporter/Chart.yaml index 8399b1aeb2f6..e3a2a61473d4 100644 --- a/charts/prometheus-smartctl-exporter/Chart.yaml +++ b/charts/prometheus-smartctl-exporter/Chart.yaml @@ -15,7 +15,7 @@ type: application # This is the chart version. This version number should be incremented each time you make changes # to the chart and its templates, including the app version. # Versions are expected to follow Semantic Versioning (https://semver.org/) -version: 0.8.0 +version: 0.9.0 # This is the version number of the application being deployed. This version number should be # incremented each time you make changes to the application. Versions are not expected to diff --git a/charts/prometheus-smartctl-exporter/rules/rules.txt b/charts/prometheus-smartctl-exporter/rules/rules.txt index ad249080fe0e..23c09adf1dcf 100644 --- a/charts/prometheus-smartctl-exporter/rules/rules.txt +++ b/charts/prometheus-smartctl-exporter/rules/rules.txt @@ -34,3 +34,10 @@ rules: for: 1m labels: severity: warning +- alert: SmartCTLDDeviceTemperature + expr: smartctl_device_temperature{temperature_type="current"} > 60 + annotations: + message: Device {{ $labels.device }} on instance {{ $labels.instance }} has temperature higher than 60°C + for: 1m + labels: + severity: warning From aab33ab44357f25ae50d85f6a829209e5aea5ea9 Mon Sep 17 00:00:00 2001 From: kbweave <106193439+kbweave@users.noreply.github.com> Date: Fri, 31 May 2024 00:10:18 -0600 Subject: [PATCH 2/8] [kube-state-metrics] separate ServiceMonitor values so they can be independently configured (#4562) Signed-off-by: Kyle Brown Signed-off-by: Lukas Monkevicius --- charts/kube-state-metrics/Chart.yaml | 2 +- .../templates/servicemonitor.yaml | 80 +++++++++---------- charts/kube-state-metrics/values.yaml | 60 +++++++++----- 3 files changed, 83 insertions(+), 59 deletions(-) diff --git a/charts/kube-state-metrics/Chart.yaml b/charts/kube-state-metrics/Chart.yaml index 4e2f08701a09..7a25fecdc89c 100644 --- a/charts/kube-state-metrics/Chart.yaml +++ b/charts/kube-state-metrics/Chart.yaml @@ -7,7 +7,7 @@ keywords: - prometheus - kubernetes type: application -version: 5.19.0 +version: 5.19.1 appVersion: 2.12.0 home: https://github.com/kubernetes/kube-state-metrics/ sources: diff --git a/charts/kube-state-metrics/templates/servicemonitor.yaml b/charts/kube-state-metrics/templates/servicemonitor.yaml index e2cde649ac5c..99d7fa92464a 100644 --- a/charts/kube-state-metrics/templates/servicemonitor.yaml +++ b/charts/kube-state-metrics/templates/servicemonitor.yaml @@ -40,79 +40,79 @@ spec: {{- end }} endpoints: - port: http - {{- if .Values.prometheus.monitor.interval }} - interval: {{ .Values.prometheus.monitor.interval }} + {{- if or .Values.prometheus.monitor.http.interval .Values.prometheus.monitor.interval }} + interval: {{ .Values.prometheus.monitor.http.interval | default .Values.prometheus.monitor.interval }} {{- end }} - {{- if .Values.prometheus.monitor.scrapeTimeout }} - scrapeTimeout: {{ .Values.prometheus.monitor.scrapeTimeout }} + {{- if or .Values.prometheus.monitor.http.scrapeTimeout .Values.prometheus.monitor.scrapeTimeout }} + scrapeTimeout: {{ .Values.prometheus.monitor.http.scrapeTimeout | default .Values.prometheus.monitor.scrapeTimeout }} {{- end }} - {{- if .Values.prometheus.monitor.proxyUrl }} - proxyUrl: {{ .Values.prometheus.monitor.proxyUrl}} + {{- if or .Values.prometheus.monitor.http.proxyUrl .Values.prometheus.monitor.proxyUrl }} + proxyUrl: {{ .Values.prometheus.monitor.http.proxyUrl | default .Values.prometheus.monitor.proxyUrl }} {{- end }} - {{- if .Values.prometheus.monitor.enableHttp2 }} - enableHttp2: {{ .Values.prometheus.monitor.enableHttp2}} + {{- if or .Values.prometheus.monitor.http.enableHttp2 .Values.prometheus.monitor.enableHttp2 }} + enableHttp2: {{ .Values.prometheus.monitor.http.enableHttp2 | default .Values.prometheus.monitor.enableHttp2 }} {{- end }} - {{- if .Values.prometheus.monitor.honorLabels }} + {{- if or .Values.prometheus.monitor.http.honorLabels .Values.prometheus.monitor.honorLabels }} honorLabels: true {{- end }} - {{- if .Values.prometheus.monitor.metricRelabelings }} + {{- if or .Values.prometheus.monitor.http.metricRelabelings .Values.prometheus.monitor.metricRelabelings }} metricRelabelings: - {{- toYaml .Values.prometheus.monitor.metricRelabelings | nindent 8 }} + {{- toYaml (.Values.prometheus.monitor.http.metricRelabelings | default .Values.prometheus.monitor.metricRelabelings) | nindent 8 }} {{- end }} - {{- if .Values.prometheus.monitor.relabelings }} + {{- if or .Values.prometheus.monitor.http.relabelings .Values.prometheus.monitor.relabelings }} relabelings: - {{- toYaml .Values.prometheus.monitor.relabelings | nindent 8 }} + {{- toYaml (.Values.prometheus.monitor.http.relabelings | default .Values.prometheus.monitor.relabelings) | nindent 8 }} {{- end }} - {{- if .Values.prometheus.monitor.scheme }} - scheme: {{ .Values.prometheus.monitor.scheme }} + {{- if or .Values.prometheus.monitor.http.scheme .Values.prometheus.monitor.scheme }} + scheme: {{ .Values.prometheus.monitor.http.scheme | default .Values.prometheus.monitor.scheme }} {{- end }} - {{- if .Values.prometheus.monitor.tlsConfig }} + {{- if or .Values.prometheus.monitor.http.tlsConfig .Values.prometheus.monitor.tlsConfig }} tlsConfig: - {{- toYaml .Values.prometheus.monitor.tlsConfig | nindent 8 }} + {{- toYaml (.Values.prometheus.monitor.http.tlsConfig | default .Values.prometheus.monitor.tlsConfig) | nindent 8 }} {{- end }} - {{- if .Values.prometheus.monitor.bearerTokenFile }} - bearerTokenFile: {{ .Values.prometheus.monitor.bearerTokenFile }} + {{- if or .Values.prometheus.monitor.http.bearerTokenFile .Values.prometheus.monitor.bearerTokenFile }} + bearerTokenFile: {{ .Values.prometheus.monitor.http.bearerTokenFile | default .Values.prometheus.monitor.bearerTokenFile }} {{- end }} - {{- with .Values.prometheus.monitor.bearerTokenSecret }} + {{- with (.Values.prometheus.monitor.http.bearerTokenSecret | default .Values.prometheus.monitor.bearerTokenSecret) }} bearerTokenSecret: {{- toYaml . | nindent 8 }} {{- end }} {{- if .Values.selfMonitor.enabled }} - port: metrics - {{- if .Values.prometheus.monitor.interval }} - interval: {{ .Values.prometheus.monitor.interval }} + {{- if or .Values.prometheus.monitor.metrics.interval .Values.prometheus.monitor.interval }} + interval: {{ .Values.prometheus.monitor.metrics.interval | default .Values.prometheus.monitor.interval }} {{- end }} - {{- if .Values.prometheus.monitor.scrapeTimeout }} - scrapeTimeout: {{ .Values.prometheus.monitor.scrapeTimeout }} + {{- if or .Values.prometheus.monitor.metrics.scrapeTimeout .Values.prometheus.monitor.scrapeTimeout }} + scrapeTimeout: {{ .Values.prometheus.monitor.metrics.scrapeTimeout | default .Values.prometheus.monitor.scrapeTimeout }} {{- end }} - {{- if .Values.prometheus.monitor.proxyUrl }} - proxyUrl: {{ .Values.prometheus.monitor.proxyUrl}} + {{- if or .Values.prometheus.monitor.metrics.proxyUrl .Values.prometheus.monitor.proxyUrl }} + proxyUrl: {{ .Values.prometheus.monitor.metrics.proxyUrl | default .Values.prometheus.monitor.proxyUrl }} {{- end }} - {{- if .Values.prometheus.monitor.enableHttp2 }} - enableHttp2: {{ .Values.prometheus.monitor.enableHttp2}} + {{- if or .Values.prometheus.monitor.metrics.enableHttp2 .Values.prometheus.monitor.enableHttp2 }} + enableHttp2: {{ .Values.prometheus.monitor.metrics.enableHttp2 | default .Values.prometheus.monitor.enableHttp2 }} {{- end }} - {{- if .Values.prometheus.monitor.honorLabels }} + {{- if or .Values.prometheus.monitor.metrics.honorLabels .Values.prometheus.monitor.honorLabels }} honorLabels: true {{- end }} - {{- if .Values.prometheus.monitor.metricRelabelings }} + {{- if or .Values.prometheus.monitor.metrics.metricRelabelings .Values.prometheus.monitor.metricRelabelings }} metricRelabelings: - {{- toYaml .Values.prometheus.monitor.metricRelabelings | nindent 8 }} + {{- toYaml (.Values.prometheus.monitor.metrics.metricRelabelings | default .Values.prometheus.monitor.metricRelabelings) | nindent 8 }} {{- end }} - {{- if .Values.prometheus.monitor.relabelings }} + {{- if or .Values.prometheus.monitor.metrics.relabelings .Values.prometheus.monitor.relabelings }} relabelings: - {{- toYaml .Values.prometheus.monitor.relabelings | nindent 8 }} + {{- toYaml (.Values.prometheus.monitor.metrics.relabelings | default .Values.prometheus.monitor.relabelings) | nindent 8 }} {{- end }} - {{- if .Values.prometheus.monitor.scheme }} - scheme: {{ .Values.prometheus.monitor.scheme }} + {{- if or .Values.prometheus.monitor.metrics.scheme .Values.prometheus.monitor.scheme }} + scheme: {{ .Values.prometheus.monitor.metrics.scheme | default .Values.prometheus.monitor.scheme }} {{- end }} - {{- if .Values.prometheus.monitor.tlsConfig }} + {{- if or .Values.prometheus.monitor.metrics.tlsConfig .Values.prometheus.monitor.tlsConfig }} tlsConfig: - {{- toYaml .Values.prometheus.monitor.tlsConfig | nindent 8 }} + {{- toYaml (.Values.prometheus.monitor.metrics.tlsConfig | default .Values.prometheus.monitor.tlsConfig) | nindent 8 }} {{- end }} - {{- if .Values.prometheus.monitor.bearerTokenFile }} - bearerTokenFile: {{ .Values.prometheus.monitor.bearerTokenFile }} + {{- if or .Values.prometheus.monitor.metrics.bearerTokenFile .Values.prometheus.monitor.bearerTokenFile }} + bearerTokenFile: {{ .Values.prometheus.monitor.metrics.bearerTokenFile | default .Values.prometheus.monitor.bearerTokenFile }} {{- end }} - {{- with .Values.prometheus.monitor.bearerTokenSecret }} + {{- with (.Values.prometheus.monitor.metrics.bearerTokenSecret | default .Values.prometheus.monitor.bearerTokenSecret) }} bearerTokenSecret: {{- toYaml . | nindent 8 }} {{- end }} diff --git a/charts/kube-state-metrics/values.yaml b/charts/kube-state-metrics/values.yaml index 2e8283a89469..bb4fae2c0b52 100644 --- a/charts/kube-state-metrics/values.yaml +++ b/charts/kube-state-metrics/values.yaml @@ -165,7 +165,6 @@ prometheus: jobLabel: "" targetLabels: [] podTargetLabels: [] - interval: "" ## SampleLimit defines per-scrape limit on number of scraped samples that will be accepted. ## sampleLimit: 0 @@ -185,24 +184,49 @@ prometheus: ## Per-scrape limit on length of labels value that will be accepted for a sample. Only valid in Prometheus versions 2.27.0 and newer. ## labelValueLengthLimit: 0 - scrapeTimeout: "" - proxyUrl: "" - ## Whether to enable HTTP2 for servicemonitor - # enableHttp2: false selectorOverride: {} - honorLabels: false - metricRelabelings: [] - relabelings: [] - scheme: "" - ## File to read bearer token for scraping targets - bearerTokenFile: "" - ## Secret to mount to read bearer token for scraping targets. The secret needs - ## to be in the same namespace as the service monitor and accessible by the - ## Prometheus Operator - bearerTokenSecret: {} - # name: secret-name - # key: key-name - tlsConfig: {} + + ## kube-state-metrics endpoint + http: + interval: "" + scrapeTimeout: "" + proxyUrl: "" + ## Whether to enable HTTP2 for servicemonitor + enableHttp2: false + honorLabels: false + metricRelabelings: [] + relabelings: [] + scheme: "" + ## File to read bearer token for scraping targets + bearerTokenFile: "" + ## Secret to mount to read bearer token for scraping targets. The secret needs + ## to be in the same namespace as the service monitor and accessible by the + ## Prometheus Operator + bearerTokenSecret: {} + # name: secret-name + # key: key-name + tlsConfig: {} + + ## selfMonitor endpoint + metrics: + interval: "" + scrapeTimeout: "" + proxyUrl: "" + ## Whether to enable HTTP2 for servicemonitor + enableHttp2: false + honorLabels: false + metricRelabelings: [] + relabelings: [] + scheme: "" + ## File to read bearer token for scraping targets + bearerTokenFile: "" + ## Secret to mount to read bearer token for scraping targets. The secret needs + ## to be in the same namespace as the service monitor and accessible by the + ## Prometheus Operator + bearerTokenSecret: {} + # name: secret-name + # key: key-name + tlsConfig: {} ## Specify if a Pod Security Policy for kube-state-metrics must be created ## Ref: https://kubernetes.io/docs/concepts/policy/pod-security-policy/ From 004d8046893bbc9cdfbe99eca934da1988129f07 Mon Sep 17 00:00:00 2001 From: Wojciech Suszko <53919286+Woojciech@users.noreply.github.com> Date: Fri, 31 May 2024 22:55:05 +0200 Subject: [PATCH 3/8] [kube-prometheus-stack] introduce PVC claim retention field in prometheus operator (#4570) Signed-off-by: Lukas Monkevicius --- charts/kube-prometheus-stack/Chart.yaml | 2 +- .../templates/prometheus/prometheus.yaml | 4 ++++ charts/kube-prometheus-stack/values.yaml | 9 +++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/charts/kube-prometheus-stack/Chart.yaml b/charts/kube-prometheus-stack/Chart.yaml index 3a05c9afe415..ac5240a3ad37 100644 --- a/charts/kube-prometheus-stack/Chart.yaml +++ b/charts/kube-prometheus-stack/Chart.yaml @@ -23,7 +23,7 @@ name: kube-prometheus-stack sources: - https://github.com/prometheus-community/helm-charts - https://github.com/prometheus-operator/kube-prometheus -version: 59.0.0 +version: 59.1.0 appVersion: v0.74.0 kubeVersion: ">=1.19.0-0" home: https://github.com/prometheus-operator/kube-prometheus diff --git a/charts/kube-prometheus-stack/templates/prometheus/prometheus.yaml b/charts/kube-prometheus-stack/templates/prometheus/prometheus.yaml index 39b9a327bd71..ae95fd02a42c 100644 --- a/charts/kube-prometheus-stack/templates/prometheus/prometheus.yaml +++ b/charts/kube-prometheus-stack/templates/prometheus/prometheus.yaml @@ -261,6 +261,10 @@ spec: storage: {{ tpl (toYaml .Values.prometheus.prometheusSpec.storageSpec | indent 4) . }} {{- end }} +{{- with .Values.prometheus.prometheusSpec.persistentVolumeClaimRetentionPolicy }} + persistentVolumeClaimRetentionPolicy: + {{- toYaml . | nindent 4 }} +{{- end }} {{- if .Values.prometheus.prometheusSpec.podMetadata }} podMetadata: {{ tpl (toYaml .Values.prometheus.prometheusSpec.podMetadata | indent 4) . }} diff --git a/charts/kube-prometheus-stack/values.yaml b/charts/kube-prometheus-stack/values.yaml index fa00232ae0ce..5dd92fbd3803 100644 --- a/charts/kube-prometheus-stack/values.yaml +++ b/charts/kube-prometheus-stack/values.yaml @@ -3365,6 +3365,15 @@ prometheus: ## ref: https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#prometheusspec ## prometheusSpec: + ## Statefulset's persistent volume claim retention policy + ## pvcDeleteOnStsDelete and pvcDeleteOnStsScale determine whether + ## statefulset's PVCs are deleted (true) or retained (false) on scaling down + ## and deleting statefulset, respectively. Requires 1.27.0+. + ## Ref: https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#persistentvolumeclaim-retention + persistentVolumeClaimRetentionPolicy: {} + # whenDeleted: Retain + # whenScaled: Retain + ## If true, pass --storage.tsdb.max-block-duration=2h to prometheus. This is already done if using Thanos ## disableCompaction: false From 1fa6da1a5c8264268115b67f347f7b6a5cf676ac Mon Sep 17 00:00:00 2001 From: Lukas Monkevicius Date: Tue, 4 Jun 2024 10:37:03 -0700 Subject: [PATCH 4/8] Add DaemonSet option to statsd exporter Signed-off-by: Lukas Monkevicius --- charts/prometheus-statsd-exporter/Chart.yaml | 2 +- .../templates/daemonset.yaml | 129 ++++++++++++++++++ .../templates/deployment.yaml | 7 + charts/prometheus-statsd-exporter/values.yaml | 12 ++ 4 files changed, 149 insertions(+), 1 deletion(-) create mode 100644 charts/prometheus-statsd-exporter/templates/daemonset.yaml diff --git a/charts/prometheus-statsd-exporter/Chart.yaml b/charts/prometheus-statsd-exporter/Chart.yaml index 68e5cc644a9d..562feacb968b 100644 --- a/charts/prometheus-statsd-exporter/Chart.yaml +++ b/charts/prometheus-statsd-exporter/Chart.yaml @@ -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: diff --git a/charts/prometheus-statsd-exporter/templates/daemonset.yaml b/charts/prometheus-statsd-exporter/templates/daemonset.yaml new file mode 100644 index 000000000000..8aafa8434ff3 --- /dev/null +++ b/charts/prometheus-statsd-exporter/templates/daemonset.yaml @@ -0,0 +1,129 @@ +{{- 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 }} + {{- 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 }} + 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 }} + updateStrategy: + {{- toYaml . | nindent 4 }} +{{- end }} diff --git a/charts/prometheus-statsd-exporter/templates/deployment.yaml b/charts/prometheus-statsd-exporter/templates/deployment.yaml index 9c5204e636f1..8ad9aea844e6 100644 --- a/charts/prometheus-statsd-exporter/templates/deployment.yaml +++ b/charts/prometheus-statsd-exporter/templates/deployment.yaml @@ -1,3 +1,4 @@ +{{- if (eq .Values.kind "Deployment") }} apiVersion: apps/v1 kind: Deployment metadata: @@ -29,6 +30,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: @@ -119,3 +123,6 @@ spec: topologySpreadConstraints: {{- toYaml . | nindent 8 }} {{- end }} + strategy: + {{- toYaml . | nindent 4 }} +{{- end }} diff --git a/charts/prometheus-statsd-exporter/values.yaml b/charts/prometheus-statsd-exporter/values.yaml index c66156e40896..515a473df056 100644 --- a/charts/prometheus-statsd-exporter/values.yaml +++ b/charts/prometheus-statsd-exporter/values.yaml @@ -2,6 +2,8 @@ # This is a YAML-formatted file. # Declare variables to be passed into your templates. +kind: Deployment + replicaCount: 1 # deploymentRevisionHistoryLimit: 10 @@ -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. @@ -167,6 +171,10 @@ autoscaling: # Ref. https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/ lifecycle: {} +hostNetwork: false + +hostPID: false + nodeSelector: {} tolerations: [] @@ -174,3 +182,7 @@ tolerations: [] affinity: {} topologySpreadConstraints: [] + +strategy: {} + +updateStrategy: {} From f16c7fbab9b54cd2abdcb3f7d1f987bfb0d99e01 Mon Sep 17 00:00:00 2001 From: Lukas Monkevicius <64898324+lukas-unity@users.noreply.github.com> Date: Tue, 4 Jun 2024 10:48:43 -0700 Subject: [PATCH 5/8] add missing host network and host pod Signed-off-by: Lukas Monkevicius <64898324+lukas-unity@users.noreply.github.com> Signed-off-by: Lukas Monkevicius --- charts/prometheus-statsd-exporter/templates/deployment.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/charts/prometheus-statsd-exporter/templates/deployment.yaml b/charts/prometheus-statsd-exporter/templates/deployment.yaml index 8ad9aea844e6..2207119b885a 100644 --- a/charts/prometheus-statsd-exporter/templates/deployment.yaml +++ b/charts/prometheus-statsd-exporter/templates/deployment.yaml @@ -108,6 +108,8 @@ spec: path: statsd-mapping.conf {{- end }} {{- with .Values.nodeSelector }} + hostNetwork: {{ .Values.hostNetwork }} + hostPID: {{ .Values.hostPID }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} From d3c8321a45c5e53236f646b215897f732e4239ff Mon Sep 17 00:00:00 2001 From: Lukas Monkevicius Date: Wed, 5 Jun 2024 09:20:12 -0700 Subject: [PATCH 6/8] add dnspolicy Signed-off-by: Lukas Monkevicius --- charts/prometheus-statsd-exporter/templates/daemonset.yaml | 1 + charts/prometheus-statsd-exporter/templates/deployment.yaml | 1 + charts/prometheus-statsd-exporter/values.yaml | 2 ++ 3 files changed, 4 insertions(+) diff --git a/charts/prometheus-statsd-exporter/templates/daemonset.yaml b/charts/prometheus-statsd-exporter/templates/daemonset.yaml index 8aafa8434ff3..b0c90ebac29b 100644 --- a/charts/prometheus-statsd-exporter/templates/daemonset.yaml +++ b/charts/prometheus-statsd-exporter/templates/daemonset.yaml @@ -107,6 +107,7 @@ spec: path: statsd-mapping.conf {{- end }} {{- with .Values.nodeSelector }} + dnsPolicy: {{ .Values.dnsPolicy }} hostNetwork: {{ .Values.hostNetwork }} hostPID: {{ .Values.hostPID }} nodeSelector: diff --git a/charts/prometheus-statsd-exporter/templates/deployment.yaml b/charts/prometheus-statsd-exporter/templates/deployment.yaml index 2207119b885a..2ea7b7439f8a 100644 --- a/charts/prometheus-statsd-exporter/templates/deployment.yaml +++ b/charts/prometheus-statsd-exporter/templates/deployment.yaml @@ -108,6 +108,7 @@ spec: path: statsd-mapping.conf {{- end }} {{- with .Values.nodeSelector }} + dnsPolicy: {{ .Values.dnsPolicy }} hostNetwork: {{ .Values.hostNetwork }} hostPID: {{ .Values.hostPID }} nodeSelector: diff --git a/charts/prometheus-statsd-exporter/values.yaml b/charts/prometheus-statsd-exporter/values.yaml index 515a473df056..ad2484b931b4 100644 --- a/charts/prometheus-statsd-exporter/values.yaml +++ b/charts/prometheus-statsd-exporter/values.yaml @@ -171,6 +171,8 @@ autoscaling: # Ref. https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/ lifecycle: {} +dnsPolicy: ClusterFirst + hostNetwork: false hostPID: false From 6bdcbe560e43a0ae3737a016e61ebe53c1e9ab51 Mon Sep 17 00:00:00 2001 From: Lukas Monkevicius Date: Wed, 5 Jun 2024 11:22:56 -0700 Subject: [PATCH 7/8] make strategy conditional Signed-off-by: Lukas Monkevicius --- charts/prometheus-statsd-exporter/templates/daemonset.yaml | 2 ++ charts/prometheus-statsd-exporter/templates/deployment.yaml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/charts/prometheus-statsd-exporter/templates/daemonset.yaml b/charts/prometheus-statsd-exporter/templates/daemonset.yaml index b0c90ebac29b..43f07b87be2d 100644 --- a/charts/prometheus-statsd-exporter/templates/daemonset.yaml +++ b/charts/prometheus-statsd-exporter/templates/daemonset.yaml @@ -125,6 +125,8 @@ spec: topologySpreadConstraints: {{- toYaml . | nindent 8 }} {{- end }} + {{- with .Values.updateStrategy }} updateStrategy: {{- toYaml . | nindent 4 }} + {{- end }} {{- end }} diff --git a/charts/prometheus-statsd-exporter/templates/deployment.yaml b/charts/prometheus-statsd-exporter/templates/deployment.yaml index 2ea7b7439f8a..a6580ad7d2f1 100644 --- a/charts/prometheus-statsd-exporter/templates/deployment.yaml +++ b/charts/prometheus-statsd-exporter/templates/deployment.yaml @@ -126,6 +126,8 @@ spec: topologySpreadConstraints: {{- toYaml . | nindent 8 }} {{- end }} + {{- with .Values.strategy }} strategy: {{- toYaml . | nindent 4 }} + {{- end }} {{- end }} From 6a6e63c782d38acf3fce016730dead7524a7ceb4 Mon Sep 17 00:00:00 2001 From: Lukas Monkevicius Date: Thu, 6 Jun 2024 06:49:06 -0700 Subject: [PATCH 8/8] update indents for strategy Signed-off-by: Lukas Monkevicius --- .../prometheus-statsd-exporter/templates/daemonset.yaml | 8 ++++---- .../prometheus-statsd-exporter/templates/deployment.yaml | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/charts/prometheus-statsd-exporter/templates/daemonset.yaml b/charts/prometheus-statsd-exporter/templates/daemonset.yaml index 43f07b87be2d..5aa7364e83af 100644 --- a/charts/prometheus-statsd-exporter/templates/daemonset.yaml +++ b/charts/prometheus-statsd-exporter/templates/daemonset.yaml @@ -8,6 +8,10 @@ metadata: spec: {{- if not .Values.autoscaling.enabled }} revisionHistoryLimit: {{ .Values.deploymentRevisionHistoryLimit | default 10 }} + {{- with .Values.updateStrategy }} + updateStrategy: + {{- toYaml . | nindent 4 }} + {{- end }} {{- end }} selector: matchLabels: @@ -125,8 +129,4 @@ spec: topologySpreadConstraints: {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.updateStrategy }} - updateStrategy: - {{- toYaml . | nindent 4 }} - {{- end }} {{- end }} diff --git a/charts/prometheus-statsd-exporter/templates/deployment.yaml b/charts/prometheus-statsd-exporter/templates/deployment.yaml index a6580ad7d2f1..fcd56c01aa35 100644 --- a/charts/prometheus-statsd-exporter/templates/deployment.yaml +++ b/charts/prometheus-statsd-exporter/templates/deployment.yaml @@ -9,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: @@ -126,8 +130,4 @@ spec: topologySpreadConstraints: {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.strategy }} - strategy: - {{- toYaml . | nindent 4 }} - {{- end }} {{- end }}