Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smaller 0.12 mbit deprecation PR #8911

Merged
merged 3 commits into from
Sep 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions command/assets/example-short.nomad
Original file line number Diff line number Diff line change
Expand Up @@ -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" {}
}
}
}
}
Expand Down
81 changes: 45 additions & 36 deletions command/assets/example.nomad
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
#
Expand All @@ -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
Expand Down
258 changes: 217 additions & 41 deletions command/job_init.bindata_assetfs.go

Large diffs are not rendered by default.

65 changes: 32 additions & 33 deletions website/pages/docs/job-specification/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,44 @@ 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.
group "webs" {
# 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" {
Expand All @@ -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 {
Expand All @@ -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
}
}
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions website/pages/docs/job-specification/network.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
13 changes: 13 additions & 0 deletions website/pages/docs/upgrade/upgrade-specific.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down