blob: 95babce289982050441e8d6cfe7e09c8c7696c24 [file] [log] [blame]
Mohammed Naser9ad0d462023-01-15 20:36:37 -05001{{- if .Values.deployment.enabled }}
2---
3apiVersion: v1
4kind: Service
5metadata:
6 name: {{ default (include "coredns.fullname" .) .Values.service.name }}
Mohammed Naser65cda132024-05-02 14:34:08 -04007 namespace: {{ .Release.Namespace }}
8 labels: {{- include "coredns.labels" . | nindent 4 }}
Mohammed Naser9ad0d462023-01-15 20:36:37 -05009{{- if .Values.customLabels }}
10{{ toYaml .Values.customLabels | indent 4 }}
11{{- end }}
12 {{- if or .Values.service.annotations .Values.customAnnotations }}
13 annotations:
14 {{- if .Values.service.annotations }}
15 {{- toYaml .Values.service.annotations | nindent 4 }}
16 {{- end }}
17 {{- if .Values.customAnnotations }}
18 {{- toYaml .Values.customAnnotations | nindent 4 }}
19 {{- end }}
20 {{- end }}
21spec:
22 selector:
Mohammed Naser7d1623e2024-06-17 09:12:39 -040023 {{- if .Values.service.selector }}
24 {{- toYaml .Values.service.selector | nindent 4 }}
25 {{- else }}
Mohammed Naser9ad0d462023-01-15 20:36:37 -050026 app.kubernetes.io/instance: {{ .Release.Name | quote }}
27 {{- if .Values.isClusterService }}
Mohammed Naser65cda132024-05-02 14:34:08 -040028 k8s-app: {{ template "coredns.k8sapplabel" . }}
Mohammed Naser9ad0d462023-01-15 20:36:37 -050029 {{- end }}
30 app.kubernetes.io/name: {{ template "coredns.name" . }}
Mohammed Naser7d1623e2024-06-17 09:12:39 -040031 {{- end }}
Mohammed Naser9ad0d462023-01-15 20:36:37 -050032 {{- if .Values.service.clusterIP }}
33 clusterIP: {{ .Values.service.clusterIP }}
34 {{- end }}
Mohammed Naser65cda132024-05-02 14:34:08 -040035 {{- if .Values.service.clusterIPs }}
36 clusterIPs:
37 {{ toYaml .Values.service.clusterIPs | nindent 4 }}
38 {{- end }}
Mohammed Naser9ad0d462023-01-15 20:36:37 -050039 {{- if .Values.service.externalIPs }}
40 externalIPs:
Mohammed Naser65cda132024-05-02 14:34:08 -040041 {{- toYaml .Values.service.externalIPs | nindent 4 }}
Mohammed Naser9ad0d462023-01-15 20:36:37 -050042 {{- end }}
43 {{- if .Values.service.externalTrafficPolicy }}
44 externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy }}
45 {{- end }}
46 {{- if .Values.service.loadBalancerIP }}
47 loadBalancerIP: {{ .Values.service.loadBalancerIP }}
48 {{- end }}
49 ports:
50{{ include "coredns.servicePorts" . | indent 2 -}}
51 type: {{ default "ClusterIP" .Values.serviceType }}
Mohammed Naser65cda132024-05-02 14:34:08 -040052 {{- if .Values.service.ipFamilyPolicy }}
53 ipFamilyPolicy: {{ .Values.service.ipFamilyPolicy }}
54 {{- end }}
Mohammed Naser9ad0d462023-01-15 20:36:37 -050055{{- end }}