-
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.
- Loading branch information
1 parent
d63c1d0
commit 25cf0ba
Showing
13 changed files
with
223 additions
and
46 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,30 @@ | ||
# 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 | ||
|
||
task "batch-docker" { | ||
driver = "docker" | ||
|
||
config { | ||
image = "alpine:latest" | ||
command = "sh" | ||
args = ["-c", "while true; do sleep 30000; done"] | ||
|
||
} | ||
|
||
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 |
---|---|---|
|
@@ -20,8 +20,8 @@ job "service-docker" { | |
} | ||
|
||
resources { | ||
cpu = 100 | ||
memory = 128 | ||
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,29 @@ | ||
# 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" { | ||
|
||
task "system-docker" { | ||
driver = "docker" | ||
|
||
config { | ||
image = "alpine:latest" | ||
command = "sh" | ||
args = ["-c", "while true; do sleep 30000; done"] | ||
|
||
} | ||
|
||
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) + 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 * chomp(enos_local_exec.get_nodes.stdout) + local.service_batch_allocs + 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 should be running in the cluster" | ||
value = local.system_job_count * chomp(enos_local_exec.get_nodes.stdout) + 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
Oops, something went wrong.