Ability to have different container and svcPort

This commit is contained in:
Laszlo Fogas
2021-04-28 10:06:25 +02:00
parent 6ee68880ae
commit 1ecdba097b
2 changed files with 20 additions and 1 deletions
+1 -1
View File
@@ -8,7 +8,7 @@ metadata:
spec: spec:
type: {{ if .Values.nodePortEnabled }}NodePort{{ else }}ClusterIP{{ end }} type: {{ if .Values.nodePortEnabled }}NodePort{{ else }}ClusterIP{{ end }}
ports: ports:
- port: {{ .Values.containerPort }} - port: {{ if .Values.svcPort }}{{ .Values.svcPort }}{{ else }}{{ .Values.containerPort }}{{ end }}
targetPort: http targetPort: http
protocol: TCP protocol: TCP
name: http name: http
@@ -0,0 +1,19 @@
suite: test deployment
templates:
- service.yaml
tests:
- it: Should set containerPort as default
set:
containerPort: 11111
asserts:
- equal:
path: spec.ports[0].port
value: 11111
- it: Should set svcPort if it is defined
set:
containerPort: 11111
svcPort: 22222
asserts:
- equal:
path: spec.ports[0].port
value: 22222