Uploaded image for project: 'OpenShift Bugs'
  1. OpenShift Bugs
  2. OCPBUGS-36719

[release-4.15] ServiceMonitor proxyUrl validation missing which breaks reload and restart of Prometheus

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done-Errata
    • Icon: Normal Normal
    • None
    • 4.13, 4.12, 4.14
    • Monitoring
    • No
    • MON Sprint 257, MON Sprint 258
    • 2
    • False
    • Hide

      None

      Show
      None
    • Hide
      * Previously, setting an invalid `.spec.endpoints.proxyUrl` attribute in the `ServiceMonitor` resource would result in breaking, reloading, and restarting Prometheus. This update fixes the issue by validating the `proxyUrl` attribute against invalid syntax. (link:https://issues.redhat.com/browse/OCPBUGS-30989[*OCPBUGS-30989*])
      Show
      * Previously, setting an invalid `.spec.endpoints.proxyUrl` attribute in the `ServiceMonitor` resource would result in breaking, reloading, and restarting Prometheus. This update fixes the issue by validating the `proxyUrl` attribute against invalid syntax. (link: https://issues.redhat.com/browse/OCPBUGS-30989 [* OCPBUGS-30989 *])
    • Bug Fix
    • In Progress

      Description of problem:

      Injecting ServiceMonitor CR's having invalid syntax on the proxyUrl attribute will not be valdidated and rejected but will break reloading and restarting of Prometheus due to possible invalid syntax.

      Version-Release number of selected component (if applicable):

      4.12.x 4.13.x 4.14.x

      How reproducible:

      always

      Steps to Reproduce:

          1. Inject custom ServiceMonitor CR with an invalid proxyUrl (example: 'http://xxx-${STAGE}.svc.cluster.local:80')
       

      Complete CR

      apiVersion: monitoring.coreos.com/v1
      kind: ServiceMonitor
      metadata:  
        name: servicemonitor  
        namespace: xxxx
      spec:  
        endpoints:    
          - path: /actuator/prometheus-text      
            port: http-web      
            proxyUrl: 'http://xxx-${STAGE}.svc.cluster.local:80'            
            relabelings:        
             - action: labeldrop          
               regex: pod        
             - action: drop          
               regex: destination          
               sourceLabels:
                 - reporter        
             - action: drop          
               regex: ^envoy_.*          
               sourceLabels:
                 - __name__  
        selector:
          matchLabels:
            monitored: prometheus 

      Actual results:

      ts=2024-03-13T13:42:47.471Z caller=main.go:928 level=error msg="Error reloading config" err="couldn't load configuration (--config.file=\"/etc/prometheus/config_out/prometheus.env.yaml\"): parsing YAML file /etc/prometheus/config_out/prometheus.env.yaml: parse \http://XXXX-${STAGE}.svc.cluster.local:80\: invalid character \"{\" in host name"

      Expected results:

      successful reload

      Additional info:

          

              janantha@redhat.com Jayapriya Pai
              rhn-support-milang Michaela Lang
              Junqi Zhao Junqi Zhao
              Eliska Romanova Eliska Romanova
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: