apiVersion: v1
kind: Service
metadata:
  name: {{ template "coredns.fullname" . }}
  labels:
    heritage: {{ .Release.Service | quote }}
    release: {{ .Release.Name | quote }}
    chart: "{{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}"
    {{- if .Values.isClusterService }}
    k8s-app: {{ .Chart.Name | quote }}
    kubernetes.io/cluster-service: "true"
    kubernetes.io/name: "CoreDNS"
    {{- end }}
    app: {{ template "coredns.name" . }}
  annotations:
{{ toYaml .Values.service.annotations | indent 4 }}
spec:
  selector:
    release: {{ .Release.Name | quote }}
    {{- if .Values.isClusterService }}
    k8s-app: {{ .Chart.Name | quote }}
    {{- end }}
    app: {{ template "coredns.name" . }}
  {{- if .Values.service.clusterIP }}
  clusterIP: {{ .Values.service.clusterIP }}
  {{- end }}
  ports:
{{ include "coredns.servicePorts" . | indent 2 -}}
  type: {{ default "ClusterIP" .Values.serviceType }}
