From e044aecf0bfede5c2a12eb0ecb920cd5ef11b82d Mon Sep 17 00:00:00 2001 From: dheeg <69521775+dheeg@users.noreply.github.com> Date: Wed, 1 Oct 2025 10:45:14 +0200 Subject: [PATCH] [bitnami/nginx] allow to change probes for metrics container (#36296) * allow to change livenessProbe and readinessProbe for metrics container --------- Signed-off-by: Dominik Heeg Signed-off-by: Bitnami Bot Signed-off-by: dheeg <69521775+dheeg@users.noreply.github.com> Co-authored-by: Dominik Heeg Co-authored-by: Bitnami Bot Co-authored-by: Fran Mulero --- bitnami/nginx/CHANGELOG.md | 8 ++- bitnami/nginx/Chart.yaml | 2 +- bitnami/nginx/README.md | 89 +++++++++++++++---------- bitnami/nginx/templates/deployment.yaml | 23 +++++-- bitnami/nginx/values.yaml | 59 ++++++++++++++++ 5 files changed, 138 insertions(+), 43 deletions(-) diff --git a/bitnami/nginx/CHANGELOG.md b/bitnami/nginx/CHANGELOG.md index f26c8a93b8..0f4ed45f1d 100644 --- a/bitnami/nginx/CHANGELOG.md +++ b/bitnami/nginx/CHANGELOG.md @@ -1,8 +1,12 @@ # Changelog -## 21.1.23 (2025-08-18) +## 22.1.0 (2025-10-01) -* [bitnami/nginx] :zap: :arrow_up: Update dependency references ([#36127](https://github.com/bitnami/charts/pull/36127)) +* [bitnami/nginx] allow to change probes for metrics container ([#36296](https://github.com/bitnami/charts/pull/36296)) + +## 21.1.23 (2025-08-18) + +* [bitnami/nginx] :zap: :arrow_up: Update dependency references (#36127) ([772a6ff](https://github.com/bitnami/charts/commit/772a6ff4437f41f54b9e0b98cfb9322d896403d6)), closes [#36127](https://github.com/bitnami/charts/issues/36127) ## 21.1.22 (2025-08-16) diff --git a/bitnami/nginx/Chart.yaml b/bitnami/nginx/Chart.yaml index 012c0b980d..ad8759342a 100644 --- a/bitnami/nginx/Chart.yaml +++ b/bitnami/nginx/Chart.yaml @@ -36,4 +36,4 @@ maintainers: name: nginx sources: - https://github.com/bitnami/charts/tree/main/bitnami/nginx -version: 22.0.0 +version: 22.1.0 diff --git a/bitnami/nginx/README.md b/bitnami/nginx/README.md index 143ec5d73b..f95c861ac3 100644 --- a/bitnami/nginx/README.md +++ b/bitnami/nginx/README.md @@ -480,40 +480,61 @@ For annotations, please see [this document](https://github.com/kubernetes/ingres ### Metrics parameters -| Name | Description | Value | -| ------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- | -| `metrics.enabled` | Start a Prometheus exporter sidecar container | `false` | -| `metrics.image.registry` | NGINX Prometheus exporter image registry | `REGISTRY_NAME` | -| `metrics.image.repository` | NGINX Prometheus exporter image repository | `REPOSITORY_NAME/nginx-exporter` | -| `metrics.image.digest` | NGINX Prometheus exporter image digest in the way sha256:aa.... Please note this parameter, if set, will override the tag | `""` | -| `metrics.image.pullPolicy` | NGINX Prometheus exporter image pull policy | `IfNotPresent` | -| `metrics.image.pullSecrets` | Specify docker-registry secret names as an array | `[]` | -| `metrics.port` | NGINX Container Status Port scraped by Prometheus Exporter | `""` | -| `metrics.extraArgs` | Extra arguments for Prometheus exporter | `[]` | -| `metrics.containerPorts.metrics` | Prometheus exporter container port | `9113` | -| `metrics.podAnnotations` | Additional annotations for NGINX Prometheus exporter pod(s) | `{}` | -| `metrics.securityContext.enabled` | Enabled NGINX Exporter containers' Security Context | `false` | -| `metrics.securityContext.seLinuxOptions` | Set SELinux options in container | `{}` | -| `metrics.securityContext.runAsUser` | Set NGINX Exporter container's Security Context runAsUser | `1001` | -| `metrics.service.port` | NGINX Prometheus exporter service port | `9113` | -| `metrics.service.annotations` | Annotations for the Prometheus exporter service | `{}` | -| `metrics.resourcesPreset` | Set container resources according to one common preset (allowed values: none, nano, micro, small, medium, large, xlarge, 2xlarge). This is ignored if metrics.resources is set (metrics.resources is recommended for production). | `nano` | -| `metrics.resources` | Set container requests and limits for different resources like CPU or memory (essential for production workloads) | `{}` | -| `metrics.serviceMonitor.enabled` | Creates a Prometheus Operator ServiceMonitor (also requires `metrics.enabled` to be `true`) | `false` | -| `metrics.serviceMonitor.namespace` | Namespace in which Prometheus is running | `""` | -| `metrics.serviceMonitor.tlsConfig` | TLS configuration used for scrape endpoints used by Prometheus | `{}` | -| `metrics.serviceMonitor.jobLabel` | The name of the label on the target service to use as the job name in prometheus. | `""` | -| `metrics.serviceMonitor.interval` | Interval at which metrics should be scraped. | `""` | -| `metrics.serviceMonitor.scrapeTimeout` | Timeout after which the scrape is ended | `""` | -| `metrics.serviceMonitor.selector` | Prometheus instance selector labels | `{}` | -| `metrics.serviceMonitor.labels` | Additional labels that can be used so PodMonitor will be discovered by Prometheus | `{}` | -| `metrics.serviceMonitor.relabelings` | RelabelConfigs to apply to samples before scraping | `[]` | -| `metrics.serviceMonitor.metricRelabelings` | MetricRelabelConfigs to apply to samples before ingestion | `[]` | -| `metrics.serviceMonitor.honorLabels` | honorLabels chooses the metric's labels on collisions with target labels | `false` | -| `metrics.prometheusRule.enabled` | if `true`, creates a Prometheus Operator PrometheusRule (also requires `metrics.enabled` to be `true` and `metrics.prometheusRule.rules`) | `false` | -| `metrics.prometheusRule.namespace` | Namespace for the PrometheusRule Resource (defaults to the Release Namespace) | `""` | -| `metrics.prometheusRule.additionalLabels` | Additional labels that can be used so PrometheusRule will be discovered by Prometheus | `{}` | -| `metrics.prometheusRule.rules` | Prometheus Rule definitions | `[]` | +| Name | Description | Value | +| -------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------- | +| `metrics.enabled` | Start a Prometheus exporter sidecar container | `false` | +| `metrics.image.registry` | NGINX Prometheus exporter image registry | `REGISTRY_NAME` | +| `metrics.image.repository` | NGINX Prometheus exporter image repository | `REPOSITORY_NAME/nginx-exporter` | +| `metrics.image.digest` | NGINX Prometheus exporter image digest in the way sha256:aa.... Please note this parameter, if set, will override the tag | `""` | +| `metrics.image.pullPolicy` | NGINX Prometheus exporter image pull policy | `IfNotPresent` | +| `metrics.image.pullSecrets` | Specify docker-registry secret names as an array | `[]` | +| `metrics.port` | NGINX Container Status Port scraped by Prometheus Exporter | `""` | +| `metrics.extraArgs` | Extra arguments for Prometheus exporter | `[]` | +| `metrics.containerPorts.metrics` | Prometheus exporter container port | `9113` | +| `metrics.podAnnotations` | Additional annotations for NGINX Prometheus exporter pod(s) | `{}` | +| `metrics.securityContext.enabled` | Enabled NGINX Exporter containers' Security Context | `false` | +| `metrics.securityContext.seLinuxOptions` | Set SELinux options in container | `{}` | +| `metrics.securityContext.runAsUser` | Set NGINX Exporter container's Security Context runAsUser | `1001` | +| `metrics.service.port` | NGINX Prometheus exporter service port | `9113` | +| `metrics.service.annotations` | Annotations for the Prometheus exporter service | `{}` | +| `metrics.resourcesPreset` | Set container resources according to one common preset (allowed values: none, nano, micro, small, medium, large, xlarge, 2xlarge). This is ignored if metrics.resources is set (metrics.resources is recommended for production). | `nano` | +| `metrics.resources` | Set container requests and limits for different resources like CPU or memory (essential for production workloads) | `{}` | +| `metrics.serviceMonitor.enabled` | Creates a Prometheus Operator ServiceMonitor (also requires `metrics.enabled` to be `true`) | `false` | +| `metrics.serviceMonitor.namespace` | Namespace in which Prometheus is running | `""` | +| `metrics.serviceMonitor.tlsConfig` | TLS configuration used for scrape endpoints used by Prometheus | `{}` | +| `metrics.serviceMonitor.jobLabel` | The name of the label on the target service to use as the job name in prometheus. | `""` | +| `metrics.serviceMonitor.interval` | Interval at which metrics should be scraped. | `""` | +| `metrics.serviceMonitor.scrapeTimeout` | Timeout after which the scrape is ended | `""` | +| `metrics.serviceMonitor.selector` | Prometheus instance selector labels | `{}` | +| `metrics.serviceMonitor.labels` | Additional labels that can be used so PodMonitor will be discovered by Prometheus | `{}` | +| `metrics.serviceMonitor.relabelings` | RelabelConfigs to apply to samples before scraping | `[]` | +| `metrics.serviceMonitor.metricRelabelings` | MetricRelabelConfigs to apply to samples before ingestion | `[]` | +| `metrics.serviceMonitor.honorLabels` | honorLabels chooses the metric's labels on collisions with target labels | `false` | +| `metrics.prometheusRule.enabled` | if `true`, creates a Prometheus Operator PrometheusRule (also requires `metrics.enabled` to be `true` and `metrics.prometheusRule.rules`) | `false` | +| `metrics.prometheusRule.namespace` | Namespace for the PrometheusRule Resource (defaults to the Release Namespace) | `""` | +| `metrics.prometheusRule.additionalLabels` | Additional labels that can be used so PrometheusRule will be discovered by Prometheus | `{}` | +| `metrics.prometheusRule.rules` | Prometheus Rule definitions | `[]` | +| `metrics.customLivenessProbe` | Override default metrics liveness probe | `{}` | +| `metrics.livenessProbe.enabled` | Enable livenessProbe | `true` | +| `metrics.livenessProbe.initialDelaySeconds` | Initial delay seconds for livenessProbe | `30` | +| `metrics.livenessProbe.timeoutSeconds` | Timeout seconds for livenessProbe | `5` | +| `metrics.livenessProbe.periodSeconds` | Period seconds for livenessProbe | `10` | +| `metrics.livenessProbe.failureThreshold` | Failure threshold for livenessProbe | `2` | +| `metrics.livenessProbe.successThreshold` | Success threshold for livenessProbe | `1` | +| `metrics.customReadinessProbe` | Override default metrics readiness probe | `{}` | +| `metrics.readinessProbe.enabled` | Enable readinessProbe | `true` | +| `metrics.readinessProbe.initialDelaySeconds` | Initial delay seconds for readinessProbe | `5` | +| `metrics.readinessProbe.timeoutSeconds` | Timeout seconds for readinessProbe | `3` | +| `metrics.readinessProbe.periodSeconds` | Period seconds for readinessProbe | `30` | +| `metrics.readinessProbe.failureThreshold` | Failure threshold for readinessProbe | `2` | +| `metrics.readinessProbe.successThreshold` | Success threshold for readinessProbe | `1` | +| `metrics.customStartupProbe` | Override default metrics startup probe | `{}` | +| `metrics.startupProbe.enabled` | Enable startupProbe | `false` | +| `metrics.startupProbe.initialDelaySeconds` | Initial delay seconds for startupProbe | `5` | +| `metrics.startupProbe.timeoutSeconds` | Timeout seconds for startupProbe | `3` | +| `metrics.startupProbe.periodSeconds` | Period seconds for startupProbe | `5` | +| `metrics.startupProbe.failureThreshold` | Failure threshold for startupProbe | `10` | +| `metrics.startupProbe.successThreshold` | Success threshold for startupProbe | `1` | Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, diff --git a/bitnami/nginx/templates/deployment.yaml b/bitnami/nginx/templates/deployment.yaml index b109d11f21..8d1b9edfb4 100644 --- a/bitnami/nginx/templates/deployment.yaml +++ b/bitnami/nginx/templates/deployment.yaml @@ -392,18 +392,29 @@ spec: ports: - name: metrics containerPort: {{ .Values.metrics.containerPorts.metrics }} - livenessProbe: + {{- if .Values.metrics.customLivenessProbe }} + livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.metrics.customLivenessProbe "context" $) | nindent 12 }} + {{- else if .Values.metrics.livenessProbe.enabled }} + livenessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.metrics.livenessProbe "enabled") "context" $) | nindent 12 }} + tcpSocket: + port: metrics + {{- end }} + {{- if .Values.metrics.customReadinessProbe }} + readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.metrics.customReadinessProbe "context" $) | nindent 12 }} + {{- else if .Values.metrics.readinessProbe.enabled }} + readinessProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.metrics.readinessProbe "enabled") "context" $) | nindent 12 }} httpGet: path: /metrics port: metrics - initialDelaySeconds: 15 - timeoutSeconds: 5 - readinessProbe: + {{- end }} + {{- if .Values.metrics.customStartupProbe }} + startupProbe: {{- include "common.tplvalues.render" (dict "value" .Values.metrics.customStartupProbe "context" $) | nindent 12 }} + {{- else if .Values.metrics.startupProbe.enabled }} + startupProbe: {{- include "common.tplvalues.render" (dict "value" (omit .Values.metrics.startupProbe "enabled") "context" $) | nindent 12 }} httpGet: path: /metrics port: metrics - initialDelaySeconds: 5 - timeoutSeconds: 1 + {{- end }} {{- if .Values.metrics.resources }} resources: {{- toYaml .Values.metrics.resources | nindent 12 }} {{- else if ne .Values.metrics.resourcesPreset "none" }} diff --git a/bitnami/nginx/values.yaml b/bitnami/nginx/values.yaml index c3c7532311..747bd6e777 100644 --- a/bitnami/nginx/values.yaml +++ b/bitnami/nginx/values.yaml @@ -1130,3 +1130,62 @@ metrics: ## summary: Tomcat instance is down. ## rules: [] + ## @param metrics.customLivenessProbe Override default metrics liveness probe + ## + customLivenessProbe: {} + ## NGINX metrics containers' liveness probe. + ## ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes + ## @param metrics.livenessProbe.enabled Enable livenessProbe + ## @param metrics.livenessProbe.initialDelaySeconds Initial delay seconds for livenessProbe + ## @param metrics.livenessProbe.timeoutSeconds Timeout seconds for livenessProbe + ## @param metrics.livenessProbe.periodSeconds Period seconds for livenessProbe + ## @param metrics.livenessProbe.failureThreshold Failure threshold for livenessProbe + ## @param metrics.livenessProbe.successThreshold Success threshold for livenessProbe + ## + livenessProbe: + enabled: true + initialDelaySeconds: 30 + timeoutSeconds: 5 + periodSeconds: 10 + failureThreshold: 2 + successThreshold: 1 + ## @param metrics.customReadinessProbe Override default metrics readiness probe + ## + customReadinessProbe: {} + ## NGINX metrics containers' readiness probe. + ## ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes + ## @param metrics.readinessProbe.enabled Enable readinessProbe + ## @param metrics.readinessProbe.initialDelaySeconds Initial delay seconds for readinessProbe + ## @param metrics.readinessProbe.timeoutSeconds Timeout seconds for readinessProbe + ## @param metrics.readinessProbe.periodSeconds Period seconds for readinessProbe + ## @param metrics.readinessProbe.failureThreshold Failure threshold for readinessProbe + ## @param metrics.readinessProbe.successThreshold Success threshold for readinessProbe + + ## + readinessProbe: + enabled: true + initialDelaySeconds: 5 + timeoutSeconds: 3 + periodSeconds: 30 + failureThreshold: 2 + successThreshold: 1 + ## @param metrics.customStartupProbe Override default metrics startup probe + ## + customStartupProbe: {} + ## NGINX metrics containers' startup probe. + ## ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes + ## @param metrics.startupProbe.enabled Enable startupProbe + ## @param metrics.startupProbe.initialDelaySeconds Initial delay seconds for startupProbe + ## @param metrics.startupProbe.timeoutSeconds Timeout seconds for startupProbe + ## @param metrics.startupProbe.periodSeconds Period seconds for startupProbe + ## @param metrics.startupProbe.failureThreshold Failure threshold for startupProbe + ## @param metrics.startupProbe.successThreshold Success threshold for startupProbe + + ## + startupProbe: + enabled: false + initialDelaySeconds: 5 + timeoutSeconds: 3 + periodSeconds: 5 + failureThreshold: 10 + successThreshold: 1