[stable/prometheus-operator] not recognizing matchNames in *NamespaceSelector
Describe the bug A clear and concise description of what the bug is.
Version of Helm and Kubernetes: helm: v3.0.3, k8s: v1.15.8-gke.2
Which chart: stable/prometheus-operator
What happened: I got the error below when I try to install a chart via terraform
Error: unable to build kubernetes objects from release manifest: error validating "": error validating data: [ValidationError(Prometheus.spec.ruleNamespaceSelector): unknown field "matchNames" in com.coreos.monitoring.v1.Prometheus.spec.ruleNamespaceSelector, ValidationError(Prometheus.spec.serviceMonitorNamespaceSelector): unknown field "matchNames" in com.coreos.monitoring.v1.Prometheus.spec.serviceMonitorNamespaceSelector]
So I checked code in CRD https://github.com/helm/charts/blob/a97695fcdfbe61599ffd3a92f1ca672e5319ee54/stable/prometheus-operator/crds/crd-prometheus.yaml#L3247-L3290 https://github.com/helm/charts/blob/a97695fcdfbe61599ffd3a92f1ca672e5319ee54/stable/prometheus-operator/crds/crd-prometheus.yaml#L3890-L3934 https://github.com/helm/charts/blob/a97695fcdfbe61599ffd3a92f1ca672e5319ee54/stable/prometheus-operator/crds/crd-prometheus.yaml#L4136-L4169
and it turns out there is no matchNames in the spec but instead there is matchLabels which I think maybe wrong? according to https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#namespaceselector
What you expected to happen:
recognise matchNames in *NamespaceSelector and properly install
How to reproduce it (as minimally and precisely as possible): pick any NamespaceSelector and add matchNames and try installing
# values.yaml
prometheus:
prometheusSpec:
serviceMonitorNamespaceSelector:
matchNames:
- my-namespace
Anything else we need to know:
even though I don't think it's related to terraform or helm provider I will leave the version info here. So I used terraform 0.12.20 and terraform helm provider 1.0.0
Version of Helm and Kubernetes: helm: v3.0.3, k8s: v1.16.3
Error:
error validating "": error validating data: ValidationError(Prometheus.spec.storage.volumeClaimTemplate): unknown field "selector" in com.coreos.monitoring.v1.Prometheus.spec.storage.volumeClaimTemplate
I don't know if my issue is directly linked with this one..
I'm getting the same error when trying to use the any: true option that is also described in the documentation. It looks like either the documentation or the CRD is incorrect. How can one have it select all namespaces?
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]
Same here with Helm v3.1.1 and latest chart 8.10.0 with any: true
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]"
Same here with Helm v3.0.0
Also getting this error with Helm v3:
prometheus:
prometheusSpec:
ruleNamespaceSelector:
any: true
serviceMonitorNamespaceSelector:
any: true
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]
Edit: Removing the any fields allows the deploy to continue. Looking at the CRD the any field is removed as well, seems like Prometheus might be watching all namespaces by default now? I can see existing service monitors are still active with the fields removed.
@servo1x The comments say, it would only watch its own namespace by default:
- https://github.com/helm/charts/blob/master/stable/prometheus-operator/crds/crd-prometheus.yaml#L3890
- https://github.com/helm/charts/blob/master/stable/prometheus-operator/crds/crd-prometheus.yaml#L4136
Also getting this error with Helm v3:
prometheus: prometheusSpec: ruleNamespaceSelector: any: true serviceMonitorNamespaceSelector: any: trueerror 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]Edit: Removing the any fields allows the deploy to continue. Looking at the CRD the any field is removed as well, seems like Prometheus might be watching all namespaces by default now? I can see existing service monitors are still active with the fields removed.
I'm also having the same problem. How do I get Prometheus to watch all namespaces?
the same s.it happened.
From what I understand after asking on slack, the new default here selects all namespace as long as you set serviceMonitorSelectorNilUsesHelmValues: false
So I've set serviceMonitorSelectorNilUsesHelmValues: false but I still get only storage metrics for the monitoring namespace, am I doing something wrong? Is this the same issue or a different one?
Ok one addition, it looks like I am able to monitor the other PVCs in the other namespaces, however the query kube_persistentvolume_capacity_bytes prints only the PVs in the monitoring namespace. Any idea?
Hi there! I have a similar issue
prometheus:
prometheusSpec:
ruleNamespaceSelector:
any: "true"
serviceMonitorNamespaceSelector:
any: "true"
helm version
version.BuildInfo{Version:"v3.2.0", GitCommit:"e11b7ce3b12db2941e90399e874513fbd24bcb71", GitTreeState:"clean", GoVersion:"go1.13.10"}
helm upgrade --install monitoring --namespace monitoring -f /opt/ansible/configs/infra/monitoring/resources/helm_values/helm_values.yaml stable/prometheus-operator --version 8.13.2 --set prometheusOperator.createCustomResource=false
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]
The solution works for me:
prometheus:
prometheusSpec:
ruleNamespaceSelector:
matchLabels:
prometheus: somelabel
serviceMonitorNamespaceSelector:
matchLabels:
prometheus: somelabel
then create some PrometheusRule
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
labels:
role: alert-rules
app: strimzi
prometheus: somelabel
name: prometheus-k8s-rules
....
prometheus-operator has been deployed, but it doesn't see any ServiceMonitor or PrometheusRule in any NS in the cluster
UPD
Finally I've resolved the issue by adding the label to my NS
kubectl label ns cassandra prometheus=somelabel
I also get the error:
error validating data: ValidationError(Prometheus.spec.serviceMonitorNamespaceSelector): unknown field "any" in com.coreos.monitoring.v1.Prometheus.spec.serviceMonitorNamespaceSelector;
For me this is working equivalent for any: true:
apiVersion: monitoring.coreos.com/v1
kind: Prometheus
metadata:
name: some-prometheus
spec:
serviceMonitorSelector:
matchLabels:
prometheus: some
serviceMonitorNamespaceSelector: {}
CHART: prometheus-operator-8.13.0
APP VERSION: 0.38.1
@delfer if you just want to access all namespaces, try setting: serviceMonitorSelectorNilUsesHelmValues: false
@tux-00 did you get your error resolved?
k8s version: v1.16.7
helm version: v3.1.2
i also get error validating data: ValidationError(Prometheus.spec.storage.volumeClaimTemplate): unknown field "selector" in com.coreos.monitoring.v1.Prometheus.spec.storage.volumeClaimTemplate
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.
This issue is being automatically closed due to inactivity.
storage still have some problem on chart 9.1.1
helm version: v3.2.4
Error: unable to build kubernetes objects from release manifest: error validating "": error validating data: ValidationError(Prometheus.spec.storage.volumeClaimTemplate): unknown field "selector" in com.coreos.monitoring.v1.Prometheus.spec.storage.volumeClaimTemplate
same issue here
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]
matchNames also can not be recognized
helm 3.3.4
kube-prometheus-stack-9.4.4