pub struct Service {
pub name: String,
pub tags: Vec<String>,
pub meta: Option<HashMap<String, String>>,
pub canary_tags: Vec<String>,
pub canary_meta: Option<HashMap<String, String>>,
pub port_label: Option<String>,
pub address_mode: AddressMode,
pub checks: Vec<ConsulCheck>,
pub connect: Option<HashMap<String, DriverConfig>>,
}Expand description
A Service object represents a routable and discoverable service on the network. Nomad integrates with Consul for service discovery. Nomad automatically registers when a task is started and de-registers it when the task transitions to the dead state.
Fields§
§name: StringAn explicit name for the Service. Nomad will replace ${JOB}, ${TASKGROUP} and ${TASK} by the name of the job, task group or task, respectively. ${BASE} expands to the equivalent of ${JOB}-${TASKGROUP}-${TASK}, and is the default name for a Service. Each service defined for a given task must have a distinct name, so if a task has multiple services only one of them can use the default name and the others must be explicitly named. Names must adhere to RFC-1123 §2.1 and are limited to alphanumeric and hyphen characters (i.e. [a-z0-9-]), and be less than 64 characters in length.
A list of string tags associated with this Service. String interpolation is supported in tags.
meta: Option<HashMap<String, String>>A key-value map that annotates the Consul service with user-defined metadata. String interpolation is supported in meta
A list of string tags associated with this Service while it is a canary. Once the canary is promoted, the registered tags will be updated to the set defined in the Tags field. String interpolation is supported in tags.
canary_meta: Option<HashMap<String, String>>A key-value map that annotates this Service while it is a canary. Once the canary is promoted, the registered meta will be updated to the set defined in the Meta field or removed if the Meta field is not set. String interpolation is supported in meta keys and values.
port_label: Option<String>This is used to associate a port with the service. If specified, the port label must match one defined in the resources block. This could be a label of either a dynamic or a static port.
address_mode: AddressModeSpecifies what address (host or driver-specific) this service should advertise. This setting is supported in Docker since Nomad 0.6 and rkt since Nomad 0.7.
checks: Vec<ConsulCheck>Checks define health checks associated with the service. Nomad supports the script, http and tcp Consul Checks. See also ConsulCheck
connect: Option<HashMap<String, DriverConfig>>