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

Ingress controller stats port is not set according to endpointPublishingStrategy

XMLWordPrintable

      Description of problem:

      The statsPort is not correctly set for HostNetwork endpointPublishingStrategyWhen we change the httpPort from 80 to 85 and statsPort from 1936 to 1939 on the default router like here: # oc get IngressController default -n openshift-ingress-operator
      ...
       clientTLS:
          clientCA:
            name: ""
          clientCertificatePolicy: ""
        endpointPublishingStrategy:
          hostNetwork:
            httpPort: 85
            httpsPort: 443
            statsPort: 1939
          type: HostNetwork
      ...
      status:
      ...  
      endpointPublishingStrategy:
          hostNetwork:
            httpPort: 85
            httpsPort: 443
            protocol: TCP
            statsPort: 1939
       
      We can see that the route pods get restarted:# oc get pod -n openshift-ingress
      NAME                              READY   STATUS    RESTARTS   AGE
      router-default-5b96855754-2wnrp   1/1     Running   0          1m
      router-default-5b96855754-9c724   1/1     Running   0          2mThe pods are configured correctly:# oc get pod router-default-5b96855754-2wnrp -o yaml
      ...
      spec:
        containers:
        - env:
          - name: ROUTER_SERVICE_HTTPS_PORT
            value: "443"
          - name: ROUTER_SERVICE_HTTP_PORT
            value: "85"
          - name: STATS_PORT
            value: "1939"
      ...
          livenessProbe:
            failureThreshold: 3
            httpGet:
              host: localhost
              path: /healthz
              port: 1939
              scheme: HTTP
      ...
          ports:
          - containerPort: 85
            hostPort: 85
            name: http
            protocol: TCP
          - containerPort: 443
            hostPort: 443
            name: https
            protocol: TCP
          - containerPort: 1939
            hostPort: 1939
            name: metrics
            protocol: TCPBut the endpoint is incorrect:# oc get ep router-internal-default -o yaml
      ...
      apiVersion: v1
      items:
      - apiVersion: v1
        kind: Endpoints
        metadata:
          creationTimestamp: "2022-12-02T13:34:48Z"
          labels:
            ingresscontroller.operator.openshift.io/owning-ingresscontroller: default
          name: router-internal-default
          namespace: openshift-ingress
          resourceVersion: "23216275"
          uid: 50c00fc0-08e5-4a6a-a7eb-7501fa1a7ba6
        subsets:
        - addresses:
          - ip: 10.74.211.203
            nodeName: worker-0.rhodain01.lab.psi.pnq2.redhat.com
            targetRef:
              kind: Pod
              name: router-default-5b96855754-2wnrp
              namespace: openshift-ingress
              uid: eda945b9-9061-4361-b11a-9d895fee0003
          - ip: 10.74.211.216
            nodeName: worker-1.rhodain01.lab.psi.pnq2.redhat.com
            targetRef:
              kind: Pod
              name: router-default-5b96855754-9c724
              namespace: openshift-ingress
              uid: 97a04c3e-ddea-43b7-ac70-673279057929
          ports:
          - name: metrics
            port: 1936
            protocol: TCP
          - name: https
            port: 443
            protocol: TCP
          - name: http
            port: 85
            protocol: TCP
      kind: List
      metadata:
        resourceVersion: ""
        selfLink: ""Notice that the https port is correctly set to 85, but the stats port is still set to 1936 and not to 1939. That is a problem as the metrics target endpoint is reported as down with an error message:    Get "https://10.74.211.203:1936/metrics": dial tcp 10.74.211.203:1936: connect: connection refusedWhen the EP is corrected and the ports are changed to:
        ports:
        - name: metrics
          port: 1939
          protocol: TCPthe metrics target endpoint is picked up correctly and the metrics are scribed works as expected

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

       

      How reproducible:

      100%

      Steps to Reproduce:

      Set endpointPublishingStrategy and modify the nodeport for statPort:
      
      endpointPublishingStrategy:
          hostNetwork:
            httpPort: 85
            httpsPort: 443
            protocol: TCP
            statsPort: 1939
      

       

      Actual results:

      Stats are scribed from the standard port and not the one specified.

      Expected results:

      The endpoint object is pointing to the specified port.

      Additional info:

       

              mmasters1@redhat.com Miciah Masters
              rhn-support-rhodain1 Roman Hodain
              Shudi Li Shudi Li
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved: