{{- if .Values.proxy.enabled }}
apiVersion: v1
kind: Service
metadata:
  labels: {{- include "common.labels.standard" . | nindent 4 }}
    app.kubernetes.io/component: proxy
    {{- if .Values.commonLabels }}
    {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
    {{- end }}
  name: {{ template "common.names.fullname" . }}-proxy
  {{- if .Values.commonAnnotations }}
  annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
  {{- end }}
spec:
  ports:
    - name: wavefront
      port: {{ .Values.proxy.port }}
      protocol: TCP
    {{- if .Values.proxy.tracePort }}
    - name: wavefront-trace
      port: {{ .Values.proxy.tracePort }}
      protocol: TCP
    {{- end }}
    {{- if .Values.proxy.jaegerPort }}
    - name: jaeger
      port: {{ .Values.proxy.jaegerPort }}
      protocol: TCP
    {{- end }}
    {{- if .Values.proxy.traceJaegerHttpListenerPort }}
    - name: jaeger-thriftdata
      port: {{ .Values.proxy.traceJaegerHttpListenerPort }}
      protocol: TCP
    {{- end }}
    {{- if .Values.proxy.zipkinPort }}
    - name: zipkin
      port: {{ .Values.proxy.zipkinPort }}
      protocol: TCP
    {{- end }}
    {{- if .Values.proxy.histogramPort }}
    - name: histogram
      port: {{ .Values.proxy.histogramPort }}
      protocol: TCP
    {{- end }}
    {{- if .Values.proxy.histogramMinutePort }}
    - name: histogram-minute
      port: {{ .Values.proxy.histogramMinutePort }}
      protocol: TCP
    {{- end }}
    {{- if .Values.proxy.histogramHourPort }}
    - name: histogram-hour
      port: {{ .Values.proxy.histogramHourPort }}
      protocol: TCP
    {{- end }}
    {{- if .Values.proxy.histogramDayPort }}
    - name: histogram-day
      port: {{ .Values.proxy.histogramDayPort }}
      protocol: TCP
    {{- end }}
    {{- if .Values.proxy.deltaCounterPort }}
    - name: delta-counter
      port: {{ .Values.proxy.deltaCounterPort }}
      protocol: TCP
    {{- end }}
  selector: {{- include "common.labels.matchLabels" . | nindent 4 }}
    app.kubernetes.io/component: proxy
  type: ClusterIP
{{ end }}
