apiVersion: v1
kind: Service
metadata:
  name: {{ template "vault-secrets-webhook.fullname" . }}
  namespace: {{ .Release.Namespace }}
  labels:
    helm.sh/chart: {{ template "vault-secrets-webhook.chart" . }}
    app.kubernetes.io/name: {{ template "vault-secrets-webhook.name" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/managed-by: {{ .Release.Service }}
    app.kubernetes.io/component: mutating-webhook
  {{- if .Values.service.annotations }}
  annotations:
{{ toYaml .Values.service.annotations | indent 4 }}
  {{- end }}  
spec:
  type: {{ .Values.service.type }}
  ports:
    - port: {{ .Values.service.externalPort }}
      targetPort: {{ .Values.service.internalPort }}
      protocol: TCP
      name: {{ .Values.service.name }}
  selector:
    app.kubernetes.io/name: {{ template "vault-secrets-webhook.name" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
