apiVersion: v1
kind: Service
metadata:
  {{- if or .Values.service.annotations .Values.customAnnotations }}
  annotations:
  {{- if .Values.service.annotations }}
  {{ toYaml .Values.service.annotations | indent 4 }}
  {{- end }}
  {{- if .Values.customAnnotations }}
  {{- toYaml .Values.customAnnotations | nindent 4 }}
  {{- end }}
  {{- end }}
  labels:
    {{- include "k8s-prometheus-adapter.labels" . | indent 4 }}
  name: {{ template "k8s-prometheus-adapter.fullname" . }}
  namespace: {{ include "k8s-prometheus-adapter.namespace" . }}
spec:
{{- if .Values.service.ipDualStack.enabled }}
  ipFamilies: {{ toYaml .Values.service.ipDualStack.ipFamilies | nindent 4 }}
  ipFamilyPolicy: {{ .Values.service.ipDualStack.ipFamilyPolicy }}
{{- end }}
  ports:
  - port: {{ .Values.service.port }}
    name: https
    protocol: TCP
    targetPort: https
  selector:
    {{- include "k8s-prometheus-adapter.selectorLabels" . | indent 4 }}
  type: {{ .Values.service.type }}
  {{- if .Values.service.clusterIP }}
  clusterIP: {{ .Values.service.clusterIP }}
  {{- end }}
