-
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.
Add an upgrade test workload for CSI with the AWS EBS plugin. In order to validate this workload, we'll need to deploy the plugin jobs and then register volumes with them. So this extends the `run_workloads` module to allow for a "post script" to be run after a given job has been deployed. We can use that as a model for other test workloads. Ref: https://hashicorp.atlassian.net/browse/NET-12217
- Loading branch information
Showing
10 changed files
with
313 additions
and
9 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
45 changes: 45 additions & 0 deletions
45
enos/modules/run_workloads/jobs/plugin-aws-ebs-controller.nomad.hcl
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,45 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: BUSL-1.1 | ||
variable "alloc_count" { | ||
type = number | ||
default = 2 | ||
} | ||
|
||
job "plugin-aws-ebs-controller" { | ||
|
||
constraint { | ||
attribute = "${attr.kernel.name}" | ||
value = "linux" | ||
} | ||
|
||
group "controller" { | ||
|
||
count = var.alloc_count | ||
|
||
task "plugin" { | ||
driver = "docker" | ||
|
||
config { | ||
image = "public.ecr.aws/ebs-csi-driver/aws-ebs-csi-driver:v1.33.0" | ||
|
||
args = [ | ||
"controller", | ||
"--endpoint=${CSI_ENDPOINT}", | ||
"--logtostderr", | ||
"--v=5", | ||
] | ||
} | ||
|
||
csi_plugin { | ||
id = "aws-ebs0" | ||
type = "controller" | ||
mount_dir = "/csi" | ||
} | ||
|
||
resources { | ||
cpu = 100 | ||
memory = 256 | ||
} | ||
} | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
enos/modules/run_workloads/jobs/plugin-aws-ebs-nodes.nomad.hcl
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,48 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: BUSL-1.1 | ||
|
||
# this variable is not used but required by runner | ||
variable "alloc_count" { | ||
type = number | ||
default = 1 | ||
} | ||
|
||
job "plugin-aws-ebs-nodes" { | ||
|
||
constraint { | ||
attribute = "${attr.kernel.name}" | ||
value = "linux" | ||
} | ||
|
||
type = "system" | ||
|
||
group "nodes" { | ||
task "plugin" { | ||
driver = "docker" | ||
|
||
config { | ||
image = "public.ecr.aws/ebs-csi-driver/aws-ebs-csi-driver:v1.33.0" | ||
|
||
args = [ | ||
"node", | ||
"--endpoint=${CSI_ENDPOINT}", | ||
"--logtostderr", | ||
"--v=5", | ||
] | ||
|
||
privileged = true | ||
} | ||
|
||
csi_plugin { | ||
id = "aws-ebs0" | ||
type = "node" | ||
mount_dir = "/csi" | ||
} | ||
|
||
resources { | ||
cpu = 100 | ||
memory = 256 | ||
} | ||
} | ||
} | ||
} |
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,75 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: BUSL-1.1 | ||
|
||
variable "alloc_count" { | ||
type = number | ||
default = 1 | ||
} | ||
|
||
# a job that mounts an EBS volume and writes its job ID as a file | ||
job "wants-ebs-volume" { | ||
|
||
constraint { | ||
attribute = "${attr.kernel.name}" | ||
value = "linux" | ||
} | ||
|
||
group "group" { | ||
count = var.alloc_count | ||
|
||
volume "test" { | ||
type = "csi" | ||
source = "ebsTestVolume" | ||
attachment_mode = "file-system" | ||
access_mode = "single-node-writer" | ||
} | ||
|
||
task "task" { | ||
driver = "docker" | ||
|
||
config { | ||
image = "busybox:1" | ||
command = "httpd" | ||
args = ["-vv", "-f", "-p", "8001", "-h", "/local"] | ||
} | ||
|
||
volume_mount { | ||
volume = "test" | ||
destination = "${NOMAD_TASK_DIR}/test" | ||
read_only = false | ||
} | ||
|
||
resources { | ||
cpu = 100 | ||
memory = 64 | ||
} | ||
} | ||
|
||
task "sidecar" { | ||
driver = "docker" | ||
|
||
config { | ||
image = "busybox:1" | ||
command = "/bin/sh" | ||
args = ["-c", "echo '${NOMAD_ALLOC_ID}' > ${NOMAD_TASK_DIR}/index.html"] | ||
} | ||
|
||
lifecycle { | ||
hook = "poststart" | ||
sidecar = false | ||
} | ||
|
||
volume_mount { | ||
volume = "test" | ||
destination = "${NOMAD_TASK_DIR}/test" | ||
read_only = false | ||
} | ||
|
||
resources { | ||
cpu = 10 | ||
memory = 10 | ||
} | ||
|
||
} | ||
} | ||
} |
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,13 @@ | ||
# Copyright (c) HashiCorp, Inc. | ||
# SPDX-License-Identifier: BUSL-1.1 | ||
|
||
type = "csi" | ||
id = "ebsTestVolume" | ||
name = "IDEMPOTENCY_TOKEN" | ||
external_id = "EXTERNAL_ID" | ||
plugin_id = "aws-ebs0" | ||
|
||
capability { | ||
access_mode = "single-node-writer" | ||
attachment_mode = "file-system" | ||
} |
Oops, something went wrong.