[stable/prometheus-pushgateway] Adjust servicemonitor labels (#18877)

* Use fullname for the servicemonitor name

Signed-off-by: cstaud <christian.staude@staffbase.com>

* Bump chart version

Signed-off-by: cstaud <christian.staude@staffbase.com>

* Adjust label usage for serviceMonitor template

Signed-off-by: cstaud <christian.staude@staffbase.com>

* Apply default values and documentation

Signed-off-by: cstaud <christian.staude@staffbase.com>

* Bump chart version

Signed-off-by: cstaud <christian.staude@staffbase.com>

* Decrease matchLabel selectors to  and

Signed-off-by: cstaud <christian.staude@staffbase.com>
This commit is contained in:
Christian Staude
2019-11-14 23:53:42 -08:00
committed by Kubernetes Prow Robot
parent 3399a078f7
commit 397ef22fbf
4 changed files with 47 additions and 39 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ apiVersion: v1
appVersion: "1.0.0"
description: A Helm chart for prometheus pushgateway
name: prometheus-pushgateway
version: 1.2.3
version: 1.2.4
home: https://github.com/prometheus/pushgateway
sources:
- https://github.com/prometheus/pushgateway
+31 -31
View File
@@ -38,37 +38,37 @@ The command removes all the Kubernetes components associated with the chart and
The following table lists the configurable parameters of the pushgateway chart and their default values.
| Parameter | Description | Default |
| --------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | --------------------------------- |
| `affinity` | Affinity settings for pod assignment | `{}` |
| `extraArgs` | Optional flags for pushgateway | `[]` |
| `extraVars` | Optional environment variables for pushgateway | `[]` |
| `image.repository` | Image repository | `prom/pushgateway` |
| `image.tag` | Image tag | `v1.0.0` |
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `ingress.enabled` | Enables Ingress for pushgateway | `false` |
| `ingress.annotations` | Ingress annotations | `{}` |
| `ingress.hosts` | Ingress accepted hostnames | `nil` |
| `ingress.tls` | Ingress TLS configuration | `[]` |
| `resources` | CPU/Memory resource requests/limits | `{}` |
| `replicaCount` | Number of replicas | `1` |
| `service.type` | Service type | `ClusterIP` |
| `service.port` | The service port | `9091` |
| `service.targetPort` | The target port of the container | `9091` |
| `serviceLabels` | Labels for service | `{}` |
| `serviceAccount.create` | Specifies whether a service account should be created. | `true` |
| `serviceAccount.name` | Service account to be used. If not set and `serviceAccount.create` is `true`, a name is generated using the fullname template | |
| `tolerations` | List of node taints to tolerate | `{}` |
| `nodeSelector` | Node labels for pod assignment | `{}` |
| `podAnnotations` | Annotations for pod | `{}` |
| `podLabels` | Labels for pod | `{}` |
| `serviceAccountLabels` | Labels for service account | `{}` |
| `serviceMonitor.enabled` | if `true`, creates a Prometheus Operator ServiceMonitor (also requires `metrics.enabled` to be `true`) | `false` |
| `serviceMonitor.namespace` | Namespace which Prometheus is running in | `monitoring` |
| `serviceMonitor.interval` | How frequently to scrape metrics (use by default, falling back to Prometheus' default) | `nil` |
| `serviceMonitor.selector` | Default to kube-prometheus install (CoreOS recommended), but should be set according to Prometheus install | `{ prometheus: kube-prometheus }` |
| `serviceMonitor.honorLabels`| if `true`, label conflicts are resolved by keeping label values from the scraped data | `true` |
| `podDisruptionBudget` | If set, create a PodDisruptionBudget with the items in this map set in the spec | `` |
| Parameter | Description | Default |
| --------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | --------------------------------- |
| `affinity` | Affinity settings for pod assignment | `{}` |
| `extraArgs` | Optional flags for pushgateway | `[]` |
| `extraVars` | Optional environment variables for pushgateway | `[]` |
| `image.repository` | Image repository | `prom/pushgateway` |
| `image.tag` | Image tag | `v1.0.0` |
| `image.pullPolicy` | Image pull policy | `IfNotPresent` |
| `ingress.enabled` | Enables Ingress for pushgateway | `false` |
| `ingress.annotations` | Ingress annotations | `{}` |
| `ingress.hosts` | Ingress accepted hostnames | `nil` |
| `ingress.tls` | Ingress TLS configuration | `[]` |
| `resources` | CPU/Memory resource requests/limits | `{}` |
| `replicaCount` | Number of replicas | `1` |
| `service.type` | Service type | `ClusterIP` |
| `service.port` | The service port | `9091` |
| `service.targetPort` | The target port of the container | `9091` |
| `serviceLabels` | Labels for service | `{}` |
| `serviceAccount.create` | Specifies whether a service account should be created. | `true` |
| `serviceAccount.name` | Service account to be used. If not set and `serviceAccount.create` is `true`, a name is generated using the fullname template | |
| `tolerations` | List of node taints to tolerate | `{}` |
| `nodeSelector` | Node labels for pod assignment | `{}` |
| `podAnnotations` | Annotations for pod | `{}` |
| `podLabels` | Labels for pod | `{}` |
| `serviceAccountLabels` | Labels for service account | `{}` |
| `serviceMonitor.enabled` | if `true`, creates a Prometheus Operator ServiceMonitor (also requires `metrics.enabled` to be `true`) | `false` |
| `serviceMonitor.namespace` | Namespace which Prometheus is running in | `monitoring` |
| `serviceMonitor.interval` | How frequently to scrape metrics (use by default, falling back to Prometheus' default) | `nil` |
| `serviceMonitor.additionalLables` | Used to pass Labels that are required by the Installed Prometheus Operator | `{}` |
| `serviceMonitor.honorLabels` | if `true`, label conflicts are resolved by keeping label values from the scraped data | `true` |
| `podDisruptionBudget` | If set, create a PodDisruptionBudget with the items in this map set in the spec | `` |
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
@@ -7,8 +7,12 @@ metadata:
namespace: {{ .Values.serviceMonitor.namespace }}
{{- end }}
labels:
{{- range $key, $value := .Values.serviceMonitor.selector }}
{{ $key }}: {{ $value | quote }}
app: {{ template "prometheus-pushgateway.name" . }}
chart: {{ template "prometheus-pushgateway.chart" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
{{- if .Values.serviceMonitor.additionalLabels }}
{{ toYaml .Values.serviceMonitor.additionalLabels | indent 4 }}
{{- end }}
spec:
endpoints:
@@ -17,7 +21,11 @@ spec:
interval: {{ .Values.serviceMonitor.interval }}
{{- end }}
honorLabels: {{ .Values.serviceMonitor.honorLabels }}
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
selector:
matchLabels:
app: {{ template "prometheus-pushgateway.name" . }}
release: {{ .Release.Name }}
{{- end -}}
+5 -5
View File
@@ -98,11 +98,11 @@ serviceMonitor:
namespace: monitoring
# fallback to the prometheus default unless specified
# interval: 10s
## Defaults to what's used if you follow CoreOS [Prometheus Install Instructions](https://github.com/helm/charts/tree/master/stable/prometheus-operator#tldr)
## [Prometheus Selector Label](https://github.com/helm/charts/tree/master/stable/prometheus-operator#prometheus-operator-1)
## [Kube Prometheus Selector Label](https://github.com/helm/charts/tree/master/stable/prometheus-operator#exporters)
selector:
prometheus: kube-prometheus
## Used to pass Labels that are used by the Prometheus installed in your cluster to select Service Monitors to work with
## ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#prometheusspec
additionalLabels: {}
# Retain the job and instance labels of the metrics pushed to the Pushgateway
# [Scraping Pushgateway](https://github.com/prometheus/pushgateway#configure-the-pushgateway-as-a-target-to-scrape)
honorLabels: true