# helm_charts_agent-svc.yaml
{{- if .Values.agent.enabled -}}
apiVersion: v1
kind: Service
metadata:
  name: {{ template "jaeger.agent.name" . }}
  labels:
    app.kubernetes.io/name: {{ include "jaeger.name" . }}
    helm.sh/chart: {{ include "jaeger.chart" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/managed-by: {{ .Release.Service }}
    app.kubernetes.io/component: agent
{{- if .Values.agent.service.annotations }}
  annotations:
{{ toYaml .Values.agent.service.annotations | indent 4 }}
{{- end }}
spec:
  ports:
  - name: zipkin-compact
    port: {{ .Values.agent.service.zipkinThriftPort }}
    protocol: UDP
    targetPort: zipkin-compact
  - name: jaeger-compact
    port: {{ .Values.agent.service.compactPort }}
    protocol: UDP
    targetPort: jaeger-compact
  - name: jaeger-binary
    port: {{ .Values.agent.service.binaryPort }}
    protocol: UDP
    targetPort: jaeger-binary
  - name: http
    port: {{ .Values.agent.service.samplingPort }}
    protocol: TCP
    targetPort: http
  type: {{ .Values.agent.service.type }}
  selector:
    app.kubernetes.io/name: {{ include "jaeger.name" . }}
    app.kubernetes.io/component: agent
    app.kubernetes.io/instance: {{ .Release.Name }}
{{- template "loadBalancerSourceRanges" .Values.agent }}
{{- end -}}