Skip to content

Commit

Permalink
Merge pull request #25 from msbsh/fix/ingress-svc-port
Browse files Browse the repository at this point in the history
fix: Makes use of svcPort within ingress, when defined;
  • Loading branch information
laszlocph authored Jul 29, 2021
2 parents efd5d81 + b249805 commit ade37a8
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
2 changes: 1 addition & 1 deletion charts/onechart/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ spec:
paths:
- backend:
serviceName: {{ $robustName }}
servicePort: {{ .root.Values.containerPort }}
servicePort: {{ if .root.Values.svcPort }}{{ .root.Values.svcPort }}{{ else }}{{ .root.Values.containerPort }}{{ end }}
{{- end }}

{{- with .Values.ingress }}
Expand Down
23 changes: 23 additions & 0 deletions charts/onechart/tests/ingress_port_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
suite: test deployment
templates:
- ingress.yaml
tests:
- it: Should use container port
set:
ingress:
host: chart-example.local
containerPort: 1234
asserts:
- equal:
path: spec.rules[0].http.paths[0].backend.servicePort
value: 1234
- it: Should use service port
set:
ingress:
host: chart-example.local
svcPort: 1234
containerPort: 5678
asserts:
- equal:
path: spec.rules[0].http.paths[0].backend.servicePort
value: 1234

0 comments on commit ade37a8

Please sign in to comment.