apiVersion: v1
kind: Service
metadata:
  name: {{ include "bitwarden.fullname" . }}
  labels:
  {{- include "bitwarden.labels" . | nindent 4 }}
  {{- with .Values.service.annotations }}
  annotations:
  {{- toYaml . | nindent 4 }}
  {{- end }}
spec:
  type: {{ .Values.service.type }}
  ports:
    - port: {{ .Values.service.port }}
      targetPort: http
      protocol: TCP
      name: http
    {{- if .Values.bitwarden.websockets.enabled }}
    - port: {{ .Values.bitwarden.websockets.port }}
      targetPort: websocket
      protocol: TCP
      name: websocket
  {{- end }}
  {{- with .Values.service.additionalSpec }}
  {{- toYaml . | nindent 2 }}
  {{- end }}
  selector:
  {{- include "bitwarden.selectorLabels" . | nindent 4 }}