LoadBalancer svc type and sticky sessions

This commit is contained in:
Laszlo Fogas
2021-04-28 10:29:50 +02:00
parent 5012c4ae5d
commit 27698eda01
3 changed files with 25 additions and 1 deletions
+7 -1
View File
@@ -6,7 +6,13 @@ metadata:
labels: labels:
{{- include "helm-chart.labels" . | nindent 4 }} {{- include "helm-chart.labels" . | nindent 4 }}
spec: spec:
type: {{ if .Values.nodePortEnabled }}NodePort{{ else }}ClusterIP{{ end }} type: {{ if .Values.nodePortEnabled }}NodePort{{ else if .Values.loadbalancerEnabled }}LoadBalancer{{ else }}ClusterIP{{ end }}
{{- if .Values.stickySessions }}
sessionAffinityConfig:
clientIP:
timeoutSeconds: 10800
externalTrafficPolicy: Local
{{- end }}
ports: ports:
{{- if not .Values.ports }} {{- if not .Values.ports }}
- port: {{ if .Values.svcPort }}{{ .Values.svcPort }}{{ else }}{{ .Values.containerPort }}{{ end }} - port: {{ if .Values.svcPort }}{{ .Values.svcPort }}{{ else }}{{ .Values.containerPort }}{{ end }}
@@ -0,0 +1,11 @@
suite: test deployment
templates:
- service.yaml
tests:
- it: Should set NodePort if flag enabled
set:
stickySessions: true
asserts:
- equal:
path: spec.externalTrafficPolicy
value: Local
@@ -14,3 +14,10 @@ tests:
- equal: - equal:
path: spec.type path: spec.type
value: NodePort value: NodePort
- it: Should set LoadBalancer if flag enabled
set:
loadbalancerEnabled: true
asserts:
- equal:
path: spec.type
value: LoadBalancer