Skip to content

Commit

Permalink
Fix for #154: Allow different labels for regular and headless service
Browse files Browse the repository at this point in the history
  • Loading branch information
bokysan committed Nov 1, 2023
1 parent dcf80cc commit 806eef5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
10 changes: 6 additions & 4 deletions helm/mail/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,21 @@ spec:
{{ if eq .Values.service.type "NodePort" }}nodePort: {{ .Values.service.nodePort }}{{ end }}
selector:
{{- $selectorLabels | nindent 4 }}
{{- if .Values.headlessService.enabled }}
---
# https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#limitations
# StefullSets now require a headless service
# StatefulSets now require a headless service
apiVersion: v1
kind: Service
metadata:
name: {{ print $fullName "-headless" | quote }}
namespace: {{ .Release.Namespace | quote }}
labels:
{{- $labels | nindent 4 }}
{{- with .Values.service.labels }}{{ toYaml . | nindent 4 }}{{ end }}
{{- with .Values.headlessService.labels }}{{ toYaml . | nindent 4 }}{{ end }}
type: headless
annotations:
{{- with .Values.service.annotations }}{{ toYaml . | nindent 4 }}{{ end }}
{{- with .Values.headlessService.annotations }}{{ toYaml . | nindent 4 }}{{ end }}
spec:
type: ClusterIP
clusterIP: None
Expand All @@ -47,4 +48,5 @@ spec:
name: smtp
{{ if eq .Values.service.type "NodePort" }}nodePort: {{ .Values.service.nodePort }}{{ end }}
selector:
{{- $selectorLabels | nindent 4 }}
{{- $selectorLabels | nindent 4 }}
{{- end -}}
7 changes: 7 additions & 0 deletions helm/mail/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ service:
annotations: {}
# nodePort:

# StatefulSets now require a headless service
# https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#limitations
headlessService:
enabled: true
labels: {}
annotations: {}

metrics:
enabled: false
service:
Expand Down

0 comments on commit 806eef5

Please sign in to comment.