Uploaded image for project: 'Distributed Tracing'
  1. Distributed Tracing
  2. TRACING-4470

[Upstream] Invalid target port in OTEL collector SVC when endpoint and port is set in the OTLP receiver.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Undefined Undefined
    • None
    • None
    • OpenTelemetry
    • None
    • Tracing Sprint # 256

      Version of components:

      opentelemetry-operator.v0.103.0-27-gd58cf10b

      Description of the problem:
      When an endpoint and port is specified in the OTEL collector receiver config, invalid target port is used in the collector service. 

          receivers:
            otlp/blue:
              protocols:
                http:
            otlp/green:
              protocols:
                http:
                  endpoint: 0.0.0.0:4319
      
      oc get svc otlp-forward-connector-collector -o yaml
      
        ports:
        - appProtocol: http
          name: otlp-blue-http
          port: 4318
          protocol: TCP
          targetPort: 4318
        - appProtocol: http
          name: otlp-green-http
          port: 4319
          protocol: TCP
          targetPort: 4318 -- Port should be 4319

      Steps to reproduce the issue:
      1. Install the OTEL operator built off the latest upstream branch.
      2. Create the OTEL collector instance using following CR:

      apiVersion: opentelemetry.io/v1alpha1
      kind: OpenTelemetryCollector
      metadata:
        name: otlp-forward-connector
      spec:
        mode: deployment
        image: ghcr.io/open-telemetry/opentelemetry-collector-releases/opentelemetry-collector-contrib:0.103.1
        config: |
          receivers:
            otlp/blue:
              protocols:
                http:
            otlp/green:
              protocols:
                http:
                  endpoint: 0.0.0.0:4319
          processors:
            attributes/blue:
              actions:
              - key: otel_pipeline_tag
                value: "blue"
                action: insert
            attributes/green:
              actions:
              - key: otel_pipeline_tag
                value: "green"
                action: insert
            batch:
          exporters:
            debug:
              verbosity: detailed
          connectors:
            forward:
          service:
            pipelines:
              traces/blue:
                receivers: [otlp/blue]
                processors: [attributes/blue]
                exporters: [forward]
              traces/green:
                receivers: [otlp/green]
                processors: [attributes/green]
                exporters: [forward]
              traces:
                receivers: [forward]
                processors: [batch]
                exporters: [debug] 

      3. Check the service created for the collector instance. The target port for otlp-green-http must be 4319

      % oc get svc -o yaml
      apiVersion: v1
      items:
      - apiVersion: v1
        kind: Service
        metadata:
          creationTimestamp: "2024-07-16T05:06:45Z"
          labels:
            app.kubernetes.io/component: opentelemetry-collector
            app.kubernetes.io/instance: chainsaw-forwardconnector.otlp-forward-connector
            app.kubernetes.io/managed-by: opentelemetry-operator
            app.kubernetes.io/name: otlp-forward-connector-collector
            app.kubernetes.io/part-of: opentelemetry
            app.kubernetes.io/version: 0.103.1
            operator.opentelemetry.io/collector-service-type: base
          name: otlp-forward-connector-collector
          namespace: chainsaw-forwardconnector
          ownerReferences:
          - apiVersion: opentelemetry.io/v1beta1
            blockOwnerDeletion: true
            controller: true
            kind: OpenTelemetryCollector
            name: otlp-forward-connector
            uid: 0b9ac05f-eaf0-4589-9215-19076f32aae9
          resourceVersion: "68308"
          uid: 96060504-64b4-4052-af2f-1ab03814c035
        spec:
          clusterIP: 172.30.176.111
          clusterIPs:
          - 172.30.176.111
          internalTrafficPolicy: Cluster
          ipFamilies:
          - IPv4
          ipFamilyPolicy: SingleStack
          ports:
          - appProtocol: http
            name: otlp-blue-http
            port: 4318
            protocol: TCP
            targetPort: 4318
          - appProtocol: http
            name: otlp-green-http
            port: 4319
            protocol: TCP
            targetPort: 4318
          selector:
            app.kubernetes.io/component: opentelemetry-collector
            app.kubernetes.io/instance: chainsaw-forwardconnector.otlp-forward-connector
            app.kubernetes.io/managed-by: opentelemetry-operator
            app.kubernetes.io/part-of: opentelemetry
          sessionAffinity: None
          type: ClusterIP
        status:
          loadBalancer: {}
      - apiVersion: v1
        kind: Service
        metadata:
          annotations:
            service.alpha.openshift.io/serving-cert-signed-by: openshift-service-serving-signer@1721102408
            service.beta.openshift.io/serving-cert-secret-name: otlp-forward-connector-collector-headless-tls
            service.beta.openshift.io/serving-cert-signed-by: openshift-service-serving-signer@1721102408
          creationTimestamp: "2024-07-16T05:06:45Z"
          labels:
            app.kubernetes.io/component: opentelemetry-collector
            app.kubernetes.io/instance: chainsaw-forwardconnector.otlp-forward-connector
            app.kubernetes.io/managed-by: opentelemetry-operator
            app.kubernetes.io/name: otlp-forward-connector-collector
            app.kubernetes.io/part-of: opentelemetry
            app.kubernetes.io/version: 0.103.1
            operator.opentelemetry.io/collector-headless-service: Exists
            operator.opentelemetry.io/collector-service-type: headless
          name: otlp-forward-connector-collector-headless
          namespace: chainsaw-forwardconnector
          ownerReferences:
          - apiVersion: opentelemetry.io/v1beta1
            blockOwnerDeletion: true
            controller: true
            kind: OpenTelemetryCollector
            name: otlp-forward-connector
            uid: 0b9ac05f-eaf0-4589-9215-19076f32aae9
          resourceVersion: "68341"
          uid: 7bb7dd3c-134d-4468-94c2-d6c5f48e8d26
        spec:
          clusterIP: None
          clusterIPs:
          - None
          internalTrafficPolicy: Cluster
          ipFamilies:
          - IPv4
          ipFamilyPolicy: SingleStack
          ports:
          - appProtocol: http
            name: otlp-blue-http
            port: 4318
            protocol: TCP
            targetPort: 4318
          - appProtocol: http
            name: otlp-green-http
            port: 4319
            protocol: TCP
            targetPort: 4318
          selector:
            app.kubernetes.io/component: opentelemetry-collector
            app.kubernetes.io/instance: chainsaw-forwardconnector.otlp-forward-connector
            app.kubernetes.io/managed-by: opentelemetry-operator
            app.kubernetes.io/part-of: opentelemetry
          sessionAffinity: None
          type: ClusterIP
        status:
          loadBalancer: {} 

              bbongart@redhat.com Benedikt Bongartz
              rhn-support-ikanse Ishwar Kanse
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: