# grafana_charts_service-distributor.yaml
{{- $dict := dict "ctx" . "component" "distributor" }}
apiVersion: v1
kind: Service
metadata:
  name: {{ include "tempo.resourceName" $dict }}
  namespace: {{ .Release.Namespace }}
  labels:
    {{- include "tempo.labels" $dict | nindent 4 }}
    {{- with .Values.distributor.service.labels }}
    {{- toYaml . | nindent 4 }}
    {{- end }}
  {{- with .Values.distributor.service.annotations }}
  annotations:
    {{- tpl (toYaml . | nindent 4) $ }}
  {{- end }}
spec:
  internalTrafficPolicy: {{ .Values.distributor.service.internalTrafficPolicy }}
  type: {{ .Values.distributor.service.type }}
  ipFamilies: {{ .Values.tempo.service.ipFamilies }}
  ipFamilyPolicy: {{ .Values.tempo.service.ipFamilyPolicy }}
  ports:
    - name: http-metrics
      port: 3200
      targetPort: http-metrics
    - name: grpc
      port: 9095
      protocol: TCP
      targetPort: 9095
      {{- if .Values.distributor.appProtocol.grpc }}
      appProtocol: {{ .Values.distributor.appProtocol.grpc }}
      {{- end }}
    {{- 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 }}
  {{- if .Values.distributor.service.loadBalancerIP }}
  loadBalancerIP: {{ .Values.distributor.service.loadBalancerIP  }}
  {{- end }}
  {{- with .Values.distributor.service.externalTrafficPolicy }}
  externalTrafficPolicy: {{ . }}
  {{- end }}
  {{- with .Values.distributor.service.loadBalancerSourceRanges}}
  loadBalancerSourceRanges:
    {{ toYaml . | nindent 4 }}
  {{- end }}
  selector:
    {{- include "tempo.selectorLabels" $dict | nindent 4 }}