Uploaded image for project: 'ONAP Operations Manager'
  1. ONAP Operations Manager
  2. OOM-2925

Mariadb-galera ServiceMonitor is not selected by Prometheus

XMLWordPrintable

    • Hide

      SUMMARY

      Mariadb-galera ServiceMonitor object is not selected by Prometheus resource within prometheus-operator (part of kube-prometheus-stack)

      OS / ENVIRONMENT

      • Kubernetes version:
        v1.19.14
      • Helm version:
        v3.6.3

      OOM VERSION

      Istanbul/Jakarta(master)

      DESCRIPTION

       

      By default within mariadb-galera chart in its values.yaml there is a definition:

      # kubernetes/common/mariadb-galera/values.yaml
      (...)
        serviceMonitor:
          enabled: false
      (...)
          ## ref: https://github.com/bitnami/charts/tree/master/bitnami/prometheus-operator#prometheus-configuration
          ##
          selector:
            prometheus: kube-prometheus

      As a result mariadb-galera ServiceMonitor object has the selector match labels defined as below:

      spec:
        endpoints:
        - path: /metrics
          port: metrics
        namespaceSelector:
          matchNames:
          - onap
        selector:
          matchLabels:
            prometheus: kube-prometheus 

      This makes the Prometheus not select above ServiceMonitor because mariadb-galera metrics service does not have label "prometheus: kube-prometheus" (it has common labels assigned just like any other service defined from global templates):

      # kubectl describe svc onap-mariadb-galera-metrics
      (...)
      Labels:            app.kubernetes.io/instance=onap
                         app.kubernetes.io/managed-by=Helm
                         app.kubernetes.io/name=mariadb-galera
                         helm.sh/chart=mariadb-galera-9.0.0
      (...) 

       

      SOLUTION

      Disable the selector assignment in chart's values. As a result the ServiceMonitor for mariadb-galera will have the selector labels defined properly:

       Spec:
        Endpoints:
          Path:  /metrics
          Port:  metrics
        Namespace Selector:
          Match Names:
            onap
        Selector:
          Match Labels:
            app.kubernetes.io/instance:    onap
            app.kubernetes.io/managed-by:  Helm
            app.kubernetes.io/name:        mariadb-galera
            helm.sh/chart:                 mariadb-galera-9.0.0

       

      It is not possible to override the selector within chart values because any custom values are merged with the default one from values.yaml.

      Show
      SUMMARY Mariadb-galera ServiceMonitor object is not selected by Prometheus resource within prometheus-operator (part of kube-prometheus-stack) OS / ENVIRONMENT Kubernetes version: v1.19.14 Helm version: v3.6.3 OOM VERSION Istanbul/Jakarta(master) DESCRIPTION   By default within mariadb-galera chart in its values.yaml there is a definition: # kubernetes/common/mariadb-galera/values.yaml (...) serviceMonitor: enabled: false (...) ## ref: https: //github.com/bitnami/charts/tree/master/bitnami/prometheus- operator #prometheus-configuration ## selector: prometheus: kube-prometheus As a result mariadb-galera ServiceMonitor object has the selector match labels defined as below: spec: endpoints: - path: /metrics port: metrics namespaceSelector: matchNames: - onap selector: matchLabels: prometheus: kube-prometheus This makes the Prometheus not select above ServiceMonitor because mariadb-galera metrics service does not have label "prometheus: kube-prometheus" (it has common labels assigned just like any other service defined from global templates): # kubectl describe svc onap-mariadb-galera-metrics (...) Labels: app.kubernetes.io/instance=onap app.kubernetes.io/managed-by=Helm app.kubernetes.io/name=mariadb-galera helm.sh/chart=mariadb-galera-9.0.0 (...)   SOLUTION Disable the selector assignment in chart's values. As a result the ServiceMonitor for mariadb-galera will have the selector labels defined properly: Spec: Endpoints: Path: /metrics Port: metrics Namespace Selector: Match Names: onap Selector: Match Labels: app.kubernetes.io/instance: onap app.kubernetes.io/managed-by: Helm app.kubernetes.io/name: mariadb-galera helm.sh/chart: mariadb-galera-9.0.0   It is not possible to override the selector within chart values because any custom values are merged with the default one from values.yaml.

          bgrzybowski bgrzybowski
          bgrzybowski bgrzybowski
          Votes:
          0 Vote for this issue
          Watchers:
          1 Start watching this issue

            Created:
            Updated:
            Resolved: