apiVersion: v1
kind: Service
metadata:
  name: {{ include "rsyncd.fullname" . }}
  labels:
    {{- include "rsyncd.labels" . | nindent 4 }}
spec:
  type: {{ .Values.service.type }}
  ports:
    - port: {{ .Values.service.rsync.port }}
      targetPort: 873
      protocol: TCP
      name: rsync
    - port: {{ .Values.service.ssh.port }}
      targetPort: 22
      protocol: TCP
      name: ssh
  {{- if .Values.service.externalIPs.enabled }}
  externalTrafficPolicy: Local
  externalIPs:{{- range .Values.service.externalIPs.ip }}
  - {{.}}{{- end }}
  {{- end }}
  selector:
    {{- include "rsyncd.selectorLabels" . | nindent 4 }}
