# grafana_charts_service-distributor-discovery.yaml
{{- $dict := dict "ctx" . "component" "distributor" }}
apiVersion: v1
kind: Service
metadata:
  name: {{ include "tempo.resourceName" $dict }}-discovery
  namespace: {{ .Release.Namespace }}
  labels:
    {{- include "tempo.labels" $dict | nindent 4 }}
    {{- with .Values.distributor.serviceDiscovery.labels }}
    {{- toYaml . | nindent 4 }}
    {{- end }}
    prometheus.io/service-monitor: "false"
  {{- with .Values.distributor.serviceDiscovery.annotations }}
  annotations:
    {{- tpl (toYaml . | nindent 4) $ }}
  {{- end }}
spec:
  type: ClusterIP
  clusterIP: None
  ports:
    - name: http-metrics
      port: 3200
      targetPort: http-metrics
    {{- if .Values.traces.jaeger.thriftCompact.enabled }}
    - name: distributor-jaeger-thrift-compact
      port: 6831
      protocol: UDP
      targetPort: jaeger-compact
    {{- end }}
    {{- if .Values.traces.jaeger.thriftBinary.enabled }}
    - name: distributor-jaeger-thrift-binary
      port: 6832
      protocol: UDP
      targetPort: jaeger-binary
    {{- end }}
    {{- if .Values.traces.jaeger.thriftHttp.enabled }}
    - name: distributor-jaeger-thrift-http
      port: 14268
      protocol: TCP
      targetPort: jaeger-http
    {{- end }}
    {{- if .Values.traces.jaeger.grpc.enabled }}
    - name: grpc-distributor-jaeger
      port: 14250
      protocol: TCP
      targetPort: grpc-jaeger
      {{- if .Values.distributor.appProtocol.grpc }}
      appProtocol: {{ .Values.distributor.appProtocol.grpc }}
      {{- end }}
    {{- end }}
    {{- if .Values.traces.zipkin.enabled }}
    - name: distributor-zipkin
      port: 9411
      protocol: TCP
      targetPort: zipkin
    {{- end }}
    {{- if .Values.traces.otlp.http.enabled }}
    - name: distributor-otlp-http
      port: 4318
      protocol: TCP
      targetPort: otlp-http
    {{- end }}
    {{- if .Values.traces.otlp.grpc.enabled }}
    - name: grpc-distributor-otlp
      port: 4317
      protocol: TCP
      targetPort: grpc-otlp
      {{- if .Values.distributor.appProtocol.grpc }}
      appProtocol: {{ .Values.distributor.appProtocol.grpc }}
      {{- end }}
    - name: distributor-otlp-legacy
      port: 55680
      protocol: TCP
      targetPort: grpc-otlp
      {{- if .Values.distributor.appProtocol.grpc }}
      appProtocol: {{ .Values.distributor.appProtocol.grpc }}
      {{- end }}
    {{- end }}
    {{- if .Values.traces.opencensus.enabled }}
    - name: distributor-opencensus
      port: 55678
      protocol: TCP
      targetPort: opencensus
    {{- end }}
  selector:
    {{- include "tempo.selectorLabels" $dict | nindent 4 }}