[bitnami/redis] - Add support for PodMonitor (#20409)

* Update values.yaml

Signed-off-by: peplc <148867697+peplc@users.noreply.github.com>

* Create podmonitor.yaml

Signed-off-by: peplc <148867697+peplc@users.noreply.github.com>

* Update README.md

Signed-off-by: peplc <148867697+peplc@users.noreply.github.com>

* Bump redis chart version

Signed-off-by: peplc <148867697+peplc@users.noreply.github.com>

* Update podmonitor.yaml

Signed-off-by: peplc <148867697+peplc@users.noreply.github.com>

---------

Signed-off-by: peplc <148867697+peplc@users.noreply.github.com>
This commit is contained in:
peplc
2023-10-27 11:57:57 +03:00
committed by GitHub
parent 4ca30a6ccd
commit 0d40a6c94d
4 changed files with 103 additions and 2 deletions

View File

@@ -34,4 +34,4 @@ maintainers:
name: redis
sources:
- https://github.com/bitnami/charts/tree/main/bitnami/redis
version: 18.1.6
version: 18.2.0

View File

@@ -545,6 +545,17 @@ The command removes all the Kubernetes components associated with the chart and
| `metrics.serviceMonitor.podTargetLabels` | Labels from the Kubernetes pod to be transferred to the created metrics | `[]` |
| `metrics.serviceMonitor.sampleLimit` | Limit of how many samples should be scraped from every Pod | `false` |
| `metrics.serviceMonitor.targetLimit` | Limit of how many targets should be scraped | `false` |
| `metrics.podMonitor.enabled` | Create PodMonitor resource(s) for scraping metrics using PrometheusOperator | `false` |
| `metrics.podMonitor.namespace` | The namespace in which the PodMonitor will be created | `""` |
| `metrics.podMonitor.interval` | The interval at which metrics should be scraped | `30s` |
| `metrics.podMonitor.scrapeTimeout` | The timeout after which the scrape is ended | `""` |
| `metrics.podMonitor.relabellings` | Metrics RelabelConfigs to apply to samples before scraping. | `[]` |
| `metrics.podMonitor.metricRelabelings` | Metrics RelabelConfigs to apply to samples before ingestion. | `[]` |
| `metrics.podMonitor.honorLabels` | Specify honorLabels parameter to add the scrape endpoint | `false` |
| `metrics.podMonitor.additionalLabels` | Additional labels that can be used so PodMonitor resource(s) can be discovered by Prometheus | `{}` |
| `metrics.podMonitor.podTargetLabels` | Labels from the Kubernetes pod to be transferred to the created metrics | `[]` |
| `metrics.podMonitor.sampleLimit` | Limit of how many samples should be scraped from every Pod | `false` |
| `metrics.podMonitor.targetLimit` | Limit of how many targets should be scraped | `false` |
| `metrics.prometheusRule.enabled` | Create a custom prometheusRule Resource for scraping metrics using PrometheusOperator | `false` |
| `metrics.prometheusRule.namespace` | The namespace in which the prometheusRule will be created | `""` |
| `metrics.prometheusRule.additionalLabels` | Additional labels for the prometheusRule | `{}` |
@@ -1004,4 +1015,4 @@ Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
limitations under the License.

View File

@@ -0,0 +1,52 @@
{{- /*
Copyright VMware, Inc.
SPDX-License-Identifier: APACHE-2.0
*/}}
{{- if and .Values.metrics.enabled .Values.metrics.podMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: PodMonitor
metadata:
name: {{ template "common.names.fullname" . }}
namespace: {{ default .Release.Namespace .Values.metrics.podMonitor.namespace | quote }}
labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
{{- if .Values.metrics.podMonitor.additionalLabels }}
{{- include "common.tplvalues.render" (dict "value" .Values.metrics.podMonitor.additionalLabels "context" $) | nindent 4 }}
{{- end }}
{{- if .Values.commonAnnotations }}
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
{{- end }}
spec:
podMetricsEndpoints:
- port: http-metrics
{{- if .Values.metrics.podMonitor.interval }}
interval: {{ .Values.metrics.podMonitor.interval }}
{{- end }}
{{- if .Values.metrics.podMonitor.scrapeTimeout }}
scrapeTimeout: {{ .Values.metrics.podMonitor.scrapeTimeout }}
{{- end }}
{{- if .Values.metrics.podMonitor.honorLabels }}
honorLabels: {{ .Values.metrics.podMonitor.honorLabels }}
{{- end }}
{{- if .Values.metrics.podMonitor.relabellings }}
relabelings: {{- toYaml .Values.metrics.podMonitor.relabellings | nindent 6 }}
{{- end }}
{{- if .Values.metrics.podMonitor.metricRelabelings }}
metricRelabelings: {{- toYaml .Values.metrics.podMonitor.metricRelabelings | nindent 6 }}
{{- end }}
{{- if .Values.metrics.serviceMonitor.podTargetLabels }}
podTargetLabels: {{- toYaml .Values.metrics.podMonitor.podTargetLabels | nindent 4 }}
{{- end }}
{{- with .Values.metrics.podMonitor.sampleLimit -}}
sampleLimit: {{ . }}
{{- end }}
{{- with .Values.metrics.podMonitor.targetLimit -}}
targetLimit: {{ . }}
{{- end }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 6 }}
app.kubernetes.io/component: metrics
{{- end }}

View File

@@ -1735,6 +1735,44 @@ metrics:
## @param metrics.serviceMonitor.targetLimit Limit of how many targets should be scraped
##
targetLimit: false
## Prometheus Pod Monitor
## ref: https://github.com/coreos/prometheus-operator
## https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#podmonitor
##
podMonitor:
## @param metrics.podMonitor.enabled Create PodMonitor resource(s) for scraping metrics using PrometheusOperator
##
enabled: false
## @param metrics.podMonitor.namespace The namespace in which the PodMonitor will be created
##
namespace: ""
## @param metrics.podMonitor.interval The interval at which metrics should be scraped
##
interval: 30s
## @param metrics.podMonitor.scrapeTimeout The timeout after which the scrape is ended
##
scrapeTimeout: ""
## @param metrics.podMonitor.relabellings Metrics RelabelConfigs to apply to samples before scraping.
##
relabellings: []
## @param metrics.podMonitor.metricRelabelings Metrics RelabelConfigs to apply to samples before ingestion.
##
metricRelabelings: []
## @param metrics.podMonitor.honorLabels Specify honorLabels parameter to add the scrape endpoint
##
honorLabels: false
## @param metrics.podMonitor.additionalLabels Additional labels that can be used so PodMonitor resource(s) can be discovered by Prometheus
##
additionalLabels: {}
## @param metrics.podMonitor.podTargetLabels Labels from the Kubernetes pod to be transferred to the created metrics
##
podTargetLabels: []
## @param metrics.podMonitor.sampleLimit Limit of how many samples should be scraped from every Pod
##
sampleLimit: false
## @param metrics.podMonitor.targetLimit Limit of how many targets should be scraped
##
targetLimit: false
## Custom PrometheusRule to be defined
## ref: https://github.com/coreos/prometheus-operator#customresourcedefinitions