Skip to content

Commit fcaa7ed

Browse files
authored
Merge pull request #18 from bklang/external_traffic_policy
Fix load balancer traffic policy
2 parents 64e9bc4 + a42d955 commit fcaa7ed

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

charts/docker-mailserver/templates/service.yaml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ metadata:
1111
prometheus.io/path: {{ .Values.monitoring.service.path | quote }}
1212
prometheus.io/port: {{ .Values.monitoring.service.port | quote }}
1313
##
14-
## If a load balancer is being used, ensure that the newer type of LB that passes along IP information is used
15-
## rather than the legacy one.
16-
{{- if eq .Values.service.type "LoadBalancer" }}service.beta.kubernetes.io/external-traffic: "OnlyLocal"{{ end }}
1714
{{- if .Values.service.annotations }}
1815
{{ toYaml .Values.service.annotations | indent 2 }}
1916
{{ end }}
@@ -24,6 +21,13 @@ metadata:
2421
release: "{{ .Release.Name }}"
2522
name: {{ template "dockermailserver.fullname" . }}
2623
spec:
24+
## If a load balancer is being used, ensure that the newer type of LB that passes along IP information is used
25+
## rather than the legacy one.
26+
{{- if eq .Values.service.type "LoadBalancer" }}
27+
externalTrafficPolicy: Local
28+
{{ else }}
29+
externalTrafficPolicy: Cluster
30+
{{ end }}
2731
selector:
2832
app: {{ template "dockermailserver.fullname" . }}
2933
release: "{{ .Release.Name }}"
@@ -87,8 +91,7 @@ spec:
8791
loadBalancerIP: {{ .Values.service.loadBalancer.publicIp }}
8892
{{ if .Values.service.loadBalancer.allowedIps -}}
8993
loadBalancerSourceRanges:
90-
{{ .Values.service.loadBalancer.allowedIps | toYaml | indent 4 }}
94+
{{ .Values.service.loadBalancer.allowedIps | toYaml | indent 4 }}
9195
{{ end -}}
9296
{{ end -}}
9397
{{ end }}
94-
externalTrafficPolicy: Local

0 commit comments

Comments
 (0)