apiVersion: v1
kind: Service
metadata:
  name: {{ .Values.service.name | default (include "vault-operator.fullname" .)}}
  labels:
    helm.sh/chart: {{ include "vault-operator.chart" . }}
    app.kubernetes.io/name: {{ include "vault-operator.name" . }}
    app.kubernetes.io/instance: {{ .Release.Name }}
    app.kubernetes.io/managed-by: {{ .Release.Service }}
  {{- with .Values.service.annotations }}
  annotations:
    {{- toYaml . | nindent 4 }}
  {{- end }}
spec:
  type: {{ .Values.service.type }}
  ports:
  - port: {{ .Values.service.externalPort }}
    targetPort: {{ .Values.service.internalPort }}
    protocol: TCP
    name: http
  - port: 8383
    protocol: TCP
    name: http-metrics
  selector:
    app.kubernetes.io/name: {{ include "vault-operator.name" . }}
