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

cli: update default redis and use nomad service discovery #13044

Merged
merged 2 commits into from
May 17, 2022
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
3 changes: 3 additions & 0 deletions .changelog/13044.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:improvement
cli: update default redis and use nomad service discovery
```
4 changes: 2 additions & 2 deletions api/jobs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ func TestJobs_Canonicalize(t *testing.T) {
Name: "redis",
Driver: "docker",
Config: map[string]interface{}{
"image": "redis:3.2",
"image": "redis:7",
"port_map": []map[string]int{{
"db": 6379,
}},
Expand Down Expand Up @@ -708,7 +708,7 @@ func TestJobs_Canonicalize(t *testing.T) {
Name: "redis",
Driver: "docker",
Config: map[string]interface{}{
"image": "redis:3.2",
"image": "redis:7",
"port_map": []map[string]int{{
"db": 6379,
}},
Expand Down
2 changes: 1 addition & 1 deletion client/allocrunner/taskrunner/task_runner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ func TestTaskRunner_TaskEnv_Image(t *testing.T) {
task := alloc.Job.TaskGroups[0].Tasks[0]
task.Driver = "docker"
task.Config = map[string]interface{}{
"image": "redis:3.2-alpine",
"image": "redis:7-alpine",
"network_mode": "none",
"command": "sh",
"args": []string{"-c", "echo $NOMAD_ALLOC_DIR; " +
Expand Down
2 changes: 1 addition & 1 deletion command/assets/example-short.nomad
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ job "example" {
driver = "docker"

config {
image = "redis:3.2"
image = "redis:7"
ports = ["db"]
auth_soft_fail = true
}
Expand Down
13 changes: 7 additions & 6 deletions command/assets/example.nomad
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ job "example" {
}

# 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
# in the service discovery engine, which is currently Nomad or Consul. This
# will make the service discoverable after Nomad has placed it on a host and
# port.
#
# For more information and examples on the "service" stanza, please see
Expand All @@ -167,9 +167,10 @@ job "example" {
# https://www.nomadproject.io/docs/job-specification/service
#
service {
name = "redis-cache"
tags = ["global", "cache"]
port = "db"
name = "redis-cache"
tags = ["global", "cache"]
port = "db"
provider = "nomad"

# The "check" stanza instructs Nomad to create a Consul health check for
# this service. A sample check is provided here for your convenience;
Expand Down Expand Up @@ -302,7 +303,7 @@ job "example" {
# are specific to each driver, so please see specific driver
# documentation for more information.
config {
image = "redis:3.2"
image = "redis:7"
ports = ["db"]

# The "auth_soft_fail" configuration instructs Nomad to try public
Expand Down
2 changes: 1 addition & 1 deletion command/testdata/example-short-bad.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"Lifecycle": null,
"Config": {
"auth_soft_fail": true,
"image": "redis:3.2",
"image": "redis:7",
"ports": [
"db"
]
Expand Down
2 changes: 1 addition & 1 deletion command/testdata/example-short.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"Lifecycle": null,
"Config": {
"auth_soft_fail": true,
"image": "redis:3.2",
"image": "redis:7",
"ports": [
"db"
]
Expand Down
2 changes: 1 addition & 1 deletion demo/csi/digitalocean/volume-job.nomad
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ job "example" {
driver = "docker"

config {
image = "redis:3.2"
image = "redis:7"

port_map {
db = 6379
Expand Down
2 changes: 1 addition & 1 deletion demo/csi/hostpath/redis.nomad
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ job "example" {
driver = "docker"

config {
image = "redis:3.2"
image = "redis:7"
ports = ["db"]
}

Expand Down
8 changes: 4 additions & 4 deletions drivers/docker/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ func TestConfig_ParseHCL(t *testing.T) {
{
"basic image",
`config {
image = "redis:3.2"
image = "redis:7"
}`,
&TaskConfig{
Image: "redis:3.2",
Image: "redis:7",
Devices: []DockerDevice{},
Mounts: []DockerMount{},
MountsList: []DockerMount{},
Expand Down Expand Up @@ -196,7 +196,7 @@ func TestConfig_ParseAllHCL(t *testing.T) {

cfgStr := `
config {
image = "redis:3.2"
image = "redis:7"
image_pull_timeout = "15m"
advertise_ipv6_address = true
args = ["command_arg1", "command_arg2"]
Expand Down Expand Up @@ -342,7 +342,7 @@ config {
}`

expected := &TaskConfig{
Image: "redis:3.2",
Image: "redis:7",
ImagePullTimeout: "15m",
AdvertiseIPv6Addr: true,
Args: []string{"command_arg1", "command_arg2"},
Expand Down
6 changes: 3 additions & 3 deletions drivers/docker/driver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2292,7 +2292,7 @@ func TestDockerDriver_AuthConfiguration(t *testing.T) {
AuthConfig: nil,
},
{
Repo: "redis:3.2",
Repo: "redis:7",
AuthConfig: &docker.AuthConfiguration{
Username: "test",
Password: "1234",
Expand All @@ -2301,7 +2301,7 @@ func TestDockerDriver_AuthConfiguration(t *testing.T) {
},
},
{
Repo: "quay.io/redis:3.2",
Repo: "quay.io/redis:7",
AuthConfig: &docker.AuthConfiguration{
Username: "test",
Password: "5678",
Expand All @@ -2310,7 +2310,7 @@ func TestDockerDriver_AuthConfiguration(t *testing.T) {
},
},
{
Repo: "other.io/redis:3.2",
Repo: "other.io/redis:7",
AuthConfig: &docker.AuthConfiguration{
Username: "test",
Password: "abcd",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"Names": [
"/redis-72bfa388-024e-a903-45b8-2bc28b74ed69"
],
"Image": "redis:3.2",
"Image": "redis:7",
"ImageID": "sha256:87856cc39862cec77541d68382e4867d7ccb29a85a17221446c857ddaebca916",
"Command": "docker-entrypoint.sh redis-server",
"Created": 1568383081,
Expand Down
Loading