[stable/prometheus-operator] allow empty ruleSelector and ruleNamespaceSelector (#11395)

Currently an empty ruleSelector or ruleNamespaceSelector does not select
all PrometheusRules or Namespaces respectively. Fix the prometheus
template to allow empty ruleSelector and ruleNamespaceSelector.

Signed-off-by: Nick Troast <ntroast@gmail.com>
This commit is contained in:
Nick Troast
2019-02-18 02:52:27 -08:00
committed by Kubernetes Prow Robot
parent b032d016db
commit 6877582cd8
4 changed files with 19 additions and 18 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ name: prometheus-operator
sources:
- https://github.com/coreos/prometheus-operator
- https://coreos.com/operators/prometheus
version: 2.2.2
version: 2.2.3
appVersion: 0.26.0
home: https://github.com/coreos/prometheus-operator
keywords:
+4 -4
View File
@@ -148,8 +148,8 @@ The following tables lists the configurable parameters of the prometheus-operato
| `prometheus.additionalServiceMonitors` | List of `serviceMonitor` objects to create. See https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#servicemonitorspec | `[]` |
| `prometheus.prometheusSpec.podMetadata` | Standard objects metadata. More info: https://github.com/kubernetes/community/blob/master/contributors/devel/api-conventions.md#metadata Metadata Labels and Annotations gets propagated to the prometheus pods. | `{}` |
| `prometheus.prometheusSpec.serviceMonitorSelectorNilUsesHelmValues` | If true, a nil or {} value for prometheus.prometheusSpec.serviceMonitorSelector will cause the prometheus resource to be created with selectors based on values in the helm deployment, which will also match the servicemonitors created | `true` |
| `prometheus.prometheusSpec.serviceMonitorSelector` | ServiceMonitors to be selected for target discovery. | `{}` |
| `prometheus.prometheusSpec.serviceMonitorNamespaceSelector` | Namespaces to be selected for ServiceMonitor discovery. If nil, only check own namespace. | `{}` |
| `prometheus.prometheusSpec.serviceMonitorSelector` | ServiceMonitors to be selected for target discovery. If {}, select all ServiceMonitors | `{}` |
| `prometheus.prometheusSpec.serviceMonitorNamespaceSelector` | Namespaces to be selected for ServiceMonitor discovery. If nil, select own namespace. If {}, select all namespaces. | `{}` |
| `prometheus.prometheusSpec.image.repository` | Base image to use for a Prometheus deployment. | `quay.io/prometheus/prometheus` |
| `prometheus.prometheusSpec.image.tag` | Tag of Prometheus container image to be deployed. | `v2.5.0` |
| `prometheus.prometheusSpec.paused` | When a Prometheus deployment is paused, no actions except for deletion will be performed on the underlying objects. | `false` |
@@ -163,8 +163,8 @@ The following tables lists the configurable parameters of the prometheus-operato
| `prometheus.prometheusSpec.routePrefix` | The route prefix Prometheus registers HTTP handlers for. This is useful, if using ExternalURL and a proxy is rewriting HTTP routes of a request, and the actual ExternalURL is still true, but the server serves requests under a different route prefix. For example for use with `kubectl proxy`. | `/` |
| `prometheus.prometheusSpec.storageSpec` | Storage spec to specify how storage shall be used. | `{}` |
| `prometheus.prometheusSpec.ruleSelectorNilUsesHelmValues` | If true, a nil or {} value for prometheus.prometheusSpec.ruleSelector will cause the prometheus resource to be created with selectors based on values in the helm deployment, which will also match the PrometheusRule resources created. | `true` |
| `prometheus.prometheusSpec.ruleSelector` | A selector to select which PrometheusRules to mount for loading alerting rules from. Until (excluding) Prometheus Operator v0.24.0 Prometheus Operator will migrate any legacy rule ConfigMaps to PrometheusRule custom resources selected by RuleSelector. Make sure it does not match any config maps that you do not want to be migrated. | `{}` |
| `prometheus.prometheusSpec.ruleNamespaceSelector` | Namespaces to be selected for PrometheusRules discovery. If unspecified, only the same namespace as the Prometheus object is in is used. | `{}` |
| `prometheus.prometheusSpec.ruleSelector` | A selector to select which PrometheusRules to mount for loading alerting rules from. Until (excluding) Prometheus Operator v0.24.0 Prometheus Operator will migrate any legacy rule ConfigMaps to PrometheusRule custom resources selected by RuleSelector. Make sure it does not match any config maps that you do not want to be migrated. If {}, select all PrometheusRules | `{}` |
| `prometheus.prometheusSpec.ruleNamespaceSelector` | Namespaces to be selected for PrometheusRules discovery. If nil, select own namespace. If {}, select all namespaces. | `{}` |
| `prometheus.prometheusSpec.alertingEndpoints` | Alertmanagers to which alerts will be sent https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#alertmanagerendpoints Default configuration will connect to the alertmanager deployed as part of this release | `[]` |
| `prometheus.prometheusSpec.resources` | Define resources requests and limits for single Pods. | `{}` |
| `prometheus.prometheusSpec.nodeSelector` | Define which Nodes the Pods are scheduled on. | `{}` |
@@ -93,10 +93,11 @@ spec:
securityContext:
{{ toYaml .Values.prometheus.prometheusSpec.securityContext | indent 4 }}
{{- end }}
{{- if .Values.prometheus.prometheusSpec.ruleNamespaceSelector }}
ruleNamespaceSelector:
{{ toYaml .Values.prometheus.prometheusSpec.ruleNamespaceSelector | indent 4 }}
{{ else }}
ruleNamespaceSelector: {}
{{- end }}
{{- if .Values.prometheus.prometheusSpec.ruleSelector }}
ruleSelector:
@@ -106,7 +107,9 @@ spec:
matchLabels:
app: {{ template "prometheus-operator.name" . }}
release: {{ .Release.Name | quote }}
{{- end }}
{{ else }}
ruleSelector: {}
{{- end }}
{{- if .Values.prometheus.prometheusSpec.storageSpec }}
storage:
{{ toYaml .Values.prometheus.prometheusSpec.storageSpec | indent 4 }}
+9 -11
View File
@@ -798,7 +798,7 @@ prometheus:
configMaps: []
## Namespaces to be selected for PrometheusRules discovery.
## If unspecified, only the same namespace as the Prometheus object is in is used.
## If nil, select own namespace. If {}, select all namespaces.
##
ruleNamespaceSelector: {}
@@ -808,10 +808,8 @@ prometheus:
##
ruleSelectorNilUsesHelmValues: true
## Rules CRD selector
## ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/design.md
## If unspecified the release `app` and `release` will be used as the label selector
## to load rules
## PrometheusRules to be selected for target discovery.
## If {}, select all ServiceMonitors
##
ruleSelector: {}
## Example which select all prometheusrules resources
@@ -835,17 +833,17 @@ prometheus:
##
serviceMonitorSelectorNilUsesHelmValues: true
## serviceMonitorSelector will limit which servicemonitors are used to create scrape
## configs in Prometheus. See serviceMonitorSelectorUseHelmLabels
## ServiceMonitors to be selected for target discovery.
## If {}, select all ServiceMonitors
##
serviceMonitorSelector: {}
# serviceMonitorSelector: {}
## Example which selects ServiceMonitors with label "prometheus" set to "somelabel"
# serviceMonitorSelector:
# matchLabels:
# prometheus: somelabel
## serviceMonitorNamespaceSelector will limit namespaces from which serviceMonitors are used to create scrape
## configs in Prometheus. By default all namespaces will be used
## Namespaces to be selected for ServiceMonitor discovery.
## If nil, select own namespace. If {}, select all namespaces.
##
serviceMonitorNamespaceSelector: {}