diff --git a/library/common-test/tests/chartContext/portal_test.yaml b/library/common-test/tests/chartContext/portal_test.yaml index d6f28c29..69fcfea2 100644 --- a/library/common-test/tests/chartContext/portal_test.yaml +++ b/library/common-test/tests/chartContext/portal_test.yaml @@ -725,7 +725,7 @@ tests: my-other-service: enabled: true ports: - my-port: + my-port1: enabled: true port: 123457 my-port2: diff --git a/library/common/templates/lib/util/_chartcontext.tpl b/library/common/templates/lib/util/_chartcontext.tpl index df519d06..63a96aa8 100644 --- a/library/common/templates/lib/util/_chartcontext.tpl +++ b/library/common/templates/lib/util/_chartcontext.tpl @@ -132,7 +132,7 @@ {{- end -}} {{- if not $selectedPort -}} - {{- $portName := ($selectedService.ports | keys | mustFirst) -}} + {{- $portName := ($selectedService.ports | keys | sortAlpha | mustFirst) -}} {{- $selectedPort = (get $selectedService.ports $portName) -}} {{- end -}}