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

Routes per shard metric inaccurate if using matchExpression

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 4.12.z
    • 4.12
    • Networking / router
    • None
    • Important
    • None
    • Sprint 226, Sprint 227
    • 2
    • Rejected
    • False
    • Hide

      None

      Show
      None
    • NA

      Description of problem:

      If using ingresscontroller.spec.routeSelector.matchExpressions or ingresscontroller.spec.namespaceSelector.matchExpressions, the route will not count in the new route_metrics_controller_routes_per_shard prometheus metric.
      
      This is due to the logic only using "matchLabels". The logic needs to be updated to also use "matchExpressions".

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

      4.12

      How reproducible:

      100%

      Steps to Reproduce:

      1. Create IC with matchExpressions:
      oc apply -f - <<EOF
      apiVersion: operator.openshift.io/v1
      kind: IngressController
      metadata:
        name: sharded
        namespace: openshift-ingress-operator
      spec:
        domain: reproducer.$domain
        routeSelector:
          matchExpressions:
          - key: type
            operator: In
            values:
            - shard
        replicas: 1
        nodePlacement:
          nodeSelector:
            matchLabels:
              node-role.kubernetes.io/worker: ""
      EOF
      
      2. Create the route:
      oc apply -f - <<EOF
      apiVersion: route.openshift.io/v1
      kind: Route
      metadata:
        name: route-shard
        labels:
          type: shard
      spec:
        to:
          kind: Service
          name: router-shard
      EOF
      
       3. Check route_metrics_controller_routes_per_shard{name="sharded"} in prometheus, it's 0 

      Actual results:

      route_metrics_controller_routes_per_shard{name="sharded"} has 0 routes

      Expected results:

      route_metrics_controller_routes_per_shard{name="sharded"} should have 1 route

      Additional info:

       

              gspence@redhat.com Grant Spence
              gspence@redhat.com Grant Spence
              Shudi Li Shudi Li
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: