service-port
The default provisioner for service resources, this expects a workload and port name and will return the hostname and port required to contact it. This will validate that the workload and port exist, but won’t enforce a dependency relationship yet.
Outputs a hostname and port for connecting to another workload.
type: service-port
supported_params:
- workload
- port
expected_outputs:
- hostname
- portprovisioners.yaml
(view on GitHub)
:
- uri: template://default-provisioners/service-port
type: service-port
description: Outputs a hostname and port for connecting to another workload.
outputs: |
{{ if not .Params.workload }}{{ fail "expected 'workload' param for the target workload name" }}{{ end }}
{{ if not .Params.port }}{{ fail "expected 'port' param for the name of the target workload service port" }}{{ end }}
{{ if or (not $w) (not $w.ServiceName) }}{{ fail "unknown workload" }}{{ end }}
{{ if not $w }}{{ fail "unknown workload" }}{{ end }}
{{ $p := (index $w.Ports .Params.port) }}
{{ if not $p }}{{ fail "unknown service port" }}{{ end }}
hostname: {{ $w.ServiceName | quote }}
port: {{ $p.TargetPort }}
expected_outputs:
- hostname
- port
supported_params:
- workload
- port