From b8303059d26cd83f53169cf3ea0d0ec15922960c Mon Sep 17 00:00:00 2001 From: Andrii Chubatiuk Date: Wed, 9 Oct 2024 09:50:39 +0300 Subject: [PATCH 1/4] k8s-stack: alertmanager upgrade 0.27.0 --- charts/victoria-metrics-k8s-stack/CHANGELOG.md | 1 + charts/victoria-metrics-k8s-stack/values.yaml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/charts/victoria-metrics-k8s-stack/CHANGELOG.md b/charts/victoria-metrics-k8s-stack/CHANGELOG.md index ad5d48f62..27f7437ce 100644 --- a/charts/victoria-metrics-k8s-stack/CHANGELOG.md +++ b/charts/victoria-metrics-k8s-stack/CHANGELOG.md @@ -1,6 +1,7 @@ ## Next release - Generate VM components tag version from chart app name by default +- Upgraded default Alertmanager tag 0.25.0 -> 0.27.0 ## 0.27.0 diff --git a/charts/victoria-metrics-k8s-stack/values.yaml b/charts/victoria-metrics-k8s-stack/values.yaml index 5ffc2bd4d..b0efdad03 100644 --- a/charts/victoria-metrics-k8s-stack/values.yaml +++ b/charts/victoria-metrics-k8s-stack/values.yaml @@ -494,7 +494,7 @@ alertmanager: port: "9093" selectAllByDefault: true image: - tag: v0.25.0 + tag: v0.27.0 externalURL: "" routePrefix: / From aaca7ab1a1b6ffcede9613514c94e301da8494f2 Mon Sep 17 00:00:00 2001 From: Andrii Chubatiuk Date: Wed, 9 Oct 2024 12:09:46 +0300 Subject: [PATCH 2/4] added operator resources, lifecycle and termination grace period --- charts/victoria-metrics-k8s-stack/README.md | 2 +- charts/victoria-metrics-operator/CHANGELOG.md | 2 + charts/victoria-metrics-operator/README.md | 38 +++++++++++++++++++ .../templates/deployment.yaml | 4 ++ .../templates/uninstall_hook.yaml | 8 +--- charts/victoria-metrics-operator/values.yaml | 14 +++++++ 6 files changed, 60 insertions(+), 8 deletions(-) diff --git a/charts/victoria-metrics-k8s-stack/README.md b/charts/victoria-metrics-k8s-stack/README.md index 8059ced37..a5a15df8e 100644 --- a/charts/victoria-metrics-k8s-stack/README.md +++ b/charts/victoria-metrics-k8s-stack/README.md @@ -493,7 +493,7 @@ tls: [] configSecret: "" externalURL: "" image: - tag: v0.25.0 + tag: v0.27.0 port: "9093" routePrefix: / selectAllByDefault: true diff --git a/charts/victoria-metrics-operator/CHANGELOG.md b/charts/victoria-metrics-operator/CHANGELOG.md index c92023910..c1f7cdac6 100644 --- a/charts/victoria-metrics-operator/CHANGELOG.md +++ b/charts/victoria-metrics-operator/CHANGELOG.md @@ -1,6 +1,8 @@ ## Next release - upgraded common chart dependency +- added configurable cleanup hook resources. See [this issue](https://github.com/VictoriaMetrics/helm-charts/issues/1571) +- added ability to configure `terminationGracePeriodSeconds` and `lifecycle`. See [this issue](https://github.com/VictoriaMetrics/helm-charts/issues/1563) for details ## 0.35.2 diff --git a/charts/victoria-metrics-operator/README.md b/charts/victoria-metrics-operator/README.md index bf6bd704c..b56d8f70e 100644 --- a/charts/victoria-metrics-operator/README.md +++ b/charts/victoria-metrics-operator/README.md @@ -332,6 +332,22 @@ tag: ""

Image configuration for CRD cleanup Job

+ + + + crd.cleanup.resources + object +
+limits:
+    cpu: 500m
+    memory: 256Mi
+requests:
+    cpu: 100m
+    memory: 56Mi
+
+
+ +

Cleanup hook resources

@@ -567,6 +583,17 @@ variant: ""

Secret to pull images

+ + + + lifecycle + object +
+{}
+
+
+ +

Operator lifecycle. See this article for details.

@@ -979,6 +1006,17 @@ tlsConfig: {}

Configures monitoring with serviceScrape. VMServiceScrape must be pre-installed

+ + + + terminationGracePeriodSeconds + int +
+30
+
+
+ +

Graceful pod termination timeout. See this article for details.

diff --git a/charts/victoria-metrics-operator/templates/deployment.yaml b/charts/victoria-metrics-operator/templates/deployment.yaml index 9a3b5e61b..961e79f9e 100644 --- a/charts/victoria-metrics-operator/templates/deployment.yaml +++ b/charts/victoria-metrics-operator/templates/deployment.yaml @@ -128,6 +128,10 @@ spec: {{- with .Values.nodeSelector }} nodeSelector: {{ toYaml . | nindent 8 }} {{- end }} + terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }} + {{- with .Values.lifecycle }} + lifecycle: {{ toYaml . | nindent 8 }} + {{- end }} {{- with .Values.affinity }} affinity: {{ toYaml . | nindent 8 }} {{- end }} diff --git a/charts/victoria-metrics-operator/templates/uninstall_hook.yaml b/charts/victoria-metrics-operator/templates/uninstall_hook.yaml index a075517da..96ffd6b5d 100644 --- a/charts/victoria-metrics-operator/templates/uninstall_hook.yaml +++ b/charts/victoria-metrics-operator/templates/uninstall_hook.yaml @@ -32,13 +32,7 @@ spec: - name: kubectl image: {{ include "vm.image" (dict "helm" . "app" $app) }} imagePullPolicy: {{ $app.image.pullPolicy }} - resources: - limits: - cpu: "500m" - memory: "256Mi" - requests: - cpu: "100m" - memory: "56Mi" + resources: {{ toYaml $app.resources | nindent 12 }} args: - delete - {{ (keys .Values.admissionWebhooks.enabledCRDValidation) | sortAlpha | join "," }} diff --git a/charts/victoria-metrics-operator/values.yaml b/charts/victoria-metrics-operator/values.yaml index 7036d158b..e90ad677e 100644 --- a/charts/victoria-metrics-operator/values.yaml +++ b/charts/victoria-metrics-operator/values.yaml @@ -40,6 +40,14 @@ crd: # use image tag that matches k8s API version by default tag: "" pullPolicy: IfNotPresent + # -- Cleanup hook resources + resources: + limits: + cpu: "500m" + memory: "256Mi" + requests: + cpu: "100m" + memory: "56Mi" # -- Number of operator replicas replicaCount: 1 @@ -142,6 +150,12 @@ podDisruptionBudget: # maxUnavailable: 1 labels: {} +# -- Graceful pod termination timeout. See [this article](https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/#hook-handler-execution) for details. +terminationGracePeriodSeconds: 30 + +# -- Operator lifecycle. See [this article](https://kubernetes.io/docs/tasks/configure-pod-container/attach-handler-lifecycle-event/) for details. +lifecycle: {} + # -- Resource object resources: {} From f176663efb445e2ea77c739929946f63b4f49322 Mon Sep 17 00:00:00 2001 From: Andrii Chubatiuk Date: Wed, 9 Oct 2024 12:14:22 +0300 Subject: [PATCH 3/4] release operator chart --- charts/victoria-metrics-operator/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/victoria-metrics-operator/Chart.yaml b/charts/victoria-metrics-operator/Chart.yaml index aebc307c4..12e6206f8 100644 --- a/charts/victoria-metrics-operator/Chart.yaml +++ b/charts/victoria-metrics-operator/Chart.yaml @@ -7,7 +7,7 @@ home: https://github.com/VictoriaMetrics/operator sources: - https://github.com/VictoriaMetrics/helm-charts - https://github.com/VictoriaMetrics/operator -version: 0.35.2 +version: 0.35.3 icon: https://avatars.githubusercontent.com/u/43720803?s=200&v=4 kubeVersion: '>=1.25.0-0' keywords: From e2013110a4f09a765167e9c51d8302365ee472eb Mon Sep 17 00:00:00 2001 From: Andrii Chubatiuk Date: Wed, 9 Oct 2024 12:18:56 +0300 Subject: [PATCH 4/4] fail if crd.cleanup.image.tag is not string --- charts/victoria-metrics-operator/templates/uninstall_hook.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/charts/victoria-metrics-operator/templates/uninstall_hook.yaml b/charts/victoria-metrics-operator/templates/uninstall_hook.yaml index 96ffd6b5d..b55c355ee 100644 --- a/charts/victoria-metrics-operator/templates/uninstall_hook.yaml +++ b/charts/victoria-metrics-operator/templates/uninstall_hook.yaml @@ -9,6 +9,8 @@ {{- if empty ($app.image).tag }} {{- $tag := (printf "%s.%s" .Capabilities.KubeVersion.Major .Capabilities.KubeVersion.Minor) | replace "+" "" -}} {{- $_ := set $app.image "tag" $tag }} +{{- else if not (kindIs "string" ($app.image).tag) }} + {{- fail "`crd.cleanup.image.tag` is not string, most probably you need to enquote provided value" -}} {{- end }} --- apiVersion: batch/v1