{{- if .Values.service.enabled -}}
apiVersion: v1
kind: Service
metadata:
  name: {{ template "datadog.fullname" . }}
  labels:
    app: {{ template "datadog.fullname" . }}
    chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
    release: "{{ .Release.Name }}"
spec:
  type: {{ .Values.service.serviceType }}
  selector:
    app: {{ template "datadog.fullname" . }}
  ports:
  - port: 8125
    name: dogstatsdport
    protocol: UDP
  {{- if .Values.datadog.apmEnabled }}
  - port: 8126
    name: traceport
    protocol: TCP
  {{- end }}
{{- end -}}
