apiVersion: v1
kind: Service
metadata:
  name: {{ include "who-need-help.fullname" . }}
  labels:
    {{- include "who-need-help.labels" . | nindent 4 }}
spec:
  type: {{ .Values.service.type }}
  selector:
    {{- include "who-need-help.selectorLabels" . | nindent 4 }}
    app.kubernetes.io/component: web
  ports:
    - name: http
      port: {{ .Values.service.port }}
      targetPort: http
      {{- with .Values.service.nodePort }}
      nodePort: {{ . }}
      {{- end }}
---
apiVersion: v1
kind: Service
metadata:
  name: {{ include "who-need-help.fullname" . }}-worker-metrics
  labels:
    {{- include "who-need-help.labels" . | nindent 4 }}
    app.kubernetes.io/component: worker
spec:
  type: ClusterIP
  selector:
    {{- include "who-need-help.selectorLabels" . | nindent 4 }}
    app.kubernetes.io/component: worker
  ports:
    - name: http
      port: 4000
      targetPort: http
---
apiVersion: v1
kind: Service
metadata:
  name: {{ include "who-need-help.fullname" . }}-headless
  labels:
    {{- include "who-need-help.labels" . | nindent 4 }}
spec:
  clusterIP: None
  publishNotReadyAddresses: true
  selector:
    {{- include "who-need-help.selectorLabels" . | nindent 4 }}
  ports:
    - name: epmd
      port: 4369
      targetPort: 4369
