From 5974e4d0cc0fe9a5ced4537da6a3dac418ff345f Mon Sep 17 00:00:00 2001 From: Evgeni Enchev Date: Mon, 10 Aug 2026 14:00:24 +0300 Subject: [PATCH] feat(chart): support deploymentStrategy, lifecycle, minReadySeconds and terminationGracePeriodSeconds Adds four optional passthrough values so users can configure zero-downtime rolling updates for the exporter Deployment: spec.strategy, spec.minReadySeconds, container lifecycle hooks, and terminationGracePeriodSeconds. All default to unset and render nothing, so existing manifests are unaffected. Co-Authored-By: Claude Sonnet 5 --- helm/Chart.yaml | 2 +- helm/README.md | 6 +++++- helm/templates/deployment.yaml | 14 ++++++++++++++ helm/values.yaml | 15 +++++++++++++++ 4 files changed, 35 insertions(+), 2 deletions(-) diff --git a/helm/Chart.yaml b/helm/Chart.yaml index 4ebce22b..82f268a8 100644 --- a/helm/Chart.yaml +++ b/helm/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v2 name: sql-exporter description: Database-agnostic SQL exporter for Prometheus type: application -version: 0.18.4 +version: 0.18.5 appVersion: 0.24.4 annotations: artifacthub.io/signKey: | diff --git a/helm/README.md b/helm/README.md index fed6a765..3948dba2 100644 --- a/helm/README.md +++ b/helm/README.md @@ -1,6 +1,6 @@ # sql-exporter -![Version: 0.18.4](https://img.shields.io/badge/Version-0.18.4-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.24.4](https://img.shields.io/badge/AppVersion-0.24.4-informational?style=flat-square) +![Version: 0.18.5](https://img.shields.io/badge/Version-0.18.5-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.24.4](https://img.shields.io/badge/AppVersion-0.24.4-informational?style=flat-square) Database-agnostic SQL exporter for Prometheus @@ -64,6 +64,7 @@ See the [examples directory](../examples/) for complete configuration examples: | commonAnnotations | object | `{}` | Common annotations to add to all the deployed resources | | commonLabels | object | `{}` | Common labels to add to all deployed resources | | createConfig | bool | `true` | Set to true to create a config as a part of the helm chart | +| deploymentStrategy | object | `{}` | Deployment update strategy, rendered verbatim under the Deployment's spec.strategy | | dnsConfig | object | `{}` | Pod DNS configuration (e.g. set ndots to reduce DNS lookup latency) | | extraContainers | object | `{}` | Arbitrary sidecar containers list | | extraManifests | list | `[]` | Arbitrary manifests list | @@ -83,8 +84,10 @@ See the [examples directory](../examples/) for complete configuration examples: | ingress.tls.key | string | `""` | Ingress tls.key, required if you don't have secret name. | | ingress.tls.secretName | string | `""` | Ingress tls secret if already exists. | | initContainers | object | `{}` | Arbitrary sidecar containers list for 1.29+ kubernetes | +| lifecycle | object | `{}` | Container lifecycle hooks (e.g. preStop, to allow graceful deregistration during rolling updates) | | logFormat | string | `"logfmt"` | Set log format (logfmt if unset) | | logLevel | string | `"info"` | Set log level (info if unset) | +| minReadySeconds | string | `""` | Minimum number of seconds for which a newly created pod should be ready, without any of its containers crashing, to be considered available (Deployment spec.minReadySeconds) | | nameOverride | string | `""` | Provide a name in place of `sql-exporter` | | podAnnotations | object | `{}` | Pod annotations | | podLabels | object | `{}` | Pod labels | @@ -97,6 +100,7 @@ See the [examples directory](../examples/) for complete configuration examples: | service.type | string | `"ClusterIP"` | Service type | | serviceAccount.annotations | object | `{}` | Annotations to add to the Service Account | | serviceAccount.create | bool | `true` | Specifies whether a Service Account should be created, creates "sql-exporter" service account if true, unless overriden. Otherwise, set to `default` if false, and custom service account name is not provided. Check all the available parameters. | +| terminationGracePeriodSeconds | string | `""` | Pod termination grace period in seconds (pod spec.terminationGracePeriodSeconds) | | webConfig | object | `{"basicAuth":{"bcryptCost":12,"enabled":false,"initFromSecret":{"enabled":false,"image":"httpd:alpine","imagePullPolicy":"IfNotPresent","secretKey":"password","secretName":""},"username":"prometheus","users":{}},"enabled":false,"template":"","tls":{"certFile":"tls.crt","certKey":"tls.crt","keyFile":"tls.key","keyKey":"tls.key","secretName":""}}` | Enable and configure Prometheus web config file support web-config.yml is automatically placed at /etc/sql_exporter/web-config.yml | | webConfig.basicAuth | object | `{"bcryptCost":12,"enabled":false,"initFromSecret":{"enabled":false,"image":"httpd:alpine","imagePullPolicy":"IfNotPresent","secretKey":"password","secretName":""},"username":"prometheus","users":{}}` | Basic authentication configuration for web-config | | webConfig.basicAuth.bcryptCost | int | `12` | Bcrypt cost used when hashing via initFromSecret | diff --git a/helm/templates/deployment.yaml b/helm/templates/deployment.yaml index 1567d013..a025eb4e 100644 --- a/helm/templates/deployment.yaml +++ b/helm/templates/deployment.yaml @@ -8,6 +8,13 @@ metadata: {{- include "sql-exporter.annotations" . | nindent 4 }} spec: replicas: {{ .Values.replicaCount | default 1 }} + {{- with .Values.deploymentStrategy }} + strategy: + {{- toYaml . | nindent 4 }} + {{- end }} + {{- with .Values.minReadySeconds }} + minReadySeconds: {{ . }} + {{- end }} selector: matchLabels: {{- include "sql-exporter.selectorLabels" . | nindent 6 }} @@ -28,6 +35,9 @@ spec: {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.terminationGracePeriodSeconds }} + terminationGracePeriodSeconds: {{ . }} {{- end }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} @@ -244,6 +254,10 @@ spec: resizePolicy: {{- toYaml . | nindent 12 }} {{- end }} + {{- with .Values.lifecycle }} + lifecycle: + {{- toYaml . | nindent 12 }} + {{- end }} {{- with .Values.extraContainers }} {{- toYaml . | nindent 8 }} {{- end }} diff --git a/helm/values.yaml b/helm/values.yaml index 61873d50..ec21689d 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -133,11 +133,26 @@ resizePolicy: [] # restartPolicy: NotRequired # - resourceName: memory # restartPolicy: RestartContainer +# -- Container lifecycle hooks (e.g. preStop, to allow graceful deregistration during rolling updates) +lifecycle: {} + # preStop: + # exec: + # command: ["/bin/sh", "-c", "sleep 45"] # -- Pod DNS configuration (e.g. set ndots to reduce DNS lookup latency) dnsConfig: {} # options: # - name: ndots # value: "2" +# -- Deployment update strategy, rendered verbatim under the Deployment's spec.strategy +deploymentStrategy: {} + # type: RollingUpdate + # rollingUpdate: + # maxSurge: 1 + # maxUnavailable: 0 +# -- Minimum number of seconds for which a newly created pod should be ready, without any of its containers crashing, to be considered available (Deployment spec.minReadySeconds) +minReadySeconds: "" +# -- Pod termination grace period in seconds (pod spec.terminationGracePeriodSeconds) +terminationGracePeriodSeconds: "" # -- Pod labels podLabels: {} # -- Pod annotations