Helm-charts: not recognizing matchNames in *NamespaceSelector

Created on 29 Sep 2020  路  10Comments  路  Source: prometheus-community/helm-charts

Describe the bug
serviceMonitorNamespaceSelector can not recognize matchnames and any

Version of Helm and Kubernetes:

Helm Version:
3.3.4

Kubernetes Version:
1.19.2

Which chart:
Which version of the chart:
kube-prometheus-stack-9.4.4

What happened:

Error: UPGRADE FAILED: error validating "": error validating data: [ValidationError(Prometheus.spec.ruleNamespaceSelector): unknown field "any" in com.coreos.monitoring.v1.Prometheus.spec.ruleNamespaceSelector, ValidationError(Prometheus.spec.serviceMonitorNamespaceSelector): unknown field "any" in com.coreos.monitoring.v1.Prometheus.spec.serviceMonitorNamespaceSelector]

What you expected to happen:
work correctly

How to reproduce it (as minimally and precisely as possible):

helm install monitor prometheus-community/kube-prometheus-stack -f pro-values.yaml

<~--
This could be something like:

values.yaml (only put values which differ from the defaults)

prometheus:
  prometheusSpec: 
    serviceMonitorNamespaceSelector:
        any: true # or
        matchNames:
           - default
           - monitor
helm install my-release prometheus-community/name-of-chart --version version --values values.yaml

-->

Anything else we need to know:

bug

Most helpful comment

Same issue with any for most *NamespaceSelectors:

prometheus:
  prometheusSpec:
    ruleNamespaceSelector:
      any: true
    serviceMonitorNamespaceSelector:
      any: true
    podMonitorNamespaceSelector:
      any: true
Error: UPGRADE FAILED: error validating "": error validating data: [ValidationError(Prometheus.spec.podMonitorNamespaceSelector): unknown field "any" in com.coreos.monitoring.v1.Prometheus.spec.podMonitorNamespaceSelector, ValidationError(Prometheus.spec.ruleNamespaceSelector): unknown field "any" in com.coreos.monitoring.v1.Prometheus.spec.ruleNamespaceSelector, ValidationError(Prometheus.spec.serviceMonitorNamespaceSelector): unknown field "any" in com.coreos.monitoring.v1.Prometheus.spec.serviceMonitorNamespaceSelector]

While on the other hand, using matchLabels works perfectly for all namespaces labeled with prometheus=monitoring:

prometheus:
    ruleSelectorNilUsesHelmValues: false
    ruleNamespaceSelector:
      matchLabels:
        prometheus: monitoring
    serviceMonitorSelectorNilUsesHelmValues: false
    serviceMonitorNamespaceSelector:
      matchLabels:
        prometheus: monitoring
    podMonitorSelectorNilUsesHelmValues: false
    podMonitorNamespaceSelector:
      matchLabels:
        prometheus: monitoring
    probeSelectorNilUsesHelmValues: false
    probeNamespaceSelector:
      matchLabels:
        prometheus: monitoring

Using kube-prometheus-stack 11.0.4, Helm 3.1.3. Same issue in old repository: https://github.com/helm/charts/issues/20581

All 10 comments

As the snippet says above:

  • you should use either any: true to enable all namespaces, or
  • explicitly enable some by listing them under matchNames

As the snippet says above:

  • you should use either any: true to enable all namespaces, or
  • explicitly enable some by listing them under matchNames

@fktkrt I use this config above but helm report error. it can not know these parameters. any and matchNames are invalid when use helm install .

Same issue encountered yesterday, for RuleMatchNamespace (not remember the right sintax)

can you try serviceMonitorNamespaceSelector: {} ? That sure ensure that service monitors from all namespaces will be selected

Same issue with any for most *NamespaceSelectors:

prometheus:
  prometheusSpec:
    ruleNamespaceSelector:
      any: true
    serviceMonitorNamespaceSelector:
      any: true
    podMonitorNamespaceSelector:
      any: true
Error: UPGRADE FAILED: error validating "": error validating data: [ValidationError(Prometheus.spec.podMonitorNamespaceSelector): unknown field "any" in com.coreos.monitoring.v1.Prometheus.spec.podMonitorNamespaceSelector, ValidationError(Prometheus.spec.ruleNamespaceSelector): unknown field "any" in com.coreos.monitoring.v1.Prometheus.spec.ruleNamespaceSelector, ValidationError(Prometheus.spec.serviceMonitorNamespaceSelector): unknown field "any" in com.coreos.monitoring.v1.Prometheus.spec.serviceMonitorNamespaceSelector]

While on the other hand, using matchLabels works perfectly for all namespaces labeled with prometheus=monitoring:

prometheus:
    ruleSelectorNilUsesHelmValues: false
    ruleNamespaceSelector:
      matchLabels:
        prometheus: monitoring
    serviceMonitorSelectorNilUsesHelmValues: false
    serviceMonitorNamespaceSelector:
      matchLabels:
        prometheus: monitoring
    podMonitorSelectorNilUsesHelmValues: false
    podMonitorNamespaceSelector:
      matchLabels:
        prometheus: monitoring
    probeSelectorNilUsesHelmValues: false
    probeNamespaceSelector:
      matchLabels:
        prometheus: monitoring

Using kube-prometheus-stack 11.0.4, Helm 3.1.3. Same issue in old repository: https://github.com/helm/charts/issues/20581

can you try serviceMonitorNamespaceSelector: {} ? That sure ensure that service monitors from all namespaces will be selected

According to the comment in CRD by default only the current namespace is selected.

I have same issue 鈽癸笍
Would anybody help in this regard?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any further update will cause the issue/pull request to no longer be considered stale. Thank you for your contributions.

Any update on this?

Was this page helpful?
0 / 5 - 0 ratings