From dd9d5d7629786c4dc25f21169abe9da2e93d2916 Mon Sep 17 00:00:00 2001 From: Ilia Lazebnik Date: Sun, 12 Nov 2023 13:56:17 +0200 Subject: [PATCH 1/2] [prometheus] Bump deps (#3997) Signed-off-by: drfaust92 --- charts/prometheus/Chart.lock | 8 ++++---- charts/prometheus/Chart.yaml | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/charts/prometheus/Chart.lock b/charts/prometheus/Chart.lock index e770fe8b0ba2..1555cc1e6438 100644 --- a/charts/prometheus/Chart.lock +++ b/charts/prometheus/Chart.lock @@ -4,12 +4,12 @@ dependencies: version: 1.7.0 - name: kube-state-metrics repository: https://prometheus-community.github.io/helm-charts - version: 5.14.0 + version: 5.15.2 - name: prometheus-node-exporter repository: https://prometheus-community.github.io/helm-charts version: 4.23.2 - name: prometheus-pushgateway repository: https://prometheus-community.github.io/helm-charts - version: 2.4.1 -digest: sha256:b34c16be0857b51ad2e961b2a232a869873f43fc6a15f937c9f3d9083be72f8e -generated: "2023-10-28T21:25:54.084688+03:00" + version: 2.4.2 +digest: sha256:51d21628967a95217345e39b2d8f5bb6466a6ed1d86e251720331a144c5e5e43 +generated: "2023-11-11T23:40:32.006194+02:00" diff --git a/charts/prometheus/Chart.yaml b/charts/prometheus/Chart.yaml index a0ba0176ba54..af43851ebac3 100644 --- a/charts/prometheus/Chart.yaml +++ b/charts/prometheus/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 name: prometheus appVersion: v2.47.2 -version: 25.4.0 +version: 25.5.0 kubeVersion: ">=1.19.0-0" description: Prometheus is a monitoring system and time series database. home: https://prometheus.io/ @@ -30,7 +30,7 @@ dependencies: repository: https://prometheus-community.github.io/helm-charts condition: alertmanager.enabled - name: kube-state-metrics - version: "5.14.*" + version: "5.15.*" repository: https://prometheus-community.github.io/helm-charts condition: kube-state-metrics.enabled - name: prometheus-node-exporter From 26ff0a752b8f1864e1a6bd2d7e68981e0784cb77 Mon Sep 17 00:00:00 2001 From: zeritti <47476160+zeritti@users.noreply.github.com> Date: Sun, 12 Nov 2023 13:16:28 +0000 Subject: [PATCH 2/2] [prometheus] Support retention size, attach volume labels to PVC (#3985) * Remove unused helper template prometheus.daemonset.apiVersion Signed-off-by: zeritti <47476160+zeritti@users.noreply.github.com> * Attach labels to standalone PVC Signed-off-by: zeritti <47476160+zeritti@users.noreply.github.com> * Minor corrections in comments Signed-off-by: zeritti <47476160+zeritti@users.noreply.github.com> * Do not render resources unless set Signed-off-by: zeritti <47476160+zeritti@users.noreply.github.com> * Update values schema Signed-off-by: zeritti <47476160+zeritti@users.noreply.github.com> * Add support for data retention size Signed-off-by: zeritti <47476160+zeritti@users.noreply.github.com> * Bump chart version Signed-off-by: zeritti <47476160+zeritti@users.noreply.github.com> * Insert commonMetaLabels in values file Signed-off-by: zeritti <47476160+zeritti@users.noreply.github.com> * Add header to values file Signed-off-by: zeritti <47476160+zeritti@users.noreply.github.com> * Bump chart version Signed-off-by: zeritti <47476160+zeritti@users.noreply.github.com> --------- Signed-off-by: zeritti <47476160+zeritti@users.noreply.github.com> Co-authored-by: MH --- charts/prometheus/Chart.yaml | 2 +- charts/prometheus/templates/_helpers.tpl | 10 ++++------ charts/prometheus/templates/deploy.yaml | 11 +++++++++-- charts/prometheus/templates/pvc.yaml | 3 +++ charts/prometheus/templates/sts.yaml | 11 +++++++++-- charts/prometheus/values.schema.json | 9 +++++++++ charts/prometheus/values.yaml | 21 +++++++++++++++++---- 7 files changed, 52 insertions(+), 15 deletions(-) diff --git a/charts/prometheus/Chart.yaml b/charts/prometheus/Chart.yaml index af43851ebac3..9895486b48b7 100644 --- a/charts/prometheus/Chart.yaml +++ b/charts/prometheus/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 name: prometheus appVersion: v2.47.2 -version: 25.5.0 +version: 25.6.0 kubeVersion: ">=1.19.0-0" description: Prometheus is a monitoring system and time series database. home: https://prometheus.io/ diff --git a/charts/prometheus/templates/_helpers.tpl b/charts/prometheus/templates/_helpers.tpl index daec18e28052..0810e3c04441 100644 --- a/charts/prometheus/templates/_helpers.tpl +++ b/charts/prometheus/templates/_helpers.tpl @@ -110,12 +110,7 @@ Return the appropriate apiVersion for deployment. {{- define "prometheus.deployment.apiVersion" -}} {{- print "apps/v1" -}} {{- end -}} -{{/* -Return the appropriate apiVersion for daemonset. -*/}} -{{- define "prometheus.daemonset.apiVersion" -}} -{{- print "apps/v1" -}} -{{- end -}} + {{/* Return the appropriate apiVersion for networkpolicy. */}} @@ -133,6 +128,7 @@ Return the appropriate apiVersion for poddisruptionbudget. {{- print "policy/v1beta1" -}} {{- end -}} {{- end -}} + {{/* Return the appropriate apiVersion for rbac. */}} @@ -143,6 +139,7 @@ Return the appropriate apiVersion for rbac. {{- print "rbac.authorization.k8s.io/v1beta1" -}} {{- end -}} {{- end -}} + {{/* Return the appropriate apiVersion for ingress. */}} @@ -169,6 +166,7 @@ Return if ingress supports ingressClassName. {{- define "ingress.supportsIngressClassName" -}} {{- or (eq (include "ingress.isStable" .) "true") (and (eq (include "ingress.apiVersion" .) "networking.k8s.io/v1beta1") (semverCompare ">= 1.18.x" (include "prometheus.kubeVersion" .))) -}} {{- end -}} + {{/* Return if ingress supports pathType. */}} diff --git a/charts/prometheus/templates/deploy.yaml b/charts/prometheus/templates/deploy.yaml index cf243ea0523b..9ccdccfe4fe1 100644 --- a/charts/prometheus/templates/deploy.yaml +++ b/charts/prometheus/templates/deploy.yaml @@ -85,8 +85,10 @@ spec: ports: - containerPort: {{ .Values.configmapReload.prometheus.containerPort }} {{- end }} + {{- with .Values.configmapReload.prometheus.resources }} resources: -{{ toYaml .Values.configmapReload.prometheus.resources | indent 12 }} + {{- toYaml . | nindent 12 }} + {{- end }} volumeMounts: - name: config-volume mountPath: /etc/config @@ -123,6 +125,9 @@ spec: {{- else }} {{- if .Values.server.retention }} - --storage.tsdb.retention.time={{ .Values.server.retention }} + {{- end }} + {{- if .Values.server.retentionSize }} + - --storage.tsdb.retention.size={{ .Values.server.retentionSize }} {{- end }} - --config.file={{ .Values.server.configPath }} {{- if .Values.server.storagePath }} @@ -213,8 +218,10 @@ spec: periodSeconds: {{ .Values.server.startupProbe.periodSeconds }} timeoutSeconds: {{ .Values.server.startupProbe.timeoutSeconds }} {{- end }} + {{- with .Values.server.resources }} resources: -{{ toYaml .Values.server.resources | indent 12 }} + {{- toYaml . | nindent 12 }} + {{- end }} volumeMounts: - name: config-volume mountPath: /etc/config diff --git a/charts/prometheus/templates/pvc.yaml b/charts/prometheus/templates/pvc.yaml index 25dfe0217ca4..a9dc4fce083f 100644 --- a/charts/prometheus/templates/pvc.yaml +++ b/charts/prometheus/templates/pvc.yaml @@ -10,6 +10,9 @@ metadata: {{- end }} labels: {{- include "prometheus.server.labels" . | nindent 4 }} + {{- with .Values.server.persistentVolume.labels }} + {{- toYaml . | nindent 4 }} + {{- end }} name: {{ template "prometheus.server.fullname" . }} namespace: {{ include "prometheus.namespace" . }} spec: diff --git a/charts/prometheus/templates/sts.yaml b/charts/prometheus/templates/sts.yaml index 811190da3229..e0693b865e1c 100644 --- a/charts/prometheus/templates/sts.yaml +++ b/charts/prometheus/templates/sts.yaml @@ -90,8 +90,10 @@ spec: ports: - containerPort: {{ .Values.configmapReload.prometheus.containerPort }} {{- end }} + {{- with .Values.configmapReload.prometheus.resources }} resources: -{{ toYaml .Values.configmapReload.prometheus.resources | indent 12 }} + {{- toYaml . | nindent 12 }} + {{- end }} volumeMounts: - name: config-volume mountPath: /etc/config @@ -128,6 +130,9 @@ spec: {{- end }} {{- if .Values.server.retention }} - --storage.tsdb.retention.time={{ .Values.server.retention }} + {{- end }} + {{- if .Values.server.retentionSize }} + - --storage.tsdb.retention.size={{ .Values.server.retentionSize }} {{- end }} - --config.file={{ .Values.server.configPath }} {{- if .Values.server.storagePath }} @@ -215,8 +220,10 @@ spec: periodSeconds: {{ .Values.server.startupProbe.periodSeconds }} timeoutSeconds: {{ .Values.server.startupProbe.timeoutSeconds }} {{- end }} + {{- with .Values.server.resources }} resources: -{{ toYaml .Values.server.resources | indent 12 }} + {{- toYaml . | nindent 12 }} + {{- end }} volumeMounts: - name: config-volume mountPath: /etc/config diff --git a/charts/prometheus/values.schema.json b/charts/prometheus/values.schema.json index 2706c5b84057..1828064ed586 100644 --- a/charts/prometheus/values.schema.json +++ b/charts/prometheus/values.schema.json @@ -418,6 +418,9 @@ } } }, + "portName": { + "type": "string" + }, "prefixURL": { "type": "string" }, @@ -463,6 +466,9 @@ "retention": { "type": "string" }, + "retentionSize": { + "type": "string" + }, "revisionHistoryLimit": { "type": "integer" }, @@ -486,6 +492,9 @@ "service": { "type": "object", "properties": { + "additionalPorts": { + "type": "array" + }, "annotations": { "type": "object" }, diff --git a/charts/prometheus/values.yaml b/charts/prometheus/values.yaml index bacd158a2a57..c68e8c19cf4b 100644 --- a/charts/prometheus/values.yaml +++ b/charts/prometheus/values.yaml @@ -1,3 +1,8 @@ +# yaml-language-server: $schema=values.schema.json +# Default values for prometheus. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + rbac: create: true @@ -16,6 +21,9 @@ serviceAccounts: annotations: {} # automountServiceAccountToken: +## Additional labels to attach to all resources +commonMetaLabels: {} + ## Monitors ConfigMap changes and POSTs to a URL ## Ref: https://github.com/prometheus-operator/prometheus-operator/tree/main/cmd/prometheus-config-reloader ## @@ -198,6 +206,7 @@ server: # List of flags to override default parameters, e.g: # - --enable-feature=agent # - --storage.agent.retention.max-time=30m + # - --config.file=/etc/config/prometheus.yml defaultFlagsOverride: [] extraFlags: @@ -364,7 +373,7 @@ server: # - "example.com" ## Node tolerations for server scheduling to nodes with taints - ## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ + ## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/ ## tolerations: [] # - key: "key" @@ -373,7 +382,7 @@ server: # effect: "NoSchedule|PreferNoSchedule|NoExecute(1.6 only)" ## Node labels for Prometheus server pod assignment - ## Ref: https://kubernetes.io/docs/user-guide/node-selection/ + ## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/ ## nodeSelector: {} @@ -679,6 +688,10 @@ server: ## retention: "15d" + ## Prometheus' data retention size. Supported units: B, KB, MB, GB, TB, PB, EB. + ## + retentionSize: "" + ## Prometheus server ConfigMap entries for rule files (allow prometheus labels interpolation) ruleFiles: {} @@ -1206,7 +1219,7 @@ kube-state-metrics: ## enabled: true -## promtheus-node-exporter sub-chart configurable values +## prometheus-node-exporter sub-chart configurable values ## Please see https://github.com/prometheus-community/helm-charts/tree/main/charts/prometheus-node-exporter ## prometheus-node-exporter: @@ -1220,7 +1233,7 @@ prometheus-node-exporter: containerSecurityContext: allowPrivilegeEscalation: false -## pprometheus-pushgateway sub-chart configurable values +## prometheus-pushgateway sub-chart configurable values ## Please see https://github.com/prometheus-community/helm-charts/tree/main/charts/prometheus-pushgateway ## prometheus-pushgateway: