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

add externalTrafficPolicy toggle #145

Open
wants to merge 16 commits 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
2 changes: 1 addition & 1 deletion charts/docker-mailserver/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
appVersion: "14.0.0"
description: A fullstack but simple mailserver (smtp, imap, antispam, antivirus, ssl...) using Docker.
name: docker-mailserver
version: 4.1.3
version: 4.1.4
sources:
- https://github.com/docker-mailserver/docker-mailserver-helm
maintainers:
Expand Down
2 changes: 1 addition & 1 deletion charts/docker-mailserver/ci/ci-haproxy.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
service:
type: ClusterIP
type: ClusterIP
12 changes: 9 additions & 3 deletions charts/docker-mailserver/templates/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,17 @@ metadata:
spec:
## If a load balancer is being used, ensure that the newer type of LB that passes along IP information is used
## rather than the legacy one.
{{- if eq .Values.service.type "LoadBalancer" }}
{{- if or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer") }}
Copy link
Author

Choose a reason for hiding this comment

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

Only do this if we are using LB or NodePort

{{- if .Values.service.externalTrafficPolicy }}
Copy link
Author

Choose a reason for hiding this comment

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

if we have an explicit value set, use that

externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy }}
{{- end }}
{{- if and (not .Values.service.externalTrafficPolicy) (eq .Values.service.type "LoadBalancer") }}
Copy link
Author

Choose a reason for hiding this comment

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

if we don't have an explicit value set AND the type is Loadbalancer, use Local

externalTrafficPolicy: Local
{{- else if eq .Values.service.type "NodePort" }}
{{- end }}
{{- if and (not .Values.service.externalTrafficPolicy) (eq .Values.service.type "NodePort") }}
Copy link
Author

Choose a reason for hiding this comment

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

if we don't have an explicit value set AND the type is NodePort, use Cluster

externalTrafficPolicy: Cluster
{{ end }}
{{- end }}
{{- end }}
selector:
app.kubernetes.io/name: {{ template "dockermailserver.fullname" . }}
release: "{{ .Release.Name }}"
Expand Down
9 changes: 8 additions & 1 deletion charts/docker-mailserver/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -298,8 +298,15 @@ deployment:
service:
## What scope the service should be exposed in. One of:
## - LoadBalancer (to the world)
## - NodePort (to the world, via high port on a node)
## - ClusterIP (to the cluster)
type: "LoadBalancer"
type: "ClusterIP"
## Manually overwrite the externalTrafficPolicy. One of:
## - Local
## - Cluster
## Set it to "Local" when used with type "LoadBalancer" and set it to "Cluster" when used with "NodePort",
## unless you have a good reason not to.
# externalTrafficPolicy: "Cluster"
## If there is a port associated with a given service, expose it here.
# port:
## If there is a particular IP that should be used for the service, specify it here.
Expand Down
Loading