mirror of
https://github.com/bjw-s-labs/helm-charts.git
synced 2025-07-04 08:57:04 +02:00
17 lines
576 B
Smarty
17 lines
576 B
Smarty
{{/*
|
|
Return a service port number by name for a Service object
|
|
*/}}
|
|
{{- define "bjw-s.common.lib.service.getPortNumberByName" -}}
|
|
{{- $rootContext := .rootContext -}}
|
|
{{- $identifier := .serviceID -}}
|
|
{{- $portName := .portName -}}
|
|
|
|
{{- $service := include "bjw-s.common.lib.service.getByIdentifier" (dict "rootContext" $rootContext "id" $identifier) | fromYaml -}}
|
|
|
|
{{- if $service -}}
|
|
{{ $servicePort := dig "ports" $portName "port" nil $service -}}
|
|
{{- if not (eq $servicePort nil) -}}
|
|
{{- $servicePort -}}
|
|
{{- end -}}
|
|
{{- end -}}
|
|
{{- end -}}
|