From e45cf8673ad1253770707be336a0a60065d1f6be Mon Sep 17 00:00:00 2001 From: Michael Schurter Date: Tue, 23 Jun 2020 11:38:01 -0700 Subject: [PATCH] docs: add comments to structs.Port struct --- nomad/structs/structs.go | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/nomad/structs/structs.go b/nomad/structs/structs.go index 7c4c66802..744722021 100644 --- a/nomad/structs/structs.go +++ b/nomad/structs/structs.go @@ -2328,9 +2328,21 @@ func (p AllocatedPorts) Get(label string) (AllocatedPortMapping, bool) { } type Port struct { - Label string - Value int - To int + // Label is the key for HCL port stanzas: port "foo" {} + Label string + + // Value is the static or dynamic port value. For dynamic ports this + // will be 0 in the jobspec and set by the scheduler. + Value int + + // To is the port inside a network namespace where this port is + // forwarded. -1 is an internal sentinel value used by Consul Connect + // to mean "same as the host port." + To int + + // HostNetwork is the name of the network this port should be assigned + // to. Jobs with a HostNetwork set can only be placed on nodes with + // that host network available. HostNetwork string }