Merge pull request #8911 from hashicorp/f-task_network_warning-smaller
Smaller 0.12 mbit deprecation PR
This commit is contained in:
commit
87b0437e0f
|
@ -2,25 +2,24 @@ job "example" {
|
|||
datacenters = ["dc1"]
|
||||
|
||||
group "cache" {
|
||||
network {
|
||||
port "db" {
|
||||
to = 6379
|
||||
}
|
||||
}
|
||||
|
||||
task "redis" {
|
||||
driver = "docker"
|
||||
|
||||
config {
|
||||
image = "redis:3.2"
|
||||
|
||||
port_map {
|
||||
db = 6379
|
||||
}
|
||||
ports = ["db"]
|
||||
}
|
||||
|
||||
resources {
|
||||
cpu = 500
|
||||
memory = 256
|
||||
|
||||
network {
|
||||
mbits = 10
|
||||
port "db" {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -142,6 +142,49 @@ job "example" {
|
|||
# to 1.
|
||||
count = 1
|
||||
|
||||
# The "network" stanza specifies the network configuration for the allocation
|
||||
# including requesting port bindings.
|
||||
#
|
||||
# For more information and examples on the "network" stanza, please see
|
||||
# the online documentation at:
|
||||
#
|
||||
# https://www.nomadproject.io/docs/job-specification/network
|
||||
#
|
||||
network {
|
||||
port "db" {
|
||||
to = 6379
|
||||
}
|
||||
}
|
||||
|
||||
# The "service" stanza instructs Nomad to register this task as a service
|
||||
# in the service discovery engine, which is currently Consul. This will
|
||||
# make the service addressable after Nomad has placed it on a host and
|
||||
# port.
|
||||
#
|
||||
# For more information and examples on the "service" stanza, please see
|
||||
# the online documentation at:
|
||||
#
|
||||
# https://www.nomadproject.io/docs/job-specification/service
|
||||
#
|
||||
service {
|
||||
name = "redis-cache"
|
||||
tags = ["global", "cache"]
|
||||
port = "db"
|
||||
|
||||
# The "check" stanza instructs Nomad to create a Consul health check for
|
||||
# this service. A sample check is provided here for your convenience;
|
||||
# uncomment it to enable it. The "check" stanza is documented in the
|
||||
# "service" stanza documentation.
|
||||
|
||||
# check {
|
||||
# name = "alive"
|
||||
# type = "tcp"
|
||||
# interval = "10s"
|
||||
# timeout = "2s"
|
||||
# }
|
||||
|
||||
}
|
||||
|
||||
# The "restart" stanza configures a group's behavior on task failure. If
|
||||
# left unspecified, a default restart policy is used based on the job type.
|
||||
#
|
||||
|
@ -261,9 +304,7 @@ job "example" {
|
|||
config {
|
||||
image = "redis:3.2"
|
||||
|
||||
port_map {
|
||||
db = 6379
|
||||
}
|
||||
ports = ["db"]
|
||||
}
|
||||
|
||||
# The "artifact" stanza instructs Nomad to download an artifact from a
|
||||
|
@ -301,7 +342,7 @@ job "example" {
|
|||
# }
|
||||
|
||||
# The "resources" stanza describes the requirements a task needs to
|
||||
# execute. Resource requirements include memory, network, cpu, and more.
|
||||
# execute. Resource requirements include memory, cpu, and more.
|
||||
# This ensures the task will execute on a machine that contains enough
|
||||
# resource capacity.
|
||||
#
|
||||
|
@ -313,40 +354,8 @@ job "example" {
|
|||
resources {
|
||||
cpu = 500 # 500 MHz
|
||||
memory = 256 # 256MB
|
||||
|
||||
network {
|
||||
mbits = 10
|
||||
port "db" {}
|
||||
}
|
||||
}
|
||||
# The "service" stanza instructs Nomad to register this task as a service
|
||||
# in the service discovery engine, which is currently Consul. This will
|
||||
# make the service addressable after Nomad has placed it on a host and
|
||||
# port.
|
||||
#
|
||||
# For more information and examples on the "service" stanza, please see
|
||||
# the online documentation at:
|
||||
#
|
||||
# https://www.nomadproject.io/docs/job-specification/service
|
||||
#
|
||||
service {
|
||||
name = "redis-cache"
|
||||
tags = ["global", "cache"]
|
||||
port = "db"
|
||||
|
||||
# The "check" stanza instructs Nomad to create a Consul health check for
|
||||
# this service. A sample check is provided here for your convenience;
|
||||
# uncomment it to enable it. The "check" stanza is documented in the
|
||||
# "service" stanza documentation.
|
||||
|
||||
# check {
|
||||
# name = "alive"
|
||||
# type = "tcp"
|
||||
# interval = "10s"
|
||||
# timeout = "2s"
|
||||
# }
|
||||
|
||||
}
|
||||
|
||||
# The "template" stanza instructs Nomad to manage a template, such as
|
||||
# a configuration file or script. This template can optionally pull data
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -58,6 +58,7 @@ job "docs" {
|
|||
max_parallel = 2
|
||||
}
|
||||
|
||||
|
||||
# A group defines a series of tasks that should be co-located
|
||||
# on the same client (host). All tasks within a group will be
|
||||
# placed on the same host.
|
||||
|
@ -65,6 +66,36 @@ job "docs" {
|
|||
# Specify the number of these tasks we want.
|
||||
count = 5
|
||||
|
||||
network {
|
||||
# This requests a dynamic port named "http". This will
|
||||
# be something like "46283", but we refer to it via the
|
||||
# label "http".
|
||||
port "http" {}
|
||||
|
||||
# This requests a static port on 443 on the host. This
|
||||
# will restrict this task to running once per host, since
|
||||
# there is only one port 443 on each host.
|
||||
port "https" {
|
||||
static = 443
|
||||
}
|
||||
}
|
||||
|
||||
# The service block tells Nomad how to register this service
|
||||
# with Consul for service discovery and monitoring.
|
||||
service {
|
||||
# This tells Consul to monitor the service on the port
|
||||
# labelled "http". Since Nomad allocates high dynamic port
|
||||
# numbers, we use labels to refer to them.
|
||||
port = "http"
|
||||
|
||||
check {
|
||||
type = "http"
|
||||
path = "/health"
|
||||
interval = "10s"
|
||||
timeout = "2s"
|
||||
}
|
||||
}
|
||||
|
||||
# Create an individual task (unit of work). This particular
|
||||
# task utilizes a Docker container to front a web application.
|
||||
task "frontend" {
|
||||
|
@ -77,22 +108,6 @@ job "docs" {
|
|||
image = "hashicorp/web-frontend"
|
||||
}
|
||||
|
||||
# The service block tells Nomad how to register this service
|
||||
# with Consul for service discovery and monitoring.
|
||||
service {
|
||||
# This tells Consul to monitor the service on the port
|
||||
# labelled "http". Since Nomad allocates high dynamic port
|
||||
# numbers, we use labels to refer to them.
|
||||
port = "http"
|
||||
|
||||
check {
|
||||
type = "http"
|
||||
path = "/health"
|
||||
interval = "10s"
|
||||
timeout = "2s"
|
||||
}
|
||||
}
|
||||
|
||||
# It is possible to set environment variables which will be
|
||||
# available to the task when it runs.
|
||||
env {
|
||||
|
@ -102,26 +117,10 @@ job "docs" {
|
|||
}
|
||||
|
||||
# Specify the maximum resources required to run the task,
|
||||
# include CPU, memory, and bandwidth.
|
||||
# include CPU and memory.
|
||||
resources {
|
||||
cpu = 500 # MHz
|
||||
memory = 128 # MB
|
||||
|
||||
network {
|
||||
mbits = 100
|
||||
|
||||
# This requests a dynamic port named "http". This will
|
||||
# be something like "46283", but we refer to it via the
|
||||
# label "http".
|
||||
port "http" {}
|
||||
|
||||
# This requests a static port on 443 on the host. This
|
||||
# will restrict this task to running once per host, since
|
||||
# there is only one port 443 on each host.
|
||||
port "https" {
|
||||
static = 443
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,6 +50,8 @@ job "docs" {
|
|||
|
||||
## `network` Parameters
|
||||
|
||||
- `mbits` <code>([*deprecated*](/docs/upgrade/upgrade-specific#nomad-0-12-0) int: 10)</code> - Specifies the bandwidth required in MBits.
|
||||
|
||||
- `port` <code>([Port](#port-parameters): nil)</code> - Specifies a TCP/UDP port
|
||||
allocation and can be used to specify both dynamic ports and reserved ports.
|
||||
|
||||
|
|
|
@ -17,6 +17,19 @@ standard upgrade flow.
|
|||
|
||||
## Nomad 0.12.0
|
||||
|
||||
### `mbits` and Task Network Resource deprecation
|
||||
|
||||
Starting in Nomad 0.12.0 the `mbits` field of the network resource block has
|
||||
been deprecated. This is in part because we felt that `mbits` didn't
|
||||
accurately account network bandwidth as a resource.
|
||||
|
||||
Additionally the use of the `network` block inside of a task's `resource` block is
|
||||
also deprecated. Users are advised to move their `network` block to the `group`
|
||||
block. Recent networking features have only been added to group based network
|
||||
configuration. If any usecase or feature which was available with task network
|
||||
resource is not fulfilled with group network configuration, please open an issue
|
||||
detailing the missing capability.
|
||||
|
||||
### Enterprise Licensing
|
||||
|
||||
Enterprise binaries for Nomad are now publicly available via
|
||||
|
|
Loading…
Reference in a new issue