Add values to enable metric relabeling to ServiceMonitor (#51)

* add values to use metric relabeling on ServiceMonitor

* tweak README.md (PR#48)

* bump chart version to 1.2.3 (non-breaking change, backwards compatible)

* document new option in README.md
This commit is contained in:
Patrick Dreker 2021-05-05 07:46:33 +02:00 committed by GitHub
parent 9543376ad0
commit 8fb72806f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 24 additions and 6 deletions

View File

@ -1,7 +1,7 @@
apiVersion: v1 apiVersion: v1
description: A chart for a Cadvisor deployment description: A chart for a Cadvisor deployment
name: cadvisor name: cadvisor
version: 1.2.2 version: 1.2.3
appVersion: 0.38.6 appVersion: 0.38.6
home: https://github.com/google/cadvisor home: https://github.com/google/cadvisor
sources: sources:

View File

@ -1,6 +1,6 @@
# Cadvisor # cAdvisor
A chart for a Cadvisor deployment A chart for a cAdvisor deployment
Learn more: [https://github.com/google/cadvisor](https://github.com/google/cadvisor) Learn more: [https://github.com/google/cadvisor](https://github.com/google/cadvisor)
@ -26,7 +26,7 @@ To install the chart with the release name `my-release`:
$ helm install --name my-release ckotzbauer/cadvisor $ helm install --name my-release ckotzbauer/cadvisor
``` ```
The command deploys the Cadvisor on the Kubernetes cluster using the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation. The command deploys cAdvisor on the Kubernetes cluster using the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation.
## Uninstalling the Chart ## Uninstalling the Chart
@ -39,7 +39,7 @@ The command removes all the Kubernetes components associated with the chart and
## Configuration ## Configuration
The following table lists the configurable parameters of the Prometheus MSTeams chart and their default values. The following table lists the configurable parameters of the cAdvisor chart and their default values.
| Parameter | Description | Default | | Parameter | Description | Default |
| ------------------------------ | ------------------------------------------------ | -------------------------- | | ------------------------------ | ------------------------------------------------ | -------------------------- |
@ -60,6 +60,7 @@ The following table lists the configurable parameters of the Prometheus MSTeams
| `podSecurityPolicy.create` | create a own PodSecurityPolicy for the pod | `false` | | `podSecurityPolicy.create` | create a own PodSecurityPolicy for the pod | `false` |
| `podSecurityPolicy.privileged` | create the PodSecurityPolicy as privileged | `false` | | `podSecurityPolicy.privileged` | create the PodSecurityPolicy as privileged | `false` |
| `metrics.enabled` | create ServiceMonitor CR for Prometheus operator | `false` | | `metrics.enabled` | create ServiceMonitor CR for Prometheus operator | `false` |
| `metrics.relabeling` | add relabeling configuration to ServiceMonitor | `[]` |
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,

View File

@ -19,4 +19,8 @@ spec:
endpoints: endpoints:
- path: /metrics - path: /metrics
port: http port: http
{{- end -}} {{- if .Values.metrics.relabelings }}
metricRelabelings:
{{- toYaml .Values.metrics.relabelings | nindent 8 }}
{{- end -}}
{{- end -}}

View File

@ -67,3 +67,16 @@ affinity: {}
# This will create a ServiceMonitor Custom Resource indicating the prometheus operator what to scrape. # This will create a ServiceMonitor Custom Resource indicating the prometheus operator what to scrape.
metrics: metrics:
enabled: false enabled: false
# This will allow you to specify relabelings on the metrics. E.g. to use the kubernetes monitoring
# mixin with this chart set metrics.enabled above to true and use:
# relabelings:
# - sourceLabels:
# - name
# targetLabel: container
# - sourceLabels:
# - container_label_io_kubernetes_pod_namespace
# targetLabel: namespace
# - sourceLabels:
# - container_label_io_kubernetes_pod_name
# targetLabel: pod
relabelings: []