Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow defining ipFamilyPolicy for external service #362

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions mailu/templates/front/service-external.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ spec:
{{- with .Values.front.externalService }}
type: {{ .type | default "ClusterIP" }}
externalTrafficPolicy: {{ .externalTrafficPolicy | default "Local" }}
{{- with .ipFamilyPolicy }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why use with here and not if?
It would seem that it's not certain that ipFamilyPolicy exists.
with assumes your variable is present: https://helm.sh/docs/chart_template_guide/control_structures/#modifying-scope-using-with

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With and if should behave the same if the variable is absent (not yielding anything), but with only makes you write the name of the field (ipFamilyPolicy) once. So the chance to make a typo is reduced by 50% 😁

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The "typo chance" is not a joke, I think the vast majority of helm chart bugs I've seen, fixed, and introduced come from copypasting snippets and forget to change part of them.

ipFamilyPolicy: {{ . | quote }}
{{- end }}
{{- if .loadBalancerIP }}
loadBalancerIP: {{ .loadBalancerIP }}
{{- end }}
Expand Down
2 changes: 2 additions & 0 deletions mailu/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,7 @@ front:
## @param front.externalService.enabled Expose front mail ports via external service (ClusterIP or LoadBalancer)
## @param front.externalService.type Service type (ClusterIP or LoadBalancer)
## @param front.externalService.externalTrafficPolicy Service externalTrafficPolicy (Cluster or Local)
## @param front.externalService.ipFamilyPolicy Service ipFamilyPolicy, for dual stack clusters.
## @param front.externalService.loadBalancerIP Service loadBalancerIP
## @param front.externalService.annotations Service annotations
## @param front.externalService.ports.pop3 Expose POP3 port - 110/tcp
Expand All @@ -694,6 +695,7 @@ front:
## type: LoadBalancer
loadBalancerIP: ""
externalTrafficPolicy: Local
ipFamilyPolicy: ""
annotations: {}
ports:
pop3: false
Expand Down
Loading