-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* func: Add more workloads * Update jobs.sh * Update versions.sh * style: format * Update enos/modules/test_cluster_health/scripts/allocs.sh Co-authored-by: Tim Gross <[email protected]> * docs: improve outputs descriptions * func: change docker workloads to be redis boxes and add healthchecks * func: register the services on consul * style: format --------- Co-authored-by: Tim Gross <[email protected]>
- Loading branch information
1 parent
3b9290a
commit b131320
Showing
12 changed files
with
277 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: BUSL-1.1 | ||
variable "alloc_count" { | ||
type = number | ||
default = 1 | ||
} | ||
|
||
job "batch-docker" { | ||
type = "batch" | ||
|
||
group "batch-docker" { | ||
count = var.alloc_count | ||
|
||
network { | ||
port "db" { | ||
to = 6377 | ||
} | ||
} | ||
|
||
service { | ||
provider = "consul" | ||
name = "batch-docker" | ||
port = "db" | ||
|
||
check { | ||
name = "service-docker_probe" | ||
type = "tcp" | ||
interval = "10s" | ||
timeout = "1s" | ||
} | ||
} | ||
|
||
task "batch-docker" { | ||
driver = "docker" | ||
|
||
config { | ||
image = "redis:latest" | ||
ports = ["db"] | ||
args = ["--port", "6377"] | ||
labels { | ||
workload = "docker-batch" | ||
} | ||
} | ||
|
||
resources { | ||
cpu = 50 | ||
memory = 64 | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: BUSL-1.1 | ||
variable "alloc_count" { | ||
type = number | ||
default = 1 | ||
} | ||
|
||
job "system-docker" { | ||
type = "system" | ||
|
||
group "system-docker" { | ||
|
||
network { | ||
port "db" { | ||
to = 6378 | ||
} | ||
} | ||
|
||
service { | ||
provider = "consul" | ||
name = "system-docker" | ||
port = "db" | ||
|
||
check { | ||
name = "system-docker_probe" | ||
type = "tcp" | ||
interval = "10s" | ||
timeout = "1s" | ||
} | ||
} | ||
|
||
|
||
task "system-docker" { | ||
driver = "docker" | ||
|
||
config { | ||
image = "redis:7.2" | ||
ports = ["db"] | ||
args = ["--port", "6378"] | ||
labels { | ||
workload = "docker-system" | ||
} | ||
} | ||
|
||
resources { | ||
cpu = 50 | ||
memory = 64 | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: BUSL-1.1 | ||
|
||
variable "alloc_count" { | ||
type = number | ||
default = 1 | ||
} | ||
|
||
job "batch-raw-exec" { | ||
type = "batch" | ||
|
||
group "batch-raw-exec" { | ||
count = var.alloc_count | ||
|
||
task "batch-raw-exec" { | ||
driver = "raw_exec" | ||
|
||
config { | ||
command = "bash" | ||
args = ["-c", "./local/runme.sh"] | ||
} | ||
|
||
template { | ||
data = <<EOH | ||
#!/bin/bash | ||
while true; do | ||
sleep 30000 | ||
done | ||
EOH | ||
destination = "local/runme.sh" | ||
perms = "755" | ||
} | ||
|
||
resources { | ||
cpu = 50 | ||
memory = 64 | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,11 @@ EOH | |
destination = "local/runme.sh" | ||
perms = "755" | ||
} | ||
|
||
resources { | ||
cpu = 50 | ||
memory = 64 | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: BUSL-1.1 | ||
|
||
variable "alloc_count" { | ||
type = number | ||
default = 1 | ||
} | ||
|
||
job "system-raw-exec" { | ||
type = "system" | ||
|
||
group "system-raw-exec" { | ||
|
||
task "system-raw-exec" { | ||
driver = "raw_exec" | ||
|
||
config { | ||
command = "bash" | ||
args = ["-c", "./local/runme.sh"] | ||
} | ||
|
||
template { | ||
data = <<EOH | ||
#!/bin/bash | ||
while true; do | ||
sleep 30000 | ||
done | ||
EOH | ||
destination = "local/runme.sh" | ||
perms = "755" | ||
} | ||
|
||
resources { | ||
cpu = 50 | ||
memory = 64 | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,27 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: BUSL-1.1 | ||
|
||
/* output "jobs_count" { | ||
value = length(local.job_names) | ||
} */ | ||
|
||
output "jobs_count" { | ||
description = "The number of jobs thar should be running in the cluster" | ||
value = length(var.workloads) + tonumber(coalesce(chomp(enos_local_exec.get_jobs.stdout))) | ||
} | ||
|
||
output "new_jobs_count" { | ||
description = "The number of jobs that were triggered by the module" | ||
value = length(var.workloads) | ||
} | ||
|
||
output "allocs_count" { | ||
description = "The number of allocs that should be running in the cluster" | ||
value = sum([for wl in var.workloads : wl.alloc_count]) | ||
value = local.system_job_count * tonumber(coalesce(chomp(enos_local_exec.get_nodes.stdout))) + local.service_batch_allocs + tonumber(coalesce(chomp(enos_local_exec.get_allocs.stdout))) | ||
} | ||
|
||
output "nodes" { | ||
description = "Number of current clients in the cluster" | ||
value = chomp(enos_local_exec.get_nodes.stdout) | ||
} | ||
|
||
output "new_allocs_count" { | ||
description = "The number of allocs that will be added to the cluster after all the workloads are run" | ||
value = local.system_job_count * tonumber(coalesce(chomp(enos_local_exec.get_nodes.stdout), "0")) + local.service_batch_allocs | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters