From 461d4268e29c97a8e4fc53885356ccea7f3985d9 Mon Sep 17 00:00:00 2001 From: Juana De La Cuesta Date: Wed, 26 Feb 2025 18:05:46 +0100 Subject: [PATCH] func: add python servers to raw exec workloads (#25230) --- .../jobs/raw-exec-batch.nomad.hcl | 45 ++++++++++++---- .../jobs/raw-exec-service.nomad.hcl | 52 +++++++++++++------ .../jobs/raw-exec-system.nomad.hcl | 45 ++++++++++++---- 3 files changed, 109 insertions(+), 33 deletions(-) diff --git a/enos/modules/run_workloads/jobs/raw-exec-batch.nomad.hcl b/enos/modules/run_workloads/jobs/raw-exec-batch.nomad.hcl index 1e931c8a4..678fff52e 100644 --- a/enos/modules/run_workloads/jobs/raw-exec-batch.nomad.hcl +++ b/enos/modules/run_workloads/jobs/raw-exec-batch.nomad.hcl @@ -12,24 +12,51 @@ job "batch-raw-exec" { group "batch-raw-exec" { count = var.alloc_count + network { + port "server" { + to = 0 + } + } + + service { + provider = "consul" + name = "batch-raw-exec" + + check { + name = "batch-raw-exec_probe" + type = "http" + path = "/index.html" + interval = "10s" + timeout = "1s" + port = "server" + } + } + task "batch-raw-exec" { driver = "raw_exec" config { - command = "bash" - args = ["-c", "./local/runme.sh"] + command = "python3" + args = ["-m", "http.server", "${NOMAD_PORT_server}", "--directory", "local"] } template { data = < + + + + + + + + +

All good and running for {{env "NOMAD_JOB_NAME"}} at {{env "node.unique.id"}}!

+ + EOH - destination = "local/runme.sh" - perms = "755" + destination = "local/index.html" + perms = "0644" } resources { diff --git a/enos/modules/run_workloads/jobs/raw-exec-service.nomad.hcl b/enos/modules/run_workloads/jobs/raw-exec-service.nomad.hcl index e461b710f..538a6b730 100644 --- a/enos/modules/run_workloads/jobs/raw-exec-service.nomad.hcl +++ b/enos/modules/run_workloads/jobs/raw-exec-service.nomad.hcl @@ -10,30 +10,52 @@ job "service-raw" { group "service-raw" { count = var.alloc_count + + network { + port "server" { + to = 0 + } + } + + service { + provider = "consul" + name = "service-raw-exec" + + check { + name = "service-raw-exec_probe" + type = "http" + path = "/index.html" + interval = "10s" + timeout = "1s" + port = "server" + } + } + task "raw" { driver = "raw_exec" config { - command = "bash" - args = ["-c", "./local/runme.sh"] + command = "python3" + args = ["-m", "http.server", "${NOMAD_PORT_server}", "--directory", "local"] } template { data = < + + + + + + + + +

All good and running for {{env "NOMAD_JOB_NAME"}} at {{env "node.unique.id"}}!

+ + EOH - destination = "local/runme.sh" - perms = "755" + destination = "local/index.html" + perms = "0644" } resources { diff --git a/enos/modules/run_workloads/jobs/raw-exec-system.nomad.hcl b/enos/modules/run_workloads/jobs/raw-exec-system.nomad.hcl index 6636d5152..9de2ebb14 100644 --- a/enos/modules/run_workloads/jobs/raw-exec-system.nomad.hcl +++ b/enos/modules/run_workloads/jobs/raw-exec-system.nomad.hcl @@ -11,24 +11,51 @@ job "system-raw-exec" { group "system-raw-exec" { + network { + port "server" { + to = 0 + } + } + + service { + provider = "consul" + name = "system-raw-exec" + + check { + name = "system-raw-exec_probe" + type = "http" + path = "/index.html" + interval = "10s" + timeout = "1s" + port = "server" + } + } + task "system-raw-exec" { driver = "raw_exec" config { - command = "bash" - args = ["-c", "./local/runme.sh"] + command = "python3" + args = ["-m", "http.server", "${NOMAD_PORT_server}", "--directory", "local"] } template { data = < + + + + + + + + +

All good and running for {{env "NOMAD_JOB_NAME"}} at {{env "node.unique.id"}}!

+ + EOH - destination = "local/runme.sh" - perms = "755" + destination = "local/index.html" + perms = "0644" } resources {