From 0b0dd6f97b3f800c29f669a5d60f50eefd8d3c70 Mon Sep 17 00:00:00 2001 From: Juanadelacuesta <8647634+Juanadelacuesta@users.noreply.github.com> Date: Mon, 2 Dec 2024 16:22:22 -0500 Subject: [PATCH 01/15] func: add first module to look for binary --- enos/enos-modules.hcl | 8 ++ enos/enos-quality-upgrade.hcl | 40 ++++++ enos/enos-scenario-upgrade.hcl | 124 ++++++++++++++++++ enos/modules/fetch_artifactory/locals.tf | 30 +++++ enos/modules/fetch_artifactory/main.tf | 33 +++++ enos/modules/fetch_artifactory/outputs.tf | 31 +++++ .../fetch_artifactory/scripts/install.sh | 3 + enos/modules/fetch_artifactory/variables.tf | 59 +++++++++ 8 files changed, 328 insertions(+) create mode 100644 enos/enos-modules.hcl create mode 100644 enos/enos-quality-upgrade.hcl create mode 100644 enos/enos-scenario-upgrade.hcl create mode 100644 enos/modules/fetch_artifactory/locals.tf create mode 100644 enos/modules/fetch_artifactory/main.tf create mode 100644 enos/modules/fetch_artifactory/outputs.tf create mode 100644 enos/modules/fetch_artifactory/scripts/install.sh create mode 100644 enos/modules/fetch_artifactory/variables.tf diff --git a/enos/enos-modules.hcl b/enos/enos-modules.hcl new file mode 100644 index 00000000000..4f3f5de3844 --- /dev/null +++ b/enos/enos-modules.hcl @@ -0,0 +1,8 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: BUSL-1.1 + +// Find any released RPM or Deb in Artifactory. Requires the version, edition, distro, and distro +// version. +module "build_artifactory" { + source = "./modules/fetch_artifactory" +} diff --git a/enos/enos-quality-upgrade.hcl b/enos/enos-quality-upgrade.hcl new file mode 100644 index 00000000000..565aadc9fa2 --- /dev/null +++ b/enos/enos-quality-upgrade.hcl @@ -0,0 +1,40 @@ +quality "nomad_agent_info" { + description = "A GET call to /v1/agent/members returns the correct number of + running servers and they are all alive" +} + +quality "nomad_agent_info_self" { + description = "A GET call to /v1/agent/self against every server returns the + same last_log_index for all of them." +} + +quality "nomad_nodes_status" { + description = "A GET call to /v1/nodes returns the correct number of clients + and they are all `eligible` and `ready`". +} + +quality "nomad_job_status" { + description = "A GET call to /v1/jobs returns the correct number of jobs and + they are all `running`". +} + +quality "nomad_register_job" { + description = "A POST call to /v1/jobs results in a new job running and + allocations being started accordingly." +} + +quality "nomad_reschedule_alloc" { + description = "A POST / PUT call to /v1/allocation/:alloc_id/stop results in + the stopped allocation being rescheduled" +} + + +quality "nomad_restore_snapshot" { + description = "A node can be restored from a snapshot built on a previous + version" +} + +quality "nomad_allocs_status" { + description = "A GET call to /v1/allocs returns the correct number of + allocations and they are all `running`". +} diff --git a/enos/enos-scenario-upgrade.hcl b/enos/enos-scenario-upgrade.hcl new file mode 100644 index 00000000000..f93a5e0b189 --- /dev/null +++ b/enos/enos-scenario-upgrade.hcl @@ -0,0 +1,124 @@ +scenario "upgrade" { + description = <<-EOF + The upgrade scenario verifies in-place upgrades between previously released versions of Nomad + against another candidate build. + EOF + + matrix { + arch = ["amd64", "arm64"] + //service_discovery = ["consul", "nomad"] + distro = ["alpine", "fedora", "rhel","ubuntu"] + editions = ["ce", "ent"] + os = ["linux", "darwin", "windows"] + } + + step "copy_binary" { + description = <<-EOF + Determine which Nomad artifact we want to use for the scenario, depending on the + 'arch', 'distro' and 'os' + EOF + module = module.build_artifactory + + variables { + version = global.initial_version + artifactory_path = globals.artifact_path + artifact_token = globals.artifact_token + os = matrix.os + distro = matrix.os != "linux" ? var.distro : null + local_path = var.binary_local_path + } + } +/* + step "provision_cluster" { + description = <<-EOF + Using the binary from the previous step, provision a Nomad cluster using the e2e + EOF + module = "build_${matrix.os}_${matrix.distro}" + + variables { + name + nomad_local_binary = step.copy_binary.nomad_local_binary + nomad_license = global.nomad_license_path + server_count = var.server_count + client_count_ubuntu_jammy_amd64 = matrix.distro != "ubuntu" ? var.client_count_ubuntu_jammy_amd64 : 0 + // ... + } + } + + step "run_new_workloads" { + description = <<-EOF + Verify the health of the cluster by running new workloads and stopping random allocs + EOF + + module = module.run_workloads + + verifies = [ + quality.nomad_register_job, + quality.nomad_stop_alloc + ] + } + + step "copy_upgraded_binary" { + description = <<-EOF + Copy the binary of the newer version ... + EOF + + module = "copy_${matrix.artifact_source}" + + variables { + version = global.upgrade_version + artifactory_path = globals.artifact_path + artifact_token = globals.artifact_toke. + os = step.copy_binary.os + distro = step.copy_binary.distro + // ... + } + } + + step "upgrade_servers" { + description = <<-EOF + Upgrade the cluster's servers by invoking nomad-cc ... + EOF + + module = module.run_cc_nomad + + verifies = [ + quality.nomad_agent_info, + quality.nomad_agent_info_self, + nomad_restore_snapshot + ] + + variables { + cc_update_type = "server" + nomad_upgraded_binary = step.copy_binary.nomad_local_binary + // ... + } + } + + step "run_new_workloads" { + // ... + } + + step "upgrade_client" { + description = <<-EOF + Upgrade the cluster's clients by invoking nomad-cc ... + EOF + + module = module.run_cc_nomad + + verifies = [ + quality.nomad_nodes_status, + quality.nomad_job_status + ] + + variables { + cc_update_type = "client" + nomad_upgraded_binary = step.copy_binary.nomad_local_binary + // ... + } + } + + step "run_new_workloads" { + // ... + } */ +} diff --git a/enos/modules/fetch_artifactory/locals.tf b/enos/modules/fetch_artifactory/locals.tf new file mode 100644 index 00000000000..2d3d5b5cfa1 --- /dev/null +++ b/enos/modules/fetch_artifactory/locals.tf @@ -0,0 +1,30 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: BUSL-1.1 + +locals { + + // file name extensions for the install packages of Nomad for the various + // architectures, distributions and editions + package_extensions = { + amd64 = { + linux = "_linux_amd64.zip" + windows = "_windows_amd64.zip" + } + + arm64 = { + linux = "_linux_arm64.zip" + } + } + + // product_version --> artifact_version + artifact_version = replace(var.product_version, var.edition, "ent") + + # Prefix for the artifact name. Ex: nomad_ and nomad-enterprise_ + artifact_name_prefix = var.artifact_type == "package" ? local.artifact_package_release_names[var.distro][var.edition] : "nomad_" + + # Suffix and extension for the artifact name. Ex: _linux_.zip, + artifact_name_extension = var.artifact_type == "package" ? local.package_extensions[var.arch][var.distro] : "_linux_${var.arch}.zip" + + # Combine prefix/suffix/extension together to form the artifact name + artifact_name = var.artifact_type == "package" ? "${local.artifact_name_prefix}${replace(local.artifact_version, "-", "~")}${local.artifact_name_extension}" : "${local.artifact_name_prefix}${var.product_version}${local.artifact_name_extension}" +} \ No newline at end of file diff --git a/enos/modules/fetch_artifactory/main.tf b/enos/modules/fetch_artifactory/main.tf new file mode 100644 index 00000000000..2d3b6f6ca94 --- /dev/null +++ b/enos/modules/fetch_artifactory/main.tf @@ -0,0 +1,33 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: BUSL-1.1 + +terraform { + required_providers { + enos = { + source = "registry.terraform.io/hashicorp-forge/enos" + version = ">= 0.2.3" + } + } +} + +data "enos_artifactory_item" "nomad" { + username = var.artifactory_username + token = var.artifactory_token + host = var.artifactory_host + repo = var.artifactory_repo + path = var.edition == "ce" ? "nomad/*" : "nomad-enterprise/*" + name = local.artifact_name + properties = tomap({ + "commit" = var.revision + "product-name" = var.edition == "ce" ? "nomad" : "nomad-enterprise" +// "product-version" = local.artifact_version + }) +} + +resource "enos_local_exec" "install_binary" { + environment = { + URL = each.value.stdout + } + + scripts = [abspath("${path.module}/scripts/install.sh")] +} \ No newline at end of file diff --git a/enos/modules/fetch_artifactory/outputs.tf b/enos/modules/fetch_artifactory/outputs.tf new file mode 100644 index 00000000000..57643be1fc8 --- /dev/null +++ b/enos/modules/fetch_artifactory/outputs.tf @@ -0,0 +1,31 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: BUSL-1.1 + +output "url" { + value = data.enos_artifactory_item.nomad.results[0].url + description = "The artifactory download url for the artifact" +} + +output "sha256" { + value = data.enos_artifactory_item.nomad.results[0].sha256 + description = "The sha256 checksum for the artifact" +} + +output "size" { + value = data.enos_artifactory_item.nomad.results[0].size + description = "The size in bytes of the artifact" +} + +output "name" { + value = data.enos_artifactory_item.nomad.results[0].name + description = "The name of the artifact" +} + +output "vault_artifactory_release" { + value = { + url = data.enos_artifactory_item.nomad.results[0].url + sha256 = data.enos_artifactory_item.nomad.results[0].sha256 + username = var.artifactory_username + token = var.artifactory_token + } +} \ No newline at end of file diff --git a/enos/modules/fetch_artifactory/scripts/install.sh b/enos/modules/fetch_artifactory/scripts/install.sh new file mode 100644 index 00000000000..bf22c0d6bbb --- /dev/null +++ b/enos/modules/fetch_artifactory/scripts/install.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: BUSL-1.1 diff --git a/enos/modules/fetch_artifactory/variables.tf b/enos/modules/fetch_artifactory/variables.tf new file mode 100644 index 00000000000..5ce5a78caea --- /dev/null +++ b/enos/modules/fetch_artifactory/variables.tf @@ -0,0 +1,59 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: BUSL-1.1 + +variable "artifactory_username" { + type = string + description = "The username to use when connecting to artifactory" + default = null +} + +variable "artifactory_token" { + type = string + description = "The token to use when connecting to artifactory" + default = null + sensitive = true +} + +variable "artifactory_host" { + type = string + description = "The artifactory host to search for Nomad artifacts" + default = "https://artifactory.hashicorp.engineering/artifactory" +} + +variable "artifactory_repo" { + type = string + description = "The artifactory repo to search for Nomad artifacts" + default = "hashicorp-crt-stable-local*" +} + +variable "edition" { + type = string + description = "The edition of the binary to search, it can be either CE or ENT" +} + +variable "revision" { + type = string + description = "The specific commit of the binary" +} + +variable "os" { + type = string + description = "The operative system the binary is needed for" + default = "linux" +} + +variable "product_version" { + description = "The version of Nomad we are testing" + type = string + default = null +} + +variable "artifact_path" { + description = "The artifactory path to search for Nomad artifacts" + type = string +} + +variable "arch" { + description = "The artifactory path to search for Nomad artifacts" + type = string +} From cf0faa76b1a9d7a6f682880880e743c8e32e5259 Mon Sep 17 00:00:00 2001 From: Juanadelacuesta <8647634+Juanadelacuesta@users.noreply.github.com> Date: Mon, 2 Dec 2024 16:22:22 -0500 Subject: [PATCH 02/15] func: add first module to look for binary --- enos/modules/fetch_artifactory/terraform.tfvars | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 enos/modules/fetch_artifactory/terraform.tfvars diff --git a/enos/modules/fetch_artifactory/terraform.tfvars b/enos/modules/fetch_artifactory/terraform.tfvars new file mode 100644 index 00000000000..e4032e74183 --- /dev/null +++ b/enos/modules/fetch_artifactory/terraform.tfvars @@ -0,0 +1,10 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: BUSL-1.1 + +artifactory_username = "" +artifactory_token = "" +arch = "amd64" +edition = "ce" +revision = "40314d9dacb8cc0db03529c758a4cbc86d38d689" +product_version = "1.9.3" +os = "linux" From 401edd2dd8ba38699dc73d020fff55dbb5a06f4d Mon Sep 17 00:00:00 2001 From: Juanadelacuesta <8647634+Juanadelacuesta@users.noreply.github.com> Date: Tue, 3 Dec 2024 16:28:44 +0100 Subject: [PATCH 03/15] func: add script to install binary locally --- enos/enos-vars.hcl | 2 ++ enos/modules/fetch_artifactory/locals.tf | 20 ++++--------- enos/modules/fetch_artifactory/main.tf | 10 +++---- enos/modules/fetch_artifactory/outputs.tf | 24 +++------------ .../fetch_artifactory/scripts/install.sh | 29 +++++++++++++++++++ .../fetch_artifactory/terraform.tfvars | 10 ------- enos/modules/fetch_artifactory/variables.tf | 7 +++-- 7 files changed, 50 insertions(+), 52 deletions(-) create mode 100644 enos/enos-vars.hcl mode change 100644 => 100755 enos/modules/fetch_artifactory/scripts/install.sh delete mode 100644 enos/modules/fetch_artifactory/terraform.tfvars diff --git a/enos/enos-vars.hcl b/enos/enos-vars.hcl new file mode 100644 index 00000000000..6ed72435eb7 --- /dev/null +++ b/enos/enos-vars.hcl @@ -0,0 +1,2 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: BUSL-1.1 \ No newline at end of file diff --git a/enos/modules/fetch_artifactory/locals.tf b/enos/modules/fetch_artifactory/locals.tf index 2d3d5b5cfa1..ffa575bacac 100644 --- a/enos/modules/fetch_artifactory/locals.tf +++ b/enos/modules/fetch_artifactory/locals.tf @@ -3,8 +3,10 @@ locals { - // file name extensions for the install packages of Nomad for the various - // architectures, distributions and editions + path = var.edition == "ce" ? "nomad/*" : "nomad-enterprise/*" + + artifact_version = var.edition == "ce" ? "${var.product_version}" : "${var.product_version}+ent" + package_extensions = { amd64 = { linux = "_linux_amd64.zip" @@ -14,17 +16,7 @@ locals { arm64 = { linux = "_linux_arm64.zip" } - } - - // product_version --> artifact_version - artifact_version = replace(var.product_version, var.edition, "ent") + } - # Prefix for the artifact name. Ex: nomad_ and nomad-enterprise_ - artifact_name_prefix = var.artifact_type == "package" ? local.artifact_package_release_names[var.distro][var.edition] : "nomad_" - - # Suffix and extension for the artifact name. Ex: _linux_.zip, - artifact_name_extension = var.artifact_type == "package" ? local.package_extensions[var.arch][var.distro] : "_linux_${var.arch}.zip" - - # Combine prefix/suffix/extension together to form the artifact name - artifact_name = var.artifact_type == "package" ? "${local.artifact_name_prefix}${replace(local.artifact_version, "-", "~")}${local.artifact_name_extension}" : "${local.artifact_name_prefix}${var.product_version}${local.artifact_name_extension}" + artifact_name = "nomad_${local.artifact_version}${local.package_extensions[var.arch][var.os]}" } \ No newline at end of file diff --git a/enos/modules/fetch_artifactory/main.tf b/enos/modules/fetch_artifactory/main.tf index 2d3b6f6ca94..b559ea981c5 100644 --- a/enos/modules/fetch_artifactory/main.tf +++ b/enos/modules/fetch_artifactory/main.tf @@ -5,7 +5,6 @@ terraform { required_providers { enos = { source = "registry.terraform.io/hashicorp-forge/enos" - version = ">= 0.2.3" } } } @@ -15,19 +14,20 @@ data "enos_artifactory_item" "nomad" { token = var.artifactory_token host = var.artifactory_host repo = var.artifactory_repo - path = var.edition == "ce" ? "nomad/*" : "nomad-enterprise/*" + path = local.path name = local.artifact_name properties = tomap({ "commit" = var.revision "product-name" = var.edition == "ce" ? "nomad" : "nomad-enterprise" -// "product-version" = local.artifact_version }) } resource "enos_local_exec" "install_binary" { environment = { - URL = each.value.stdout + URL = data.enos_artifactory_item.nomad.results[0].url + BINARY_PATH = var.binary_path + TOKEN = var.artifactory_token } scripts = [abspath("${path.module}/scripts/install.sh")] -} \ No newline at end of file +} \ No newline at end of file diff --git a/enos/modules/fetch_artifactory/outputs.tf b/enos/modules/fetch_artifactory/outputs.tf index 57643be1fc8..e29c16200fd 100644 --- a/enos/modules/fetch_artifactory/outputs.tf +++ b/enos/modules/fetch_artifactory/outputs.tf @@ -1,31 +1,15 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -output "url" { - value = data.enos_artifactory_item.nomad.results[0].url - description = "The artifactory download url for the artifact" -} - -output "sha256" { - value = data.enos_artifactory_item.nomad.results[0].sha256 - description = "The sha256 checksum for the artifact" -} - -output "size" { - value = data.enos_artifactory_item.nomad.results[0].size - description = "The size in bytes of the artifact" -} - -output "name" { - value = data.enos_artifactory_item.nomad.results[0].name - description = "The name of the artifact" +output "local_binary" { + value = var.binary_path + description = "Path where the binary will be placed" } output "vault_artifactory_release" { + description = "Binary information returned from the artifactory" value = { url = data.enos_artifactory_item.nomad.results[0].url sha256 = data.enos_artifactory_item.nomad.results[0].sha256 - username = var.artifactory_username - token = var.artifactory_token } } \ No newline at end of file diff --git a/enos/modules/fetch_artifactory/scripts/install.sh b/enos/modules/fetch_artifactory/scripts/install.sh old mode 100644 new mode 100755 index bf22c0d6bbb..b7d692faed0 --- a/enos/modules/fetch_artifactory/scripts/install.sh +++ b/enos/modules/fetch_artifactory/scripts/install.sh @@ -1,3 +1,32 @@ #!/usr/bin/env bash # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 + +set -xeuo pipefail + +# Variables +OUTPUT="nomad.zip" # Name for the downloaded file + +# Download the file +wget --header="X-JFrog-Art-Api:$TOKEN" -O- "$OUTPUT" "$URL" + +# Check if the file was downloaded +if [ $? -nq 0 ]; then + echo "Error downloading file." >&2 + exit 1 +fi + +# Create the BINARY_PATH directory +mkdir -p "$BINARY_PATH" + +# Unzip the file +unzip -o "$OUTPUT" -d "$BINARY_PATH" + +# Check if the file was unzipped +if [ $? -nq 0 ]; then + echo "Error unzipping file." >&2 + exit 1 +fi + +# Remove the zip file +rm $OUTPUT \ No newline at end of file diff --git a/enos/modules/fetch_artifactory/terraform.tfvars b/enos/modules/fetch_artifactory/terraform.tfvars deleted file mode 100644 index e4032e74183..00000000000 --- a/enos/modules/fetch_artifactory/terraform.tfvars +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright (c) HashiCorp, Inc. -# SPDX-License-Identifier: BUSL-1.1 - -artifactory_username = "" -artifactory_token = "" -arch = "amd64" -edition = "ce" -revision = "40314d9dacb8cc0db03529c758a4cbc86d38d689" -product_version = "1.9.3" -os = "linux" diff --git a/enos/modules/fetch_artifactory/variables.tf b/enos/modules/fetch_artifactory/variables.tf index 5ce5a78caea..b8e3c815d1c 100644 --- a/enos/modules/fetch_artifactory/variables.tf +++ b/enos/modules/fetch_artifactory/variables.tf @@ -48,12 +48,13 @@ variable "product_version" { default = null } -variable "artifact_path" { +variable "arch" { description = "The artifactory path to search for Nomad artifacts" type = string } -variable "arch" { - description = "The artifactory path to search for Nomad artifacts" +variable "binary_path" { + description = "The path to donwload and unzip the binary" type = string + default = "/home/ubuntu/nomad" } From 4d390665bbbd42c286cbd642ebb85cedc3f48e19 Mon Sep 17 00:00:00 2001 From: Juanadelacuesta <8647634+Juanadelacuesta@users.noreply.github.com> Date: Tue, 3 Dec 2024 16:33:10 +0100 Subject: [PATCH 04/15] style: add license headers --- enos/enos-quality-upgrade.hcl | 3 +++ enos/enos-scenario-upgrade.hcl | 3 +++ 2 files changed, 6 insertions(+) diff --git a/enos/enos-quality-upgrade.hcl b/enos/enos-quality-upgrade.hcl index 565aadc9fa2..01ab700d921 100644 --- a/enos/enos-quality-upgrade.hcl +++ b/enos/enos-quality-upgrade.hcl @@ -1,3 +1,6 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: BUSL-1.1 + quality "nomad_agent_info" { description = "A GET call to /v1/agent/members returns the correct number of running servers and they are all alive" diff --git a/enos/enos-scenario-upgrade.hcl b/enos/enos-scenario-upgrade.hcl index f93a5e0b189..ed60d1027a8 100644 --- a/enos/enos-scenario-upgrade.hcl +++ b/enos/enos-scenario-upgrade.hcl @@ -1,3 +1,6 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: BUSL-1.1 + scenario "upgrade" { description = <<-EOF The upgrade scenario verifies in-place upgrades between previously released versions of Nomad From 3eaee9e8943f6827036d9c72099f072eee31aada Mon Sep 17 00:00:00 2001 From: Juanadelacuesta <8647634+Juanadelacuesta@users.noreply.github.com> Date: Tue, 3 Dec 2024 16:54:45 +0100 Subject: [PATCH 05/15] style: format hcl files --- enos/enos-quality-upgrade.hcl | 16 ++++++------ enos/enos-scenario-upgrade.hcl | 28 ++++++++++----------- enos/modules/fetch_artifactory/locals.tf | 4 +-- enos/modules/fetch_artifactory/main.tf | 18 ++++++------- enos/modules/fetch_artifactory/outputs.tf | 4 +-- enos/modules/fetch_artifactory/variables.tf | 4 +-- 6 files changed, 37 insertions(+), 37 deletions(-) diff --git a/enos/enos-quality-upgrade.hcl b/enos/enos-quality-upgrade.hcl index 01ab700d921..050d9e27eec 100644 --- a/enos/enos-quality-upgrade.hcl +++ b/enos/enos-quality-upgrade.hcl @@ -2,42 +2,42 @@ # SPDX-License-Identifier: BUSL-1.1 quality "nomad_agent_info" { - description = "A GET call to /v1/agent/members returns the correct number of + description = "A GET call to /v1/agent/members returns the correct number of running servers and they are all alive" } quality "nomad_agent_info_self" { - description = "A GET call to /v1/agent/self against every server returns the + description = "A GET call to /v1/agent/self against every server returns the same last_log_index for all of them." } quality "nomad_nodes_status" { - description = "A GET call to /v1/nodes returns the correct number of clients + description = "A GET call to /v1/nodes returns the correct number of clients and they are all `eligible` and `ready`". } quality "nomad_job_status" { - description = "A GET call to /v1/jobs returns the correct number of jobs and + description = "A GET call to /v1/jobs returns the correct number of jobs and they are all `running`". } quality "nomad_register_job" { - description = "A POST call to /v1/jobs results in a new job running and + description = "A POST call to /v1/jobs results in a new job running and allocations being started accordingly." } quality "nomad_reschedule_alloc" { - description = "A POST / PUT call to /v1/allocation/:alloc_id/stop results in + description = "A POST / PUT call to /v1/allocation/:alloc_id/stop results in the stopped allocation being rescheduled" } quality "nomad_restore_snapshot" { - description = "A node can be restored from a snapshot built on a previous + description = "A node can be restored from a snapshot built on a previous version" } quality "nomad_allocs_status" { - description = "A GET call to /v1/allocs returns the correct number of + description = "A GET call to /v1/allocs returns the correct number of allocations and they are all `running`". } diff --git a/enos/enos-scenario-upgrade.hcl b/enos/enos-scenario-upgrade.hcl index ed60d1027a8..e127ccd8347 100644 --- a/enos/enos-scenario-upgrade.hcl +++ b/enos/enos-scenario-upgrade.hcl @@ -2,17 +2,17 @@ # SPDX-License-Identifier: BUSL-1.1 scenario "upgrade" { - description = <<-EOF + description = <<-EOF The upgrade scenario verifies in-place upgrades between previously released versions of Nomad against another candidate build. EOF - matrix { - arch = ["amd64", "arm64"] - //service_discovery = ["consul", "nomad"] - distro = ["alpine", "fedora", "rhel","ubuntu"] - editions = ["ce", "ent"] - os = ["linux", "darwin", "windows"] + matrix { + arch = ["amd64", "arm64"] + //service_discovery = ["consul", "nomad"] + distro = ["alpine", "fedora", "rhel", "ubuntu"] + editions = ["ce", "ent"] + os = ["linux", "darwin", "windows"] } step "copy_binary" { @@ -23,15 +23,15 @@ scenario "upgrade" { module = module.build_artifactory variables { - version = global.initial_version - artifactory_path = globals.artifact_path - artifact_token = globals.artifact_token - os = matrix.os - distro = matrix.os != "linux" ? var.distro : null - local_path = var.binary_local_path + version = global.initial_version + artifactory_path = globals.artifact_path + artifact_token = globals.artifact_token + os = matrix.os + distro = matrix.os != "linux" ? var.distro : null + local_path = var.binary_local_path } } -/* + /* step "provision_cluster" { description = <<-EOF Using the binary from the previous step, provision a Nomad cluster using the e2e diff --git a/enos/modules/fetch_artifactory/locals.tf b/enos/modules/fetch_artifactory/locals.tf index ffa575bacac..7f4b7492fc0 100644 --- a/enos/modules/fetch_artifactory/locals.tf +++ b/enos/modules/fetch_artifactory/locals.tf @@ -14,9 +14,9 @@ locals { } arm64 = { - linux = "_linux_arm64.zip" + linux = "_linux_arm64.zip" } - } + } artifact_name = "nomad_${local.artifact_version}${local.package_extensions[var.arch][var.os]}" } \ No newline at end of file diff --git a/enos/modules/fetch_artifactory/main.tf b/enos/modules/fetch_artifactory/main.tf index b559ea981c5..c9c9be8a26f 100644 --- a/enos/modules/fetch_artifactory/main.tf +++ b/enos/modules/fetch_artifactory/main.tf @@ -4,7 +4,7 @@ terraform { required_providers { enos = { - source = "registry.terraform.io/hashicorp-forge/enos" + source = "registry.terraform.io/hashicorp-forge/enos" } } } @@ -17,17 +17,17 @@ data "enos_artifactory_item" "nomad" { path = local.path name = local.artifact_name properties = tomap({ - "commit" = var.revision - "product-name" = var.edition == "ce" ? "nomad" : "nomad-enterprise" + "commit" = var.revision + "product-name" = var.edition == "ce" ? "nomad" : "nomad-enterprise" }) } resource "enos_local_exec" "install_binary" { - environment = { - URL = data.enos_artifactory_item.nomad.results[0].url - BINARY_PATH = var.binary_path - TOKEN = var.artifactory_token - } + environment = { + URL = data.enos_artifactory_item.nomad.results[0].url + BINARY_PATH = var.binary_path + TOKEN = var.artifactory_token + } - scripts = [abspath("${path.module}/scripts/install.sh")] + scripts = [abspath("${path.module}/scripts/install.sh")] } \ No newline at end of file diff --git a/enos/modules/fetch_artifactory/outputs.tf b/enos/modules/fetch_artifactory/outputs.tf index e29c16200fd..e335d514d3a 100644 --- a/enos/modules/fetch_artifactory/outputs.tf +++ b/enos/modules/fetch_artifactory/outputs.tf @@ -9,7 +9,7 @@ output "local_binary" { output "vault_artifactory_release" { description = "Binary information returned from the artifactory" value = { - url = data.enos_artifactory_item.nomad.results[0].url - sha256 = data.enos_artifactory_item.nomad.results[0].sha256 + url = data.enos_artifactory_item.nomad.results[0].url + sha256 = data.enos_artifactory_item.nomad.results[0].sha256 } } \ No newline at end of file diff --git a/enos/modules/fetch_artifactory/variables.tf b/enos/modules/fetch_artifactory/variables.tf index b8e3c815d1c..b5c7c96596d 100644 --- a/enos/modules/fetch_artifactory/variables.tf +++ b/enos/modules/fetch_artifactory/variables.tf @@ -39,7 +39,7 @@ variable "revision" { variable "os" { type = string description = "The operative system the binary is needed for" - default = "linux" + default = "linux" } variable "product_version" { @@ -56,5 +56,5 @@ variable "arch" { variable "binary_path" { description = "The path to donwload and unzip the binary" type = string - default = "/home/ubuntu/nomad" + default = "/home/ubuntu/nomad" } From 34aa7914a9d6b6d247d9e929052c28f8ce1caa26 Mon Sep 17 00:00:00 2001 From: Juanadelacuesta <8647634+Juanadelacuesta@users.noreply.github.com> Date: Tue, 3 Dec 2024 17:22:10 +0100 Subject: [PATCH 06/15] func: add providers to enos --- enos/enos-terraform.hcl | 10 +++ enos/enos-vars.hcl | 61 ++++++++++++++++++- enos/modules/fetch_artifactory/main.tf | 3 +- .../fetch_artifactory/scripts/install.sh | 19 +++--- 4 files changed, 81 insertions(+), 12 deletions(-) create mode 100644 enos/enos-terraform.hcl diff --git a/enos/enos-terraform.hcl b/enos/enos-terraform.hcl new file mode 100644 index 00000000000..873646e0eb9 --- /dev/null +++ b/enos/enos-terraform.hcl @@ -0,0 +1,10 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: BUSL-1.1 + +terraform { + required_providers { + enos = { + source = "registry.terraform.io/hashicorp-forge/enos" + } + } +} \ No newline at end of file diff --git a/enos/enos-vars.hcl b/enos/enos-vars.hcl index 6ed72435eb7..b018229acc9 100644 --- a/enos/enos-vars.hcl +++ b/enos/enos-vars.hcl @@ -1,2 +1,61 @@ # Copyright (c) HashiCorp, Inc. -# SPDX-License-Identifier: BUSL-1.1 \ No newline at end of file +# SPDX-License-Identifier: BUSL-1.1 + +# Variables for the fetch_artifactory module +variable "artifactory_username" { + type = string + description = "The username to use when connecting to artifactory" + default = null +} + +variable "artifactory_token" { + type = string + description = "The token to use when connecting to artifactory" + default = null + sensitive = true +} + +variable "artifactory_host" { + type = string + description = "The artifactory host to search for Nomad artifacts" + default = "https://artifactory.hashicorp.engineering/artifactory" +} + +variable "artifactory_repo" { + type = string + description = "The artifactory repo to search for Nomad artifacts" + default = "hashicorp-crt-stable-local*" +} + +variable "edition" { + type = string + description = "The edition of the binary to search, it can be either CE or ENT" +} + +variable "revision" { + type = string + description = "The specific commit of the binary" +} + +variable "os" { + type = string + description = "The operative system the binary is needed for" + default = "linux" +} + +variable "product_version" { + description = "The version of Nomad we are testing" + type = string + default = null +} + +variable "arch" { + description = "The artifactory path to search for Nomad artifacts" + type = string +} + +variable "binary_path" { + description = "The path to donwload and unzip the binary" + type = string + default = "/home/ubuntu/nomad" +} diff --git a/enos/modules/fetch_artifactory/main.tf b/enos/modules/fetch_artifactory/main.tf index c9c9be8a26f..e380b07401c 100644 --- a/enos/modules/fetch_artifactory/main.tf +++ b/enos/modules/fetch_artifactory/main.tf @@ -17,7 +17,6 @@ data "enos_artifactory_item" "nomad" { path = local.path name = local.artifact_name properties = tomap({ - "commit" = var.revision "product-name" = var.edition == "ce" ? "nomad" : "nomad-enterprise" }) } @@ -30,4 +29,4 @@ resource "enos_local_exec" "install_binary" { } scripts = [abspath("${path.module}/scripts/install.sh")] -} \ No newline at end of file +} \ No newline at end of file diff --git a/enos/modules/fetch_artifactory/scripts/install.sh b/enos/modules/fetch_artifactory/scripts/install.sh index b7d692faed0..9aed88ed48f 100755 --- a/enos/modules/fetch_artifactory/scripts/install.sh +++ b/enos/modules/fetch_artifactory/scripts/install.sh @@ -5,13 +5,15 @@ set -xeuo pipefail # Variables -OUTPUT="nomad.zip" # Name for the downloaded file +LOCAL_ZIP="nomad.zip" # Name for the downloaded file # Download the file -wget --header="X-JFrog-Art-Api:$TOKEN" -O- "$OUTPUT" "$URL" +wget --header="X-JFrog-Art-Api:$TOKEN" -O- "$LOCAL_ZIP" "$URL" # Check if the file was downloaded -if [ $? -nq 0 ]; then +if [ $? -eq 0 ]; then + echo "File downloaded successfully: $LOCAL_ZIP" +else echo "Error downloading file." >&2 exit 1 fi @@ -20,13 +22,12 @@ fi mkdir -p "$BINARY_PATH" # Unzip the file -unzip -o "$OUTPUT" -d "$BINARY_PATH" +unzip -o "$LOCAL_ZIP" -d "$BINARY_PATH" # Check if the file was unzipped -if [ $? -nq 0 ]; then +if [ $? -eq 0 ]; then + echo "File unzipped successfully to $BINARY_PATH" +else echo "Error unzipping file." >&2 exit 1 -fi - -# Remove the zip file -rm $OUTPUT \ No newline at end of file +fi \ No newline at end of file From 441310264f4d8ac8975ae2fb01460dddb7926b30 Mon Sep 17 00:00:00 2001 From: Juanadelacuesta <8647634+Juanadelacuesta@users.noreply.github.com> Date: Tue, 3 Dec 2024 17:52:19 +0100 Subject: [PATCH 07/15] func: remove zip file --- enos/enos-quality.hcl | 43 +++++++++++++++++++ enos/modules/fetch_artifactory/main.tf | 2 +- .../fetch_artifactory/scripts/install.sh | 11 +++-- enos/modules/fetch_artifactory/variables.tf | 5 --- 4 files changed, 51 insertions(+), 10 deletions(-) create mode 100644 enos/enos-quality.hcl diff --git a/enos/enos-quality.hcl b/enos/enos-quality.hcl new file mode 100644 index 00000000000..050d9e27eec --- /dev/null +++ b/enos/enos-quality.hcl @@ -0,0 +1,43 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: BUSL-1.1 + +quality "nomad_agent_info" { + description = "A GET call to /v1/agent/members returns the correct number of + running servers and they are all alive" +} + +quality "nomad_agent_info_self" { + description = "A GET call to /v1/agent/self against every server returns the + same last_log_index for all of them." +} + +quality "nomad_nodes_status" { + description = "A GET call to /v1/nodes returns the correct number of clients + and they are all `eligible` and `ready`". +} + +quality "nomad_job_status" { + description = "A GET call to /v1/jobs returns the correct number of jobs and + they are all `running`". +} + +quality "nomad_register_job" { + description = "A POST call to /v1/jobs results in a new job running and + allocations being started accordingly." +} + +quality "nomad_reschedule_alloc" { + description = "A POST / PUT call to /v1/allocation/:alloc_id/stop results in + the stopped allocation being rescheduled" +} + + +quality "nomad_restore_snapshot" { + description = "A node can be restored from a snapshot built on a previous + version" +} + +quality "nomad_allocs_status" { + description = "A GET call to /v1/allocs returns the correct number of + allocations and they are all `running`". +} diff --git a/enos/modules/fetch_artifactory/main.tf b/enos/modules/fetch_artifactory/main.tf index e380b07401c..b413f6b238b 100644 --- a/enos/modules/fetch_artifactory/main.tf +++ b/enos/modules/fetch_artifactory/main.tf @@ -29,4 +29,4 @@ resource "enos_local_exec" "install_binary" { } scripts = [abspath("${path.module}/scripts/install.sh")] -} \ No newline at end of file +} \ No newline at end of file diff --git a/enos/modules/fetch_artifactory/scripts/install.sh b/enos/modules/fetch_artifactory/scripts/install.sh index 9aed88ed48f..a7f9c24ae14 100755 --- a/enos/modules/fetch_artifactory/scripts/install.sh +++ b/enos/modules/fetch_artifactory/scripts/install.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/bin/bash # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 @@ -8,9 +8,9 @@ set -xeuo pipefail LOCAL_ZIP="nomad.zip" # Name for the downloaded file # Download the file -wget --header="X-JFrog-Art-Api:$TOKEN" -O- "$LOCAL_ZIP" "$URL" +wget --header="X-JFrog-Art-Api:$TOKEN" -O "$LOCAL_ZIP" "$URL" -# Check if the file was downloaded +#Check if the file was downloaded if [ $? -eq 0 ]; then echo "File downloaded successfully: $LOCAL_ZIP" else @@ -30,4 +30,7 @@ if [ $? -eq 0 ]; then else echo "Error unzipping file." >&2 exit 1 -fi \ No newline at end of file +fi + +# Remove the zipped file +rm "$LOCAL_ZIP" \ No newline at end of file diff --git a/enos/modules/fetch_artifactory/variables.tf b/enos/modules/fetch_artifactory/variables.tf index b5c7c96596d..9c51b5f3d63 100644 --- a/enos/modules/fetch_artifactory/variables.tf +++ b/enos/modules/fetch_artifactory/variables.tf @@ -31,11 +31,6 @@ variable "edition" { description = "The edition of the binary to search, it can be either CE or ENT" } -variable "revision" { - type = string - description = "The specific commit of the binary" -} - variable "os" { type = string description = "The operative system the binary is needed for" From aebce437ed3131db0e5f5c01403e84653f35d044 Mon Sep 17 00:00:00 2001 From: Juanadelacuesta <8647634+Juanadelacuesta@users.noreply.github.com> Date: Tue, 3 Dec 2024 18:56:24 +0100 Subject: [PATCH 08/15] func: start with the module to provision a cluster --- enos/enos-modules.hcl | 4 ++++ enos/enos-quality-upgrade.hcl | 43 ---------------------------------- enos/enos-scenario-upgrade.hcl | 31 ++++++++++++++---------- enos/enos-vars.hcl | 8 ------- 4 files changed, 22 insertions(+), 64 deletions(-) delete mode 100644 enos/enos-quality-upgrade.hcl diff --git a/enos/enos-modules.hcl b/enos/enos-modules.hcl index 4f3f5de3844..1ab66d18740 100644 --- a/enos/enos-modules.hcl +++ b/enos/enos-modules.hcl @@ -6,3 +6,7 @@ module "build_artifactory" { source = "./modules/fetch_artifactory" } + +module "provision_cluster" { + source = "../e2e/terraform" +} \ No newline at end of file diff --git a/enos/enos-quality-upgrade.hcl b/enos/enos-quality-upgrade.hcl deleted file mode 100644 index 050d9e27eec..00000000000 --- a/enos/enos-quality-upgrade.hcl +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright (c) HashiCorp, Inc. -# SPDX-License-Identifier: BUSL-1.1 - -quality "nomad_agent_info" { - description = "A GET call to /v1/agent/members returns the correct number of - running servers and they are all alive" -} - -quality "nomad_agent_info_self" { - description = "A GET call to /v1/agent/self against every server returns the - same last_log_index for all of them." -} - -quality "nomad_nodes_status" { - description = "A GET call to /v1/nodes returns the correct number of clients - and they are all `eligible` and `ready`". -} - -quality "nomad_job_status" { - description = "A GET call to /v1/jobs returns the correct number of jobs and - they are all `running`". -} - -quality "nomad_register_job" { - description = "A POST call to /v1/jobs results in a new job running and - allocations being started accordingly." -} - -quality "nomad_reschedule_alloc" { - description = "A POST / PUT call to /v1/allocation/:alloc_id/stop results in - the stopped allocation being rescheduled" -} - - -quality "nomad_restore_snapshot" { - description = "A node can be restored from a snapshot built on a previous - version" -} - -quality "nomad_allocs_status" { - description = "A GET call to /v1/allocs returns the correct number of - allocations and they are all `running`". -} diff --git a/enos/enos-scenario-upgrade.hcl b/enos/enos-scenario-upgrade.hcl index e127ccd8347..62271891848 100644 --- a/enos/enos-scenario-upgrade.hcl +++ b/enos/enos-scenario-upgrade.hcl @@ -9,34 +9,39 @@ scenario "upgrade" { matrix { arch = ["amd64", "arm64"] - //service_discovery = ["consul", "nomad"] - distro = ["alpine", "fedora", "rhel", "ubuntu"] + service_discovery = ["consul", "nomad"] editions = ["ce", "ent"] - os = ["linux", "darwin", "windows"] + os = ["linux", "windows"] + + exclude { + os = ["windows"] + arch = ["arm64"] + } } step "copy_binary" { description = <<-EOF Determine which Nomad artifact we want to use for the scenario, depending on the - 'arch', 'distro' and 'os' + 'arch', 'edition' and 'os' EOF module = module.build_artifactory variables { - version = global.initial_version - artifactory_path = globals.artifact_path - artifact_token = globals.artifact_token - os = matrix.os - distro = matrix.os != "linux" ? var.distro : null - local_path = var.binary_local_path + artifactory_username = var.artifactory_username + artifactory_token = var.artifact_token + arch = matrix.arch + edition = matrix.edition + product_version = var.product_version + os = matrix.os + local_path = var.binary_local_path } } - /* + step "provision_cluster" { description = <<-EOF Using the binary from the previous step, provision a Nomad cluster using the e2e EOF - module = "build_${matrix.os}_${matrix.distro}" + module = module. variables { name @@ -47,7 +52,7 @@ scenario "upgrade" { // ... } } - + /* step "run_new_workloads" { description = <<-EOF Verify the health of the cluster by running new workloads and stopping random allocs diff --git a/enos/enos-vars.hcl b/enos/enos-vars.hcl index b018229acc9..ca281333881 100644 --- a/enos/enos-vars.hcl +++ b/enos/enos-vars.hcl @@ -18,13 +18,11 @@ variable "artifactory_token" { variable "artifactory_host" { type = string description = "The artifactory host to search for Nomad artifacts" - default = "https://artifactory.hashicorp.engineering/artifactory" } variable "artifactory_repo" { type = string description = "The artifactory repo to search for Nomad artifacts" - default = "hashicorp-crt-stable-local*" } variable "edition" { @@ -32,11 +30,6 @@ variable "edition" { description = "The edition of the binary to search, it can be either CE or ENT" } -variable "revision" { - type = string - description = "The specific commit of the binary" -} - variable "os" { type = string description = "The operative system the binary is needed for" @@ -57,5 +50,4 @@ variable "arch" { variable "binary_path" { description = "The path to donwload and unzip the binary" type = string - default = "/home/ubuntu/nomad" } From 592331a6a3064c05811c78a83a011b5329d9b67f Mon Sep 17 00:00:00 2001 From: Juanadelacuesta <8647634+Juanadelacuesta@users.noreply.github.com> Date: Tue, 3 Dec 2024 16:40:58 -0500 Subject: [PATCH 09/15] fix: update syntax to get enos running --- enos/enos-quality.hcl | 24 ++++++---------- enos/enos-scenario-upgrade.hcl | 10 +++---- enos/enos-terraform.hcl | 4 ++- enos/enos-vars.hcl | 28 +------------------ .../fetch_artifactory/scripts/install.sh | 2 +- enos/modules/fetch_artifactory/variables.tf | 2 +- 6 files changed, 19 insertions(+), 51 deletions(-) diff --git a/enos/enos-quality.hcl b/enos/enos-quality.hcl index 050d9e27eec..eeb8dfeced2 100644 --- a/enos/enos-quality.hcl +++ b/enos/enos-quality.hcl @@ -2,42 +2,34 @@ # SPDX-License-Identifier: BUSL-1.1 quality "nomad_agent_info" { - description = "A GET call to /v1/agent/members returns the correct number of - running servers and they are all alive" + description = "A GET call to /v1/agent/members returns the correct number of running servers and they are all alive" } quality "nomad_agent_info_self" { - description = "A GET call to /v1/agent/self against every server returns the - same last_log_index for all of them." + description = "A GET call to /v1/agent/self against every server returns the same last_log_index for all of them" } quality "nomad_nodes_status" { - description = "A GET call to /v1/nodes returns the correct number of clients - and they are all `eligible` and `ready`". + description = "A GET call to /v1/nodes returns the correct number of clients and they are all eligible and ready" } quality "nomad_job_status" { - description = "A GET call to /v1/jobs returns the correct number of jobs and - they are all `running`". + description = "A GET call to /v1/jobs returns the correct number of jobs and they are all running" } quality "nomad_register_job" { - description = "A POST call to /v1/jobs results in a new job running and - allocations being started accordingly." + description = "A POST call to /v1/jobs results in a new job running and allocations being started accordingly" } quality "nomad_reschedule_alloc" { - description = "A POST / PUT call to /v1/allocation/:alloc_id/stop results in - the stopped allocation being rescheduled" + description = "A POST / PUT call to /v1/allocation/:alloc_id/stop results in the stopped allocation being rescheduled" } quality "nomad_restore_snapshot" { - description = "A node can be restored from a snapshot built on a previous - version" + description = "A node can be restored from a snapshot built on a previous version" } quality "nomad_allocs_status" { - description = "A GET call to /v1/allocs returns the correct number of - allocations and they are all `running`". + description = "A GET call to /v1/allocs returns the correct number of allocations and they are all running" } diff --git a/enos/enos-scenario-upgrade.hcl b/enos/enos-scenario-upgrade.hcl index 62271891848..b4d2bcb2782 100644 --- a/enos/enos-scenario-upgrade.hcl +++ b/enos/enos-scenario-upgrade.hcl @@ -9,8 +9,8 @@ scenario "upgrade" { matrix { arch = ["amd64", "arm64"] - service_discovery = ["consul", "nomad"] - editions = ["ce", "ent"] + //service_discovery = ["consul", "nomad"] + edition = ["ce", "ent"] os = ["linux", "windows"] exclude { @@ -28,7 +28,7 @@ scenario "upgrade" { variables { artifactory_username = var.artifactory_username - artifactory_token = var.artifact_token + artifactory_token = var.artifactory_token arch = matrix.arch edition = matrix.edition product_version = var.product_version @@ -37,7 +37,7 @@ scenario "upgrade" { } } - step "provision_cluster" { +/* step "provision_cluster" { description = <<-EOF Using the binary from the previous step, provision a Nomad cluster using the e2e EOF @@ -51,7 +51,7 @@ scenario "upgrade" { client_count_ubuntu_jammy_amd64 = matrix.distro != "ubuntu" ? var.client_count_ubuntu_jammy_amd64 : 0 // ... } - } + } */ /* step "run_new_workloads" { description = <<-EOF diff --git a/enos/enos-terraform.hcl b/enos/enos-terraform.hcl index 873646e0eb9..63fa4dbc94c 100644 --- a/enos/enos-terraform.hcl +++ b/enos/enos-terraform.hcl @@ -1,10 +1,12 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -terraform { +terraform "default" { required_providers { enos = { source = "registry.terraform.io/hashicorp-forge/enos" } } + + required_version = ">= 1.2.0" } \ No newline at end of file diff --git a/enos/enos-vars.hcl b/enos/enos-vars.hcl index ca281333881..2c94d7ee858 100644 --- a/enos/enos-vars.hcl +++ b/enos/enos-vars.hcl @@ -15,39 +15,13 @@ variable "artifactory_token" { sensitive = true } -variable "artifactory_host" { - type = string - description = "The artifactory host to search for Nomad artifacts" -} - -variable "artifactory_repo" { - type = string - description = "The artifactory repo to search for Nomad artifacts" -} - -variable "edition" { - type = string - description = "The edition of the binary to search, it can be either CE or ENT" -} - -variable "os" { - type = string - description = "The operative system the binary is needed for" - default = "linux" -} - variable "product_version" { description = "The version of Nomad we are testing" type = string default = null } -variable "arch" { - description = "The artifactory path to search for Nomad artifacts" - type = string -} - -variable "binary_path" { +variable "binary_local_path" { description = "The path to donwload and unzip the binary" type = string } diff --git a/enos/modules/fetch_artifactory/scripts/install.sh b/enos/modules/fetch_artifactory/scripts/install.sh index a7f9c24ae14..e29e4433831 100755 --- a/enos/modules/fetch_artifactory/scripts/install.sh +++ b/enos/modules/fetch_artifactory/scripts/install.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 diff --git a/enos/modules/fetch_artifactory/variables.tf b/enos/modules/fetch_artifactory/variables.tf index 9c51b5f3d63..b1438adcc76 100644 --- a/enos/modules/fetch_artifactory/variables.tf +++ b/enos/modules/fetch_artifactory/variables.tf @@ -23,7 +23,7 @@ variable "artifactory_host" { variable "artifactory_repo" { type = string description = "The artifactory repo to search for Nomad artifacts" - default = "hashicorp-crt-stable-local*" + default = "hashicorp-crt-staging-local*" } variable "edition" { From 56d089f23e246a8d6d467550bcec5ecda1178bde Mon Sep 17 00:00:00 2001 From: Juanadelacuesta <8647634+Juanadelacuesta@users.noreply.github.com> Date: Tue, 3 Dec 2024 17:03:44 -0500 Subject: [PATCH 10/15] func: add enos vars to gitignore to avoid pushing tokens by mistake --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 2fc7f49083f..57c30467f00 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ Thumbs.db .idea .fleet + # Folders _obj _test From 8de165102110e7076b6d9514902e5d0dcb5dfc21 Mon Sep 17 00:00:00 2001 From: Juanadelacuesta <8647634+Juanadelacuesta@users.noreply.github.com> Date: Tue, 3 Dec 2024 17:45:31 -0500 Subject: [PATCH 11/15] func: add variables for provide_cluster to enos-vars --- enos/enos-scenario-upgrade.hcl | 43 ++++++++++++++++++++-------------- enos/enos-vars.hcl | 18 ++++++++++++++ 2 files changed, 44 insertions(+), 17 deletions(-) diff --git a/enos/enos-scenario-upgrade.hcl b/enos/enos-scenario-upgrade.hcl index b4d2bcb2782..2fc4919ed04 100644 --- a/enos/enos-scenario-upgrade.hcl +++ b/enos/enos-scenario-upgrade.hcl @@ -11,7 +11,7 @@ scenario "upgrade" { arch = ["amd64", "arm64"] //service_discovery = ["consul", "nomad"] edition = ["ce", "ent"] - os = ["linux", "windows"] + os = ["linux", "windows"] exclude { os = ["windows"] @@ -19,7 +19,13 @@ scenario "upgrade" { } } - step "copy_binary" { + locals { + cluster_name = "upgrade-testing-cluster-${matrix.os}-${matrix.arch}" + ubuntu_count = matrix.os == "linux" ? 4 : 0 + windows_count = matrix.os == "windows" ? 4 : 0 + } + + step "copy_initial_binary" { description = <<-EOF Determine which Nomad artifact we want to use for the scenario, depending on the 'arch', 'edition' and 'os' @@ -37,21 +43,24 @@ scenario "upgrade" { } } -/* step "provision_cluster" { + step "provision_cluster" { description = <<-EOF Using the binary from the previous step, provision a Nomad cluster using the e2e EOF - module = module. + depends_on = [step.copy_initial_binary] + + module = module.provision_cluster variables { - name - nomad_local_binary = step.copy_binary.nomad_local_binary - nomad_license = global.nomad_license_path - server_count = var.server_count - client_count_ubuntu_jammy_amd64 = matrix.distro != "ubuntu" ? var.client_count_ubuntu_jammy_amd64 : 0 - // ... + name = local.cluster_name + nomad_local_binary = step.copy_initial_binary.nomad_local_binary + client_count_ubuntu_jammy_amd64 = local.ubuntu_count + client_count_windows_2016_amd64 = local.windows_count + nomad_license = var.nomad_license + consul_license = var.consul_license + volumes = false } - } */ + } /* step "run_new_workloads" { description = <<-EOF @@ -77,8 +86,8 @@ scenario "upgrade" { version = global.upgrade_version artifactory_path = globals.artifact_path artifact_token = globals.artifact_toke. - os = step.copy_binary.os - distro = step.copy_binary.distro + os = step.copy_initial_binary.os + distro = step.copy_initial_binary.distro // ... } } @@ -98,12 +107,12 @@ scenario "upgrade" { variables { cc_update_type = "server" - nomad_upgraded_binary = step.copy_binary.nomad_local_binary + nomad_upgraded_binary = step.copy_initial_binary.nomad_local_binary // ... } } - step "run_new_workloads" { + step "run_servers_workloads" { // ... } @@ -121,12 +130,12 @@ scenario "upgrade" { variables { cc_update_type = "client" - nomad_upgraded_binary = step.copy_binary.nomad_local_binary + nomad_upgraded_binary = step.copy_initial_binary.nomad_local_binary // ... } } - step "run_new_workloads" { + step "run_clients_workloads" { // ... } */ } diff --git a/enos/enos-vars.hcl b/enos/enos-vars.hcl index 2c94d7ee858..fdbda644b9e 100644 --- a/enos/enos-vars.hcl +++ b/enos/enos-vars.hcl @@ -25,3 +25,21 @@ variable "binary_local_path" { description = "The path to donwload and unzip the binary" type = string } + +# Variables for the provision_cluster module +variable "nomad_local_binary" { + description = "The path to a local binary to provision" + default = "" +} + +variable "nomad_license" { + type = string + description = "If nomad_license is set, deploy a license" + default = "" +} + +variable "consul_license" { + type = string + description = "If consul_license is set, deploy a license" + default = "" +} \ No newline at end of file From ca28e9b8cda2d52243e00c9012b1064426ebc667 Mon Sep 17 00:00:00 2001 From: Juanadelacuesta <8647634+Juanadelacuesta@users.noreply.github.com> Date: Fri, 13 Dec 2024 10:54:20 -0500 Subject: [PATCH 12/15] style: rename ubuntu jammy client to account for different archs --- e2e/terraform/Makefile | 2 +- e2e/terraform/README.md | 2 +- e2e/terraform/compute.tf | 32 +++- e2e/terraform/network.tf | 4 +- e2e/terraform/nomad.tf | 8 +- e2e/terraform/outputs.tf | 4 +- .../packer/ubuntu-jammy-arm64.pkr.hcl | 59 +++++++ .../ubuntu-jammy-arm64/cni/cni_args.conflist | 9 + .../packer/ubuntu-jammy-arm64/cni/cni_args.sh | 70 ++++++++ .../ubuntu-jammy-arm64/cni/loopback.conf | 5 + .../ubuntu-jammy-arm64/cni/loopback.conflist | 7 + .../ubuntu-jammy-arm64/cni/loopback.json | 5 + .../packer/ubuntu-jammy-arm64/consul.service | 16 ++ .../packer/ubuntu-jammy-arm64/dnsconfig.sh | 55 ++++++ .../packer/ubuntu-jammy-arm64/dnsmasq | 8 + .../packer/ubuntu-jammy-arm64/dnsmasq.service | 37 ++++ .../packer/ubuntu-jammy-arm64/nomad.service | 21 +++ .../packer/ubuntu-jammy-arm64/setup.sh | 165 ++++++++++++++++++ e2e/terraform/tls_client.tf | 2 +- e2e/terraform/variables.tf | 7 +- enos/enos-quality.hcl | 14 +- enos/enos-scenario-upgrade.hcl | 38 ++-- enos/enos-vars.hcl | 2 +- enos/modules/fetch_artifactory/locals.tf | 1 + enos/modules/fetch_artifactory/main.tf | 1 + enos/modules/fetch_artifactory/outputs.tf | 7 +- 26 files changed, 544 insertions(+), 37 deletions(-) create mode 100644 e2e/terraform/packer/ubuntu-jammy-arm64.pkr.hcl create mode 100644 e2e/terraform/packer/ubuntu-jammy-arm64/cni/cni_args.conflist create mode 100755 e2e/terraform/packer/ubuntu-jammy-arm64/cni/cni_args.sh create mode 100644 e2e/terraform/packer/ubuntu-jammy-arm64/cni/loopback.conf create mode 100644 e2e/terraform/packer/ubuntu-jammy-arm64/cni/loopback.conflist create mode 100644 e2e/terraform/packer/ubuntu-jammy-arm64/cni/loopback.json create mode 100644 e2e/terraform/packer/ubuntu-jammy-arm64/consul.service create mode 100644 e2e/terraform/packer/ubuntu-jammy-arm64/dnsconfig.sh create mode 100644 e2e/terraform/packer/ubuntu-jammy-arm64/dnsmasq create mode 100644 e2e/terraform/packer/ubuntu-jammy-arm64/dnsmasq.service create mode 100644 e2e/terraform/packer/ubuntu-jammy-arm64/nomad.service create mode 100755 e2e/terraform/packer/ubuntu-jammy-arm64/setup.sh diff --git a/e2e/terraform/Makefile b/e2e/terraform/Makefile index 10b4eda7884..14d7124c2a4 100644 --- a/e2e/terraform/Makefile +++ b/e2e/terraform/Makefile @@ -7,7 +7,7 @@ CONSUL_LICENSE_PATH ?= custom.tfvars: echo 'nomad_local_binary = "$(PKG_PATH)"' > custom.tfvars echo 'volumes = false' >> custom.tfvars - echo 'client_count_ubuntu_jammy_amd64 = 3' >> custom.tfvars + echo 'client_count_linux = 3' >> custom.tfvars echo 'client_count_windows_2016_amd64 = 0' >> custom.tfvars echo 'consul_license = "$(shell cat $(CONSUL_LICENSE_PATH))"' >> custom.tfvars echo 'nomad_license = "$(shell cat $(NOMAD_LICENSE_PATH))"' >> custom.tfvars diff --git a/e2e/terraform/README.md b/e2e/terraform/README.md index a5785654557..12a9e119628 100644 --- a/e2e/terraform/README.md +++ b/e2e/terraform/README.md @@ -51,7 +51,7 @@ Linux clients or Windows clients. region = "us-east-1" instance_type = "t2.medium" server_count = "3" -client_count_ubuntu_jammy_amd64 = "4" +client_count_linux = "4" client_count_windows_2016_amd64 = "1" ``` diff --git a/e2e/terraform/compute.tf b/e2e/terraform/compute.tf index 9788ae17dbf..920428c68c4 100644 --- a/e2e/terraform/compute.tf +++ b/e2e/terraform/compute.tf @@ -3,6 +3,7 @@ locals { ami_prefix = "nomad-e2e-v3" + ubuntu_instance_name = "ubuntu-jammy-${var.instance_architecture}" } resource "aws_instance" "server" { @@ -22,18 +23,18 @@ resource "aws_instance" "server" { } } -resource "aws_instance" "client_ubuntu_jammy_amd64" { - ami = data.aws_ami.ubuntu_jammy_amd64.image_id +resource "aws_instance" "client_ubuntu_jammy" { + ami = data.aws_ami.ubuntu_jammy.image_id instance_type = var.instance_type key_name = module.keys.key_name vpc_security_group_ids = [aws_security_group.clients.id] # see also the secondary ENI - count = var.client_count_ubuntu_jammy_amd64 + count = var.client_count_linux iam_instance_profile = data.aws_iam_instance_profile.nomad_e2e_cluster.name availability_zone = var.availability_zone # Instance tags tags = { - Name = "${local.random_name}-client-ubuntu-jammy-amd64-${count.index}" + Name = "${local.random_name}-client-ubuntu-jammy-${count.index}" ConsulAutoJoin = "auto-join-${local.random_name}" User = data.aws_caller_identity.current.arn } @@ -104,6 +105,29 @@ data "aws_ami" "ubuntu_jammy_amd64" { name = "tag:BuilderSha" values = [data.external.packer_sha.result["sha"]] } +<<<<<<< Updated upstream +======= +} + +data "aws_ami" "ubuntu_jammy" { + most_recent = true + owners = ["self"] + + filter { + name = "name" + values = ["${local.ami_prefix}-${ubuntu_instance_name}-*"] + } + + filter { + name = "tag:OS" + values = ["Ubuntu"] + } + + filter { + name = "tag:BuilderSha" + values = [data.external.packer_sha.result["sha"]] + } +>>>>>>> Stashed changes } data "aws_ami" "windows_2016_amd64" { diff --git a/e2e/terraform/network.tf b/e2e/terraform/network.tf index 79330e0aab8..774da56bffb 100644 --- a/e2e/terraform/network.tf +++ b/e2e/terraform/network.tf @@ -207,9 +207,9 @@ resource "aws_network_interface" "clients_secondary" { subnet_id = data.aws_subnet.secondary.id security_groups = [aws_security_group.clients_secondary.id] - count = var.client_count_ubuntu_jammy_amd64 + count = var.client_count_linux attachment { - instance = aws_instance.client_ubuntu_jammy_amd64[count.index].id + instance = aws_instance.client_ubuntu_jammy[count.index].id device_index = 1 } } diff --git a/e2e/terraform/nomad.tf b/e2e/terraform/nomad.tf index 0c7719b9362..03ddcb25f06 100644 --- a/e2e/terraform/nomad.tf +++ b/e2e/terraform/nomad.tf @@ -31,16 +31,16 @@ module "nomad_server" { # TODO: split out the different Linux targets (ubuntu, centos, arm, etc.) when # they're available -module "nomad_client_ubuntu_jammy_amd64" { +module "nomad_client_ubuntu_jammy" { source = "./provision-nomad" - depends_on = [aws_instance.client_ubuntu_jammy_amd64] - count = var.client_count_ubuntu_jammy_amd64 + depends_on = [aws_instance.client_ubuntu_jammy] + count = var.client_count_linux platform = "linux" arch = "linux_amd64" role = "client" index = count.index - instance = aws_instance.client_ubuntu_jammy_amd64[count.index] + instance = aws_instance.client_ubuntu_jammy[count.index] nomad_local_binary = count.index < length(var.nomad_local_binary_client_ubuntu_jammy_amd64) ? var.nomad_local_binary_client_ubuntu_jammy_amd64[count.index] : var.nomad_local_binary diff --git a/e2e/terraform/outputs.tf b/e2e/terraform/outputs.tf index 0441906b132..c50436ef857 100644 --- a/e2e/terraform/outputs.tf +++ b/e2e/terraform/outputs.tf @@ -6,7 +6,7 @@ output "servers" { } output "linux_clients" { - value = aws_instance.client_ubuntu_jammy_amd64.*.public_ip + value = aws_instance.client_ubuntu_jammy.*.public_ip } output "windows_clients" { @@ -31,7 +31,7 @@ ssh into servers with: ssh into clients with: -%{for ip in aws_instance.client_ubuntu_jammy_amd64.*.public_ip~} +%{for ip in aws_instance.client_ubuntu_jammy.*.public_ip~} ssh -i keys/${local.random_name}.pem ubuntu@${ip} %{endfor~} %{for ip in aws_instance.client_windows_2016_amd64.*.public_ip~} diff --git a/e2e/terraform/packer/ubuntu-jammy-arm64.pkr.hcl b/e2e/terraform/packer/ubuntu-jammy-arm64.pkr.hcl new file mode 100644 index 00000000000..3af70cc8262 --- /dev/null +++ b/e2e/terraform/packer/ubuntu-jammy-arm64.pkr.hcl @@ -0,0 +1,59 @@ +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: BUSL-1.1 + +variable "build_sha" { + type = string + description = "the revision of the packer scripts building this image" +} + +locals { + timestamp = regex_replace(timestamp(), "[- TZ:]", "") + distro = "ubuntu-jammy-22.04-arm64-server-*" + version = "v3" +} + +source "amazon-ebs" "latest_ubuntu_jammy" { + ami_name = "nomad-e2e-${local.version}-ubuntu-jammy-arm64-${local.timestamp}" + iam_instance_profile = "packer_build" // defined in nomad-e2e repo + instance_type = "m7a.large" + region = "us-east-1" + ssh_username = "ubuntu" + ssh_interface = "public_ip" + + source_ami_filter { + filters = { + architecture = "arm64" + "block-device-mapping.volume-type" = "gp2" + name = "ubuntu/images/hvm-ssd/${local.distro}" + root-device-type = "ebs" + virtualization-type = "hvm" + } + most_recent = true + owners = ["099720109477"] // Canonical + } + + tags = { + OS = "Ubuntu" + Version = "Jammy" + BuilderSha = var.build_sha + } +} + +build { + sources = ["source.amazon-ebs.latest_ubuntu_jammy"] + + provisioner "file" { + destination = "/tmp/linux" + source = "./ubuntu-jammy-arm64" + } + + // cloud-init modifies the apt sources, so we need to wait + // before running our setup + provisioner "shell-local" { + inline = ["sleep 30"] + } + + provisioner "shell" { + script = "./ubuntu-jammy-arm64/setup.sh" + } +} diff --git a/e2e/terraform/packer/ubuntu-jammy-arm64/cni/cni_args.conflist b/e2e/terraform/packer/ubuntu-jammy-arm64/cni/cni_args.conflist new file mode 100644 index 00000000000..ae119111d78 --- /dev/null +++ b/e2e/terraform/packer/ubuntu-jammy-arm64/cni/cni_args.conflist @@ -0,0 +1,9 @@ +{ + "cniVersion": "1.0.0", + "name": "cni_args", + "plugins": [ + { + "type": "cni_args.sh" + } + ] +} diff --git a/e2e/terraform/packer/ubuntu-jammy-arm64/cni/cni_args.sh b/e2e/terraform/packer/ubuntu-jammy-arm64/cni/cni_args.sh new file mode 100755 index 00000000000..bcdf0d05153 --- /dev/null +++ b/e2e/terraform/packer/ubuntu-jammy-arm64/cni/cni_args.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env bash + +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: BUSL-1.1 + +set -euo pipefail + +# things are prefixed with "Fancy*" because this is a fancy plugin. +# CNI_ARGS='IgnoreUnknown=true;FancyTaskDir=/tmp/cni_args;FancyMessage=hiiii;Another=whatever' +# what we need to do: +# 1. read CNI_ARGS environment variable +# * write to a file named $FancyTaskDir/victory +# 2. write CNI-spec json to stdout for Nomad to read + +# https://github.com/containernetworking/cni/blob/main/SPEC.md#version-success +function version() { + cat <&2 echo "got task dir: $task_dir; message: $message" + + mkdir -p "$task_dir" + # and write something to a file we can check in the test. + echo "$message" > "$task_dir/victory" +} + +# run the appropriate CNI command +case "$CNI_COMMAND" in + VERSION) version ; exit ;; + ADD) add ;; +esac + +# bogus reply so nomad doesn't error +cat < /tmp/resolv.conf +nameserver 127.0.0.1 +nameserver $DOCKER_BRIDGE_IP_ADDRESS +EOF +cp /tmp/resolv.conf /etc/resolv.conf + +# need to get the interface for dnsmasq config so that we can +# accomodate both "predictable" and old-style interface names +IFACE=$(ip route | grep default | awk '{print $5}') + +cat < /tmp/dnsmasq +port=53 +resolv-file=/var/run/dnsmasq/resolv.conf +bind-interfaces +interface=docker0 +interface=lo +interface=$IFACE +listen-address=127.0.0.1 +server=/consul/127.0.0.1#8600 +EOF +cp /tmp/dnsmasq /etc/dnsmasq.d/default + +# need to get the AWS DNS address from the VPC... +# this is pretty hacky but will work for any typical case +MAC=$(curl -s --fail http://169.254.169.254/latest/meta-data/mac) +CIDR_BLOCK=$(curl -s --fail "http://169.254.169.254/latest/meta-data/network/interfaces/macs/$MAC/vpc-ipv4-cidr-block") +VPC_DNS_ROOT=$(echo "$CIDR_BLOCK" | cut -d'.' -f1-3) +echo "nameserver ${VPC_DNS_ROOT}.2" > /tmp/dnsmasq-resolv.conf +cp /tmp/dnsmasq-resolv.conf /var/run/dnsmasq/resolv.conf + +/usr/sbin/dnsmasq --test diff --git a/e2e/terraform/packer/ubuntu-jammy-arm64/dnsmasq b/e2e/terraform/packer/ubuntu-jammy-arm64/dnsmasq new file mode 100644 index 00000000000..42b06f6e5b8 --- /dev/null +++ b/e2e/terraform/packer/ubuntu-jammy-arm64/dnsmasq @@ -0,0 +1,8 @@ +port=53 +resolv-file=/var/run/dnsmasq/resolv.conf +bind-interfaces +interface=docker0 +interface=lo +interface=eth0 +listen-address=127.0.0.1 +server=/consul/127.0.0.1#8600 diff --git a/e2e/terraform/packer/ubuntu-jammy-arm64/dnsmasq.service b/e2e/terraform/packer/ubuntu-jammy-arm64/dnsmasq.service new file mode 100644 index 00000000000..93b7c97e3f5 --- /dev/null +++ b/e2e/terraform/packer/ubuntu-jammy-arm64/dnsmasq.service @@ -0,0 +1,37 @@ +[Unit] +Description=dnsmasq - A lightweight DHCP and caching DNS server +Requires=network.target +Wants=nss-lookup.target +Before=nss-lookup.target +After=network.target +After=docker.service + +[Service] +Type=forking +PIDFile=/run/dnsmasq/dnsmasq.pid + +# Configure our hosts and resolver file with info from the host, +# then test the resulting config file before starting +ExecStartPre=/usr/local/bin/dnsconfig.sh + +# (from upstream) +# We run dnsmasq via the /etc/init.d/dnsmasq script which acts as a +# wrapper picking up extra configuration files and then execs dnsmasq +# itself, when called with the "systemd-exec" function. +ExecStart=/etc/init.d/dnsmasq systemd-exec + +# (from upstream) +# The systemd-*-resolvconf functions configure (and deconfigure) +# resolvconf to work with the dnsmasq DNS server. They're called like +# this to get correct error handling (ie don't start-resolvconf if the +# dnsmasq daemon fails to start. +ExecStartPost=/etc/init.d/dnsmasq systemd-start-resolvconf + +# We need to tell docker to pick up the changes +ExecStartPost=/bin/systemctl restart docker + +ExecStop=/etc/init.d/dnsmasq systemd-stop-resolvconf +ExecReload=/bin/kill -HUP $MAINPID + +[Install] +WantedBy=multi-user.target diff --git a/e2e/terraform/packer/ubuntu-jammy-arm64/nomad.service b/e2e/terraform/packer/ubuntu-jammy-arm64/nomad.service new file mode 100644 index 00000000000..8490fc9c8e8 --- /dev/null +++ b/e2e/terraform/packer/ubuntu-jammy-arm64/nomad.service @@ -0,0 +1,21 @@ +[Unit] +Description=Nomad Agent +Requires=network-online.target +After=network-online.target +StartLimitIntervalSec=0 +StartLimitBurst=3 + +[Service] +ExecReload=/bin/kill -HUP $MAINPID +ExecStart=/usr/local/bin/nomad agent -config /etc/nomad.d +EnvironmentFile=-/etc/nomad.d/.environment +KillMode=process +KillSignal=SIGINT +LimitNOFILE=65536 +LimitNPROC=infinity +TasksMax=infinity +Restart=on-failure +RestartSec=2 + +[Install] +WantedBy=multi-user.target diff --git a/e2e/terraform/packer/ubuntu-jammy-arm64/setup.sh b/e2e/terraform/packer/ubuntu-jammy-arm64/setup.sh new file mode 100755 index 00000000000..4129326d18b --- /dev/null +++ b/e2e/terraform/packer/ubuntu-jammy-arm64/setup.sh @@ -0,0 +1,165 @@ +#!/usr/bin/env bash +# Copyright (c) HashiCorp, Inc. +# SPDX-License-Identifier: BUSL-1.1 + +# setup script for Ubuntu Linux 22.04. Assumes that Packer has placed +# build-time config files at /tmp/linux + +set -xeuo pipefail + +NOMAD_PLUGIN_DIR=/opt/nomad/plugins/ + +mkdir_for_root() { + sudo mkdir -p "$1" + sudo chmod 755 "$1" +} + +# Disable interactive apt prompts +export DEBIAN_FRONTEND=noninteractive +echo 'debconf debconf/frontend select Noninteractive' | sudo debconf-set-selections + +mkdir_for_root /opt +mkdir_for_root /opt/bin # for envoy +mkdir_for_root /srv/data # for host volumes +mkdir_for_root /opt/cni/bin +mkdir_for_root /opt/cni/config + +# Dependencies +sudo apt-get update +sudo apt-get upgrade -y +sudo apt-get install -y \ + software-properties-common \ + dnsmasq unzip tree redis-tools jq curl tmux awscli nfs-common \ + apt-transport-https ca-certificates gnupg2 stress + +# Install hc-install +curl -o /tmp/hc-install.zip https://releases.hashicorp.com/hc-install/0.9.0/hc-install_0.9.0_linux_arm64.zip +sudo unzip -d /usr/local/bin /tmp/hc-install.zip + +# Disable the firewall +sudo ufw disable || echo "ufw not installed" + +echo "Install HashiCorp apt repositories" +wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg +echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list + +echo "Installing Docker apt repositories" +sudo install -m 0755 -d /etc/apt/keyrings +curl --insecure -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg +sudo chmod a+r /etc/apt/keyrings/docker.gpg +echo \ + "deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ + "$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \ + sudo tee /etc/apt/sources.list.d/docker.list > /dev/null + +echo "Refresh apt with third party repositories" +sudo apt-get update + +echo "Install Consul and Nomad" +sudo apt-get install -y \ + consul-enterprise \ + nomad + +# Note: neither service will start on boot because we haven't enabled +# the systemd unit file and we haven't uploaded any configuration +# files for Consul and Nomad + +echo "Configure Consul" +mkdir_for_root /etc/consul.d +mkdir_for_root /opt/consul +sudo mv /tmp/linux/consul.service /etc/systemd/system/consul.service + +echo "Configure Nomad" +mkdir_for_root /etc/nomad.d +mkdir_for_root /opt/nomad +mkdir_for_root $NOMAD_PLUGIN_DIR +sudo mv /tmp/linux/nomad.service /etc/systemd/system/nomad.service + +echo "Installing third-party tools" + +# Docker +echo "Installing Docker CE" +sudo apt-get install -y docker-ce docker-ce-cli + +# Java +echo "Installing Java" +sudo apt-get install -y openjdk-17-jdk-headless + +# CNI +echo "Installing CNI plugins" +wget -q -O - \ + https://github.com/containernetworking/plugins/releases/download/v1.0.0/cni-plugins-linux-arm64-v1.0.0.tgz \ + | sudo tar -C /opt/cni/bin -xz + +echo "Installing consul-cni plugin" +sudo hc-install install --path /opt/cni/bin --version 1.5.1 consul-cni + +echo "Installing custom test plugins" +# for .conf and .json config tests +sudo mv /tmp/linux/cni/loopback.* /opt/cni/config/ +# cni_args test plugin and network config +sudo mv /tmp/linux/cni/cni_args.conflist /opt/cni/config/ +sudo mv /tmp/linux/cni/cni_args.sh /opt/cni/bin/ + +# Podman +echo "Installing Podman" +sudo apt-get -y install podman catatonit + +echo "Installing Podman Driver" +sudo hc-install install --path ${NOMAD_PLUGIN_DIR} --version 0.5.0 nomad-driver-podman + +# Pledge +echo "Installing Pledge Driver" +curl -k -fsSL -o /tmp/pledge-driver.tar.gz https://github.com/shoenig/nomad-pledge-driver/releases/download/v0.3.0/nomad-pledge-driver_0.3.0_linux_amd64.tar.gz +curl -k -fsSL -o /tmp/pledge https://github.com/shoenig/nomad-pledge-driver/releases/download/pledge-1.8.com/pledge-1.8.com +tar -C /tmp -xf /tmp/pledge-driver.tar.gz +sudo mv /tmp/nomad-pledge-driver ${NOMAD_PLUGIN_DIR} +sudo mv /tmp/pledge /usr/local/bin +sudo chmod +x /usr/local/bin/pledge + +# Exec2 +echo "Installing Exec2 Driver" +sudo hc-install install --path ${NOMAD_PLUGIN_DIR} --version v0.1.0-alpha.2 nomad-driver-exec2 +sudo chmod +x ${NOMAD_PLUGIN_DIR}/nomad-driver-exec2 + +# Envoy +echo "Installing Envoy" +sudo curl -s -S -L -o /opt/bin/envoy https://github.com/envoyproxy/envoy/releases/download/v1.29.4/envoy-1.29.4-linux-x86_64 +sudo chmod +x /opt/bin/envoy + +# ECS +if [ -a "/tmp/linux/nomad-driver-ecs" ]; then + echo "Installing nomad-driver-ecs" + sudo install --mode=0755 --owner=ubuntu /tmp/linux/nomad-driver-ecs "$NOMAD_PLUGIN_DIR" +else + echo "nomad-driver-ecs not found: skipping install" +fi + +echo "Configuring dnsmasq" + +# disable systemd stub resolver +sudo sed -i 's|#DNSStubListener=yes|DNSStubListener=no|g' /etc/systemd/resolved.conf + +# disable systemd-resolved and configure dnsmasq to forward local requests to +# consul. the resolver files need to dynamic configuration based on the VPC +# address and docker bridge IP, so those will be rewritten at boot time. +sudo systemctl disable systemd-resolved.service +sudo systemctl stop systemd-resolved.service +sudo mv /tmp/linux/dnsmasq /etc/dnsmasq.d/default +sudo chown root:root /etc/dnsmasq.d/default + +# this is going to be overwritten at provisioning time, but we need something +# here or we can't fetch binaries to do the provisioning +echo 'nameserver 8.8.8.8' > /tmp/resolv.conf +sudo mv /tmp/resolv.conf /etc/resolv.conf + +sudo mv /tmp/linux/dnsmasq.service /etc/systemd/system/dnsmasq.service +sudo mv /tmp/linux/dnsconfig.sh /usr/local/bin/dnsconfig.sh +sudo chmod +x /usr/local/bin/dnsconfig.sh +sudo systemctl daemon-reload + +echo "Updating boot parameters" + +# enable cgroup_memory and swap +sudo sed -i 's/GRUB_CMDLINE_LINUX="[^"]*/& cgroup_enable=memory swapaccount=1/' /etc/default/grub +sudo update-grub \ No newline at end of file diff --git a/e2e/terraform/tls_client.tf b/e2e/terraform/tls_client.tf index 9a5e48c3f70..65cb6a250b4 100644 --- a/e2e/terraform/tls_client.tf +++ b/e2e/terraform/tls_client.tf @@ -56,7 +56,7 @@ resource "tls_self_signed_cert" "self_signed" { organization = "HashiCorp, Inc." } - ip_addresses = toset(aws_instance.client_ubuntu_jammy_amd64.*.public_ip) + ip_addresses = toset(aws_instance.client_ubuntu_jammy.*.public_ip) validity_period_hours = 720 allowed_uses = [ diff --git a/e2e/terraform/variables.tf b/e2e/terraform/variables.tf index ca2a64fd6f4..a14cc0f7a78 100644 --- a/e2e/terraform/variables.tf +++ b/e2e/terraform/variables.tf @@ -21,12 +21,17 @@ variable "instance_type" { default = "t3a.medium" } +variable "instance_architecture" { + description = "The architecture for the AWS instance type to use for both clients and servers." + default = "amd64" +} + variable "server_count" { description = "The number of servers to provision." default = "3" } -variable "client_count_ubuntu_jammy_amd64" { +variable "client_count_linux" { description = "The number of Ubuntu clients to provision." default = "4" } diff --git a/enos/enos-quality.hcl b/enos/enos-quality.hcl index eeb8dfeced2..6e160dd4dd6 100644 --- a/enos/enos-quality.hcl +++ b/enos/enos-quality.hcl @@ -13,6 +13,14 @@ quality "nomad_nodes_status" { description = "A GET call to /v1/nodes returns the correct number of clients and they are all eligible and ready" } +quality "nomad_node_eligibility" { + description = "A GET call to /v1/node/:node-id returns the same node.SchedulingEligibility before and after a server upgrade" +} + +quality "nomad_node_metadata" { + description = "A GET call to /v1/node/:node-id returns the same node.Meta for each server before and after a server upgrade" +} + quality "nomad_job_status" { description = "A GET call to /v1/jobs returns the correct number of jobs and they are all running" } @@ -25,7 +33,6 @@ quality "nomad_reschedule_alloc" { description = "A POST / PUT call to /v1/allocation/:alloc_id/stop results in the stopped allocation being rescheduled" } - quality "nomad_restore_snapshot" { description = "A node can be restored from a snapshot built on a previous version" } @@ -33,3 +40,8 @@ quality "nomad_restore_snapshot" { quality "nomad_allocs_status" { description = "A GET call to /v1/allocs returns the correct number of allocations and they are all running" } + +quality "nomad_alloc_reconect" { + description = "A GET call to /v1/alloc/:alloc_id will return the same alloc.CreateTime for each allocation before and after a client upgrade" +} + diff --git a/enos/enos-scenario-upgrade.hcl b/enos/enos-scenario-upgrade.hcl index 2fc4919ed04..1fde2b60ef1 100644 --- a/enos/enos-scenario-upgrade.hcl +++ b/enos/enos-scenario-upgrade.hcl @@ -8,59 +8,65 @@ scenario "upgrade" { EOF matrix { - arch = ["amd64", "arm64"] + arch = ["amd64"] + #arch = ["amd64", "arm64"] //service_discovery = ["consul", "nomad"] - edition = ["ce", "ent"] - os = ["linux", "windows"] + #edition = ["ce", "ent"] + edition = ["ce"] + os = ["linux"] + #os = ["linux", "windows"] - exclude { + /* exclude { os = ["windows"] arch = ["arm64"] - } + } */ } locals { - cluster_name = "upgrade-testing-cluster-${matrix.os}-${matrix.arch}" - ubuntu_count = matrix.os == "linux" ? 4 : 0 + cluster_name = "upgrade-testing-cluster-${matrix.os}-${matrix.arch}-${matrix.edition}" + linux_count = matrix.os == "linux" ? 4 : 0 windows_count = matrix.os == "windows" ? 4 : 0 + arch = matrix.arch } - step "copy_initial_binary" { + step "copy_initial_binary" { description = <<-EOF Determine which Nomad artifact we want to use for the scenario, depending on the 'arch', 'edition' and 'os' EOF + module = module.build_artifactory variables { artifactory_username = var.artifactory_username artifactory_token = var.artifactory_token - arch = matrix.arch + arch = local.arch edition = matrix.edition product_version = var.product_version os = matrix.os - local_path = var.binary_local_path + binary_path = "${var.nomad_local_binary}/${matrix.os}-${matrix.arch}-${matrix.edition}/nomad" } - } + } - step "provision_cluster" { + /* step "provision_cluster" { + // depends_on = [step.copy_initial_binary] description = <<-EOF Using the binary from the previous step, provision a Nomad cluster using the e2e EOF - depends_on = [step.copy_initial_binary] - module = module.provision_cluster variables { name = local.cluster_name nomad_local_binary = step.copy_initial_binary.nomad_local_binary - client_count_ubuntu_jammy_amd64 = local.ubuntu_count + client_count_linux = local.linux_count client_count_windows_2016_amd64 = local.windows_count nomad_license = var.nomad_license consul_license = var.consul_license - volumes = false + volumes = false + instance_architecture = matrix.arch } } + */ /* step "run_new_workloads" { description = <<-EOF diff --git a/enos/enos-vars.hcl b/enos/enos-vars.hcl index fdbda644b9e..9e51ec53342 100644 --- a/enos/enos-vars.hcl +++ b/enos/enos-vars.hcl @@ -29,7 +29,7 @@ variable "binary_local_path" { # Variables for the provision_cluster module variable "nomad_local_binary" { description = "The path to a local binary to provision" - default = "" + #default = "/Users/juanita.delacuestamorales/nomad" #TODO! } variable "nomad_license" { diff --git a/enos/modules/fetch_artifactory/locals.tf b/enos/modules/fetch_artifactory/locals.tf index 7f4b7492fc0..a93d74fb002 100644 --- a/enos/modules/fetch_artifactory/locals.tf +++ b/enos/modules/fetch_artifactory/locals.tf @@ -19,4 +19,5 @@ locals { } artifact_name = "nomad_${local.artifact_version}${local.package_extensions[var.arch][var.os]}" + artifact_zip = "nomad_${local.artifact_version}${local.package_extensions[var.arch][var.os]}.zip" } \ No newline at end of file diff --git a/enos/modules/fetch_artifactory/main.tf b/enos/modules/fetch_artifactory/main.tf index b413f6b238b..f4e045031ad 100644 --- a/enos/modules/fetch_artifactory/main.tf +++ b/enos/modules/fetch_artifactory/main.tf @@ -26,6 +26,7 @@ resource "enos_local_exec" "install_binary" { URL = data.enos_artifactory_item.nomad.results[0].url BINARY_PATH = var.binary_path TOKEN = var.artifactory_token + LOCAL_ZIP = local.artifact_zip } scripts = [abspath("${path.module}/scripts/install.sh")] diff --git a/enos/modules/fetch_artifactory/outputs.tf b/enos/modules/fetch_artifactory/outputs.tf index e335d514d3a..7d2259ea418 100644 --- a/enos/modules/fetch_artifactory/outputs.tf +++ b/enos/modules/fetch_artifactory/outputs.tf @@ -1,8 +1,8 @@ # Copyright (c) HashiCorp, Inc. # SPDX-License-Identifier: BUSL-1.1 -output "local_binary" { - value = var.binary_path +output "nomad_local_binary" { + value = "${var.binary_path}/${var.os}-${var.arch}-${var.edition}/nomad" description = "Path where the binary will be placed" } @@ -12,4 +12,5 @@ output "vault_artifactory_release" { url = data.enos_artifactory_item.nomad.results[0].url sha256 = data.enos_artifactory_item.nomad.results[0].sha256 } -} \ No newline at end of file +} + From fa80a76dae47fc895f1fab0f239d94bfe67da14a Mon Sep 17 00:00:00 2001 From: Juana De La Cuesta Date: Fri, 13 Dec 2024 17:41:12 +0100 Subject: [PATCH 13/15] Update compute.tf --- e2e/terraform/compute.tf | 3 --- 1 file changed, 3 deletions(-) diff --git a/e2e/terraform/compute.tf b/e2e/terraform/compute.tf index 920428c68c4..a8224ee7728 100644 --- a/e2e/terraform/compute.tf +++ b/e2e/terraform/compute.tf @@ -105,8 +105,6 @@ data "aws_ami" "ubuntu_jammy_amd64" { name = "tag:BuilderSha" values = [data.external.packer_sha.result["sha"]] } -<<<<<<< Updated upstream -======= } data "aws_ami" "ubuntu_jammy" { @@ -127,7 +125,6 @@ data "aws_ami" "ubuntu_jammy" { name = "tag:BuilderSha" values = [data.external.packer_sha.result["sha"]] } ->>>>>>> Stashed changes } data "aws_ami" "windows_2016_amd64" { From e5b4f260e1c300842e48eba945420967e4f20281 Mon Sep 17 00:00:00 2001 From: Juanadelacuesta <8647634+Juanadelacuesta@users.noreply.github.com> Date: Tue, 17 Dec 2024 09:30:56 -0500 Subject: [PATCH 14/15] move provision infra to its own module --- e2e/terraform/.terraform.lock.hcl | 240 ++++++++---------- e2e/terraform/main.tf | 36 +-- e2e/terraform/outputs.tf | 44 +--- .../{ => provision-infra}/compute.tf | 10 +- .../{ => provision-infra}/consul-clients.tf | 10 +- .../{ => provision-infra}/consul-servers.tf | 22 +- .../{ => provision-infra}/ecs-task.json | 0 e2e/terraform/{ => provision-infra}/ecs.tf | 0 e2e/terraform/{ => provision-infra}/ecs.tftpl | 0 .../{ => provision-infra}/hcp_vault.tf | 2 +- e2e/terraform/{ => provision-infra}/iam.tf | 0 e2e/terraform/provision-infra/main.tf | 30 +++ .../{ => provision-infra}/network.tf | 0 .../{ => provision-infra}/nomad-acls.tf | 8 +- e2e/terraform/{ => provision-infra}/nomad.tf | 0 e2e/terraform/provision-infra/outputs.tf | 61 +++++ .../etc/acls/consul/consul-agent-policy.hcl | 0 .../etc/acls/consul/nomad-client-policy.hcl | 0 .../etc/acls/consul/nomad-server-policy.hcl | 0 .../etc/acls/vault/nomad-policy.hcl | 0 .../provision-nomad/etc/consul.d/.environment | 0 .../provision-nomad/etc/consul.d/clients.hcl | 0 .../etc/consul.d/consul-server.service | 0 .../etc/consul.d/consul.service | 0 .../provision-nomad/etc/consul.d/servers.hcl | 0 .../provision-nomad/etc/nomad.d/.environment | 0 .../provision-nomad/etc/nomad.d/base.hcl | 0 .../etc/nomad.d/client-consul.hcl | 0 .../etc/nomad.d/client-linux-0.hcl | 0 .../etc/nomad.d/client-linux-1.hcl | 0 .../etc/nomad.d/client-linux-2.hcl | 0 .../etc/nomad.d/client-linux-3.hcl | 0 .../etc/nomad.d/client-linux.hcl | 0 .../etc/nomad.d/client-windows.hcl | 0 .../provision-nomad/etc/nomad.d/index.hcl | 0 .../etc/nomad.d/nomad-client.service | 0 .../etc/nomad.d/nomad-server.service | 0 .../etc/nomad.d/server-consul.hcl | 0 .../etc/nomad.d/server-linux.hcl | 0 .../provision-nomad/etc/nomad.d/tls.hcl | 0 .../provision-nomad/etc/nomad.d/vault.hcl | 0 .../provision-nomad/install-linux.tf | 0 .../provision-nomad/install-windows.tf | 0 .../provision-nomad/main.tf | 25 +- .../provision-nomad/tls.tf | 0 .../provision-nomad/variables.tf | 0 .../scripts/anonymous.nomad_policy.hcl | 0 .../scripts/bootstrap-consul.sh | 6 + .../scripts/bootstrap-nomad.sh | 0 .../scripts/consul-agents-policy.hcl | 0 .../scripts/nomad-cluster-consul-policy.hcl | 0 e2e/terraform/{ => provision-infra}/tls_ca.tf | 4 +- .../{ => provision-infra}/tls_client.tf | 8 +- .../{ => provision-infra}/userdata/README.md | 0 .../userdata/windows-2016.ps1 | 0 e2e/terraform/provision-infra/variables.tf | 122 +++++++++ .../{ => provision-infra}/versions.tf | 0 .../{ => provision-infra}/volumes.tf | 0 .../{ => provision-infra}/volumes.tftpl | 0 e2e/terraform/terraform.tfvars | 6 +- e2e/terraform/uploads/README.md | 6 - e2e/terraform/variables.tf | 3 - 62 files changed, 389 insertions(+), 254 deletions(-) rename e2e/terraform/{ => provision-infra}/compute.tf (97%) rename e2e/terraform/{ => provision-infra}/consul-clients.tf (83%) rename e2e/terraform/{ => provision-infra}/consul-servers.tf (85%) rename e2e/terraform/{ => provision-infra}/ecs-task.json (100%) rename e2e/terraform/{ => provision-infra}/ecs.tf (100%) rename e2e/terraform/{ => provision-infra}/ecs.tftpl (100%) rename e2e/terraform/{ => provision-infra}/hcp_vault.tf (95%) rename e2e/terraform/{ => provision-infra}/iam.tf (100%) create mode 100644 e2e/terraform/provision-infra/main.tf rename e2e/terraform/{ => provision-infra}/network.tf (100%) rename e2e/terraform/{ => provision-infra}/nomad-acls.tf (89%) rename e2e/terraform/{ => provision-infra}/nomad.tf (100%) create mode 100644 e2e/terraform/provision-infra/outputs.tf rename e2e/terraform/{ => provision-infra}/provision-nomad/etc/acls/consul/consul-agent-policy.hcl (100%) rename e2e/terraform/{ => provision-infra}/provision-nomad/etc/acls/consul/nomad-client-policy.hcl (100%) rename e2e/terraform/{ => provision-infra}/provision-nomad/etc/acls/consul/nomad-server-policy.hcl (100%) rename e2e/terraform/{ => provision-infra}/provision-nomad/etc/acls/vault/nomad-policy.hcl (100%) rename e2e/terraform/{ => provision-infra}/provision-nomad/etc/consul.d/.environment (100%) rename e2e/terraform/{ => provision-infra}/provision-nomad/etc/consul.d/clients.hcl (100%) rename e2e/terraform/{ => provision-infra}/provision-nomad/etc/consul.d/consul-server.service (100%) rename e2e/terraform/{ => provision-infra}/provision-nomad/etc/consul.d/consul.service (100%) rename e2e/terraform/{ => provision-infra}/provision-nomad/etc/consul.d/servers.hcl (100%) rename e2e/terraform/{ => provision-infra}/provision-nomad/etc/nomad.d/.environment (100%) rename e2e/terraform/{ => provision-infra}/provision-nomad/etc/nomad.d/base.hcl (100%) rename e2e/terraform/{ => provision-infra}/provision-nomad/etc/nomad.d/client-consul.hcl (100%) rename e2e/terraform/{ => provision-infra}/provision-nomad/etc/nomad.d/client-linux-0.hcl (100%) rename e2e/terraform/{ => provision-infra}/provision-nomad/etc/nomad.d/client-linux-1.hcl (100%) rename e2e/terraform/{ => provision-infra}/provision-nomad/etc/nomad.d/client-linux-2.hcl (100%) rename e2e/terraform/{ => provision-infra}/provision-nomad/etc/nomad.d/client-linux-3.hcl (100%) rename e2e/terraform/{ => provision-infra}/provision-nomad/etc/nomad.d/client-linux.hcl (100%) rename e2e/terraform/{ => provision-infra}/provision-nomad/etc/nomad.d/client-windows.hcl (100%) rename e2e/terraform/{ => provision-infra}/provision-nomad/etc/nomad.d/index.hcl (100%) rename e2e/terraform/{ => provision-infra}/provision-nomad/etc/nomad.d/nomad-client.service (100%) rename e2e/terraform/{ => provision-infra}/provision-nomad/etc/nomad.d/nomad-server.service (100%) rename e2e/terraform/{ => provision-infra}/provision-nomad/etc/nomad.d/server-consul.hcl (100%) rename e2e/terraform/{ => provision-infra}/provision-nomad/etc/nomad.d/server-linux.hcl (100%) rename e2e/terraform/{ => provision-infra}/provision-nomad/etc/nomad.d/tls.hcl (100%) rename e2e/terraform/{ => provision-infra}/provision-nomad/etc/nomad.d/vault.hcl (100%) rename e2e/terraform/{ => provision-infra}/provision-nomad/install-linux.tf (100%) rename e2e/terraform/{ => provision-infra}/provision-nomad/install-windows.tf (100%) rename e2e/terraform/{ => provision-infra}/provision-nomad/main.tf (85%) rename e2e/terraform/{ => provision-infra}/provision-nomad/tls.tf (100%) rename e2e/terraform/{ => provision-infra}/provision-nomad/variables.tf (100%) rename e2e/terraform/{ => provision-infra}/scripts/anonymous.nomad_policy.hcl (100%) rename e2e/terraform/{ => provision-infra}/scripts/bootstrap-consul.sh (76%) rename e2e/terraform/{ => provision-infra}/scripts/bootstrap-nomad.sh (100%) rename e2e/terraform/{ => provision-infra}/scripts/consul-agents-policy.hcl (100%) rename e2e/terraform/{ => provision-infra}/scripts/nomad-cluster-consul-policy.hcl (100%) rename e2e/terraform/{ => provision-infra}/tls_ca.tf (88%) rename e2e/terraform/{ => provision-infra}/tls_client.tf (89%) rename e2e/terraform/{ => provision-infra}/userdata/README.md (100%) rename e2e/terraform/{ => provision-infra}/userdata/windows-2016.ps1 (100%) create mode 100644 e2e/terraform/provision-infra/variables.tf rename e2e/terraform/{ => provision-infra}/versions.tf (100%) rename e2e/terraform/{ => provision-infra}/volumes.tf (100%) rename e2e/terraform/{ => provision-infra}/volumes.tftpl (100%) delete mode 100644 e2e/terraform/uploads/README.md diff --git a/e2e/terraform/.terraform.lock.hcl b/e2e/terraform/.terraform.lock.hcl index 5cef68f560c..61a1d91478f 100644 --- a/e2e/terraform/.terraform.lock.hcl +++ b/e2e/terraform/.terraform.lock.hcl @@ -2,176 +2,156 @@ # Manual edits may be lost in future updates. provider "registry.terraform.io/hashicorp/aws" { - version = "4.10.0" + version = "5.81.0" hashes = [ - "h1:3zeyl8QwNYPXRD4b++0Vo9nBcsL3FXT+DT3x/KJNKB0=", - "h1:F9BjbxBhuo1A/rP318IUrkW3TAh29i6UC18qwhzCs6c=", - "h1:S6xGPRL08YEuBdemiYZyIBf/YwM4OCvzVuaiuU6kLjc=", - "h1:pjPLizna1qa/CZh7HvLuQ73YmqaunLXatyOqzF2ePEI=", - "zh:0a2a7eabfeb7dbb17b7f82aff3fa2ba51e836c15e5be4f5468ea44bd1299b48d", - "zh:23409c7205d13d2d68b5528e1c49e0a0455d99bbfec61eb0201142beffaa81f7", - "zh:3adad2245d97816f3919778b52c58fb2de130938a3e9081358bfbb72ec478d9a", - "zh:5bf100aba6332f24b1ffeae7536d5d489bb907bf774a06b95f2183089eaf1a1a", - "zh:63c3a24c0c229a1d3390e6ea2454ba4d8ace9b94e086bee1dbdcf665ae969e15", - "zh:6b76f5ffd920f0a750da3a4ff1d00eab18d9cd3731b009aae3df4135613bad4d", - "zh:8cd6b1e6b51e8e9bbe2944bb169f113d20d1d72d07ccd1b7b83f40b3c958233e", + "h1:YoOBDt9gdoivbUh1iGoZNqRBUdBO+PBAxpSZFeTLLYE=", + "zh:05534adf6f02d6ec26dbeb37a4d2b6edb63f12dc9ab5cc05ab89329fcd793194", + "zh:1d224056866abc4c8f893d55bc6493b73688126fbeaf017ecfbcf5d2f16649c4", + "zh:486d28a0a4af2ea23964a8e9087d66e8d794e3438976633b8554684a9237499d", + "zh:4bc17c2e93034099b64eb94eaea31b48888b6abdf170e26cf0f6ea734926084c", + "zh:5c48c8e82fa8c410499eaa5980c0ebcf6a42360742dfd695393eb9b0bffd4232", + "zh:60c387caa94d67e0b768f5874abbd103638c4c9b14073b6cd121018efdfc77bc", + "zh:72ddd5e5e07aac1c1c54659df238e6490aac3abbd2e4f13ccf7a9d877c2e2d0f", + "zh:8b03d7c4e23a51c9d323f24784d6bfd044f03e6e512df8d458abc97c943a3d3e", + "zh:93b6a3c3299fc67d349f8ab80a9b6b65e0e9f3a7e7ea3da0cd87e3ca3b48137b", + "zh:9982fc3885797ee97aa45ac7eba0fe6870220748bfa3091141ff513dd7583809", "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", - "zh:c5c31f58fb5bd6aebc6c662a4693640ec763cb3399cce0b592101cf24ece1625", - "zh:cc485410be43d6ad95d81b9e54cc4d2117aadf9bf5941165a9df26565d9cce42", - "zh:cebb89c74b6a3dc6780824b1d1e2a8d16a51e75679e14ad0b830d9f7da1a3a67", - "zh:e7dc427189cb491e1f96e295101964415cbf8630395ee51e396d2a811f365237", + "zh:b7d60f8527dbffe11c83a05b63459d18fda921616242246a73cf3044b8732bcf", + "zh:be7a57524298df3c377cdd676e691500277a423ac50f7b33dd02b7d6f4e924fd", + "zh:c6ae0b1510804c705aab99659f228bdbafa663fa72ace50c811c0b9220c7dafb", + "zh:cdf524a269b4aeb5b1f081d91f54bae967ad50d9c392073a0db1602166a48dff", ] } provider "registry.terraform.io/hashicorp/external" { - version = "2.2.2" + version = "2.3.4" hashes = [ - "h1:/Qsdu8SIXbfANKJFs1UTAfvcomJUalOd3uDZvj3jixA=", - "h1:BKQ5f5ijzeyBSnUr+j0wUi+bYv6KBQVQNDXNRVEcfJE=", - "h1:VUkgcWvCliS0HO4kt7oEQhFD2gcx/59XpwMqxfCU1kE=", - "h1:e7RpnZ2PbJEEPnfsg7V0FNwbfSk0/Z3FdrLsXINBmDY=", - "zh:0b84ab0af2e28606e9c0c1289343949339221c3ab126616b831ddb5aaef5f5ca", - "zh:10cf5c9b9524ca2e4302bf02368dc6aac29fb50aeaa6f7758cce9aa36ae87a28", - "zh:56a016ee871c8501acb3f2ee3b51592ad7c3871a1757b098838349b17762ba6b", - "zh:719d6ef39c50e4cffc67aa67d74d195adaf42afcf62beab132dafdb500347d39", + "h1:cCabxnWQ5fX1lS7ZqgUzsvWmKZw9FA7NRxAZ94vcTcc=", + "zh:037fd82cd86227359bc010672cd174235e2d337601d4686f526d0f53c87447cb", + "zh:0ea1db63d6173d01f2fa8eb8989f0809a55135a0d8d424b08ba5dabad73095fa", + "zh:17a4d0a306566f2e45778fbac48744b6fd9c958aaa359e79f144c6358cb93af0", + "zh:298e5408ab17fd2e90d2cd6d406c6d02344fe610de5b7dae943a58b958e76691", + "zh:38ecfd29ee0785fd93164812dcbe0664ebbe5417473f3b2658087ca5a0286ecb", + "zh:59f6a6f31acf66f4ea3667a555a70eba5d406c6e6d93c2c641b81d63261eeace", "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", - "zh:7fbfc4d37435ac2f717b0316f872f558f608596b389b895fcb549f118462d327", - "zh:8ac71408204db606ce63fe8f9aeaf1ddc7751d57d586ec421e62d440c402e955", - "zh:a4cacdb06f114454b6ed0033add28006afa3f65a0ea7a43befe45fc82e6809fb", - "zh:bb5ce3132b52ae32b6cc005bc9f7627b95259b9ffe556de4dad60d47d47f21f0", - "zh:bb60d2976f125ffd232a7ccb4b3f81e7109578b23c9c6179f13a11d125dca82a", - "zh:f9540ecd2e056d6e71b9ea5f5a5cf8f63dd5c25394b9db831083a9d4ea99b372", - "zh:ffd998b55b8a64d4335a090b6956b4bf8855b290f7554dd38db3302de9c41809", + "zh:ad0279dfd09d713db0c18469f585e58d04748ca72d9ada83883492e0dd13bd58", + "zh:c69f66fd21f5e2c8ecf7ca68d9091c40f19ad913aef21e3ce23836e91b8cbb5f", + "zh:d4a56f8c48aa86fc8e0c233d56850f5783f322d6336f3bf1916e293246b6b5d4", + "zh:f2b394ebd4af33f343835517e80fc876f79361f4688220833bc3c77655dd2202", + "zh:f31982f29f12834e5d21e010856eddd19d59cd8f449adf470655bfd19354377e", ] } provider "registry.terraform.io/hashicorp/hcp" { - version = "0.26.0" + version = "0.100.0" hashes = [ - "h1:B5O/NawTnKPdUgUlGP/mM2ybv0RcLvVJVOcrivDdFnI=", - "h1:C0KoYT09Ff91pE5KzrFrISCE5wQyJaJnxPdA0SXDOzI=", - "h1:f4IwCK9heo5F+k+nRFY/fzG18DesbBcqRL8F4WsKh7Q=", - "h1:fCHcXVlT/MoAqvIUjFyJqtGrz+ebHNCcR1YM2ZSRPxE=", - "zh:0fa82a384b25a58b65523e0ea4768fa1212b1f5cfc0c9379d31162454fedcc9d", - "zh:6fa5415dbac9c8d20026772dd5aee7dd3ac541e9d86827d0b70bc752472ec76c", - "zh:7490212c32339153165aec1dcef063804aac0d3f1cfbdfd3d04d7a60c29b0f40", - "zh:792e8fbe630159105801a471c46c988d94636637c1e5cdb725956cab4e664c87", - "zh:9e460a3e4735ff24f2fc1c445fce54e4ed596c8dc97f683f5cefa93fb2be9b14", - "zh:a124e8366fdf10d17a0b2860151beb00e12d8c33860fcc661547d0239138d3fb", - "zh:a9b9cb4d077f8d8bcc22c813aea820c224228807f34e2e3716d30c84ce63c53a", - "zh:aae6a8e87c6c64bb33311ef658993a5cc8398aac8dcb2c18953bd9e96a2e0011", - "zh:dc2e83b8f4ca2d4aa2e0b5cc98b9c298c1cf5c583d323320c85d4f06f8f4b43c", - "zh:e17b1c7ef80c3507c892d343282c61dc58ab45978481ee004843f1746f6b791c", - "zh:ee35efe2628aca5f259f3fee8db15accfdced1a5530f01c8a23f59e5ed5dcb7a", - "zh:f8173393330eb376b7357f8271d1c75e0850905dceb32ce482af58e112894278", + "h1:VN4+cxeAeAcDsq0X2wvGezrtX5SL6hNHp0UE73X8lQo=", + "zh:04014e6a3bbe7edcb09581c17f539071110b9cd42b1775a57698a91d21c36ee9", + "zh:07aa155c838ae2cf204a1878d6bf0683d9f341933e0d2ec5d6d0b05dd18f3bd3", + "zh:24cab0cf4f6a39c5b328d22543e6ae43bae81ba87029b534403bd00a50e9c4aa", + "zh:47a5949f0bcee6ea60dbcd3a327ac5322deb6fead95d4ec0388deef37351a59d", + "zh:541d4532c875b2ee7ecb98da9a1461e76788893b623b0adf7c634d9fff7770e3", + "zh:55e9e488433f2966cdf8dccf48d3089400f9a473be268dafd74680de889bcb51", + "zh:6851703ab97769b716e03b57ac949c5f4c5fabba83dbb9ffc1b4acdb9b6e77f2", + "zh:695eb5c8ccc79fd3596718ad4a3f9056e32bb8943d1bc3fe434f5981819a3e94", + "zh:7054ec9f4862a39fba0466f80a8c8e6cc649f0acfb57507733deac665ddf8445", + "zh:998f10aeae79826061f268d9dd930d20648d27e670959cbae3eae69ca1292c9e", + "zh:a0f253eed2d92dffa0f3048b6e697511941f0600317cb14643d70b960b1774c9", + "zh:cbbd5b0ce08327b2f7ffd4dc63d8eb8c91e0b83db55deb9ae439076bd7b8af07", ] } provider "registry.terraform.io/hashicorp/local" { - version = "2.2.2" + version = "2.5.2" hashes = [ - "h1:5UYW2wJ320IggrzLt8tLD6MowePqycWtH1b2RInHZkE=", - "h1:BVEZnjtpWxKPG9OOQh4dFa1z5pwMO/uuzYtu6AR2LyM=", - "h1:S6nf97sybBugc8FtrOSPXaynEKx0gO6Oktu6KJzvdDU=", - "h1:SjDyZXIUHEQzZe10VjhlhZq2a9kgQB6tmqJcpq2BeWg=", - "zh:027e4873c69da214e2fed131666d5de92089732a11d096b68257da54d30b6f9d", - "zh:0ba2216e16cfb72538d76a4c4945b4567a76f7edbfef926b1c5a08d7bba2a043", - "zh:1fee8f6aae1833c27caa96e156cf99a681b6f085e476d7e1b77d285e21d182c1", - "zh:2e8a3e72e877003df1c390a231e0d8e827eba9f788606e643f8e061218750360", - "zh:719008f9e262aa1523a6f9132adbe9eee93c648c2981f8359ce41a40e6425433", + "h1:IyFbOIO6mhikFNL/2h1iZJ6kyN3U00jgkpCLUCThAfE=", + "zh:136299545178ce281c56f36965bf91c35407c11897f7082b3b983d86cb79b511", + "zh:3b4486858aa9cb8163378722b642c57c529b6c64bfbfc9461d940a84cd66ebea", + "zh:4855ee628ead847741aa4f4fc9bed50cfdbf197f2912775dd9fe7bc43fa077c0", + "zh:4b8cd2583d1edcac4011caafe8afb7a95e8110a607a1d5fb87d921178074a69b", + "zh:52084ddaff8c8cd3f9e7bcb7ce4dc1eab00602912c96da43c29b4762dc376038", + "zh:71562d330d3f92d79b2952ffdda0dad167e952e46200c767dd30c6af8d7c0ed3", "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", - "zh:9a70fdbe6ef955c4919a4519caca116f34c19c7ddedd77990fbe4f80fe66dc84", - "zh:abc412423d670cbb6264827fa80e1ffdc4a74aff3f19ba6a239dd87b85b15bec", - "zh:ae953a62c94d2a2a0822e5717fafc54e454af57bd6ed02cd301b9786765c1dd3", - "zh:be0910bdf46698560f9e86f51a4ff795c62c02f8dc82b2b1dab77a0b3a93f61e", - "zh:e58f9083b7971919b95f553227adaa7abe864fce976f0166cf4d65fc17257ff2", - "zh:ff4f77cbdbb22cc98182821c7ef84dce16298ab0e997d5c7fae97247f7a4bcb0", + "zh:805f81ade06ff68fa8b908d31892eaed5c180ae031c77ad35f82cb7a74b97cf4", + "zh:8b6b3ebeaaa8e38dd04e56996abe80db9be6f4c1df75ac3cccc77642899bd464", + "zh:ad07750576b99248037b897de71113cc19b1a8d0bc235eb99173cc83d0de3b1b", + "zh:b9f1c3bfadb74068f5c205292badb0661e17ac05eb23bfe8bd809691e4583d0e", + "zh:cc4cbcd67414fefb111c1bf7ab0bc4beb8c0b553d01719ad17de9a047adff4d1", ] } provider "registry.terraform.io/hashicorp/null" { - version = "3.1.1" + version = "3.2.3" hashes = [ - "h1:71sNUDvmiJcijsvfXpiLCz0lXIBSsEJjMxljt7hxMhw=", - "h1:Pctug/s/2Hg5FJqjYcTM0kPyx3AoYK1MpRWO0T9V2ns=", - "h1:YvH6gTaQzGdNv+SKTZujU1O0bO+Pw6vJHOPhqgN8XNs=", - "h1:ZD4wyZ0KJzt5s2mD0xD7paJlVONNicLvZKdgtezz02I=", - "zh:063466f41f1d9fd0dd93722840c1314f046d8760b1812fa67c34de0afcba5597", - "zh:08c058e367de6debdad35fc24d97131c7cf75103baec8279aba3506a08b53faf", - "zh:73ce6dff935150d6ddc6ac4a10071e02647d10175c173cfe5dca81f3d13d8afe", + "h1:I0Um8UkrMUb81Fxq/dxbr3HLP2cecTH2WMJiwKSrwQY=", + "zh:22d062e5278d872fe7aed834f5577ba0a5afe34a3bdac2b81f828d8d3e6706d2", + "zh:23dead00493ad863729495dc212fd6c29b8293e707b055ce5ba21ee453ce552d", + "zh:28299accf21763ca1ca144d8f660688d7c2ad0b105b7202554ca60b02a3856d3", + "zh:55c9e8a9ac25a7652df8c51a8a9a422bd67d784061b1de2dc9fe6c3cb4e77f2f", + "zh:756586535d11698a216291c06b9ed8a5cc6a4ec43eee1ee09ecd5c6a9e297ac1", "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", - "zh:8fdd792a626413502e68c195f2097352bdc6a0df694f7df350ed784741eb587e", - "zh:976bbaf268cb497400fd5b3c774d218f3933271864345f18deebe4dcbfcd6afa", - "zh:b21b78ca581f98f4cdb7a366b03ae9db23a73dfa7df12c533d7c19b68e9e72e5", - "zh:b7fc0c1615dbdb1d6fd4abb9c7dc7da286631f7ca2299fb9cd4664258ccfbff4", - "zh:d1efc942b2c44345e0c29bc976594cb7278c38cfb8897b344669eafbc3cddf46", - "zh:e356c245b3cd9d4789bab010893566acace682d7db877e52d40fc4ca34a50924", - "zh:ea98802ba92fcfa8cf12cbce2e9e7ebe999afbf8ed47fa45fc847a098d89468b", - "zh:eff8872458806499889f6927b5d954560f3d74bf20b6043409edf94d26cd906f", + "zh:9d5eea62fdb587eeb96a8c4d782459f4e6b73baeece4d04b4a40e44faaee9301", + "zh:a6355f596a3fb8fc85c2fb054ab14e722991533f87f928e7169a486462c74670", + "zh:b5a65a789cff4ada58a5baffc76cb9767dc26ec6b45c00d2ec8b1b027f6db4ed", + "zh:db5ab669cf11d0e9f81dc380a6fdfcac437aea3d69109c7aef1a5426639d2d65", + "zh:de655d251c470197bcbb5ac45d289595295acb8f829f6c781d4a75c8c8b7c7dd", + "zh:f5c68199f2e6076bce92a12230434782bf768103a427e9bb9abee99b116af7b5", ] } provider "registry.terraform.io/hashicorp/random" { - version = "3.1.2" + version = "3.6.3" hashes = [ - "h1:5A5VsY5wNmOZlupUcLnIoziMPn8htSZBXbP3lI7lBEM=", - "h1:9A6Ghjgad0KjJRxa6nPo8i8uFvwj3Vv0wnEgy49u+24=", - "h1:JF+aiOtS0G0ffbBdk1qfj7IrT39y/GZh/yl2IhqcIVM=", - "h1:hxN/z2AVJkF2ei7bfevJdD1B0WfyABxxk9j1zzLsLRk=", - "zh:0daceba867b330d3f8e2c5dc895c4291845a78f31955ce1b91ab2c4d1cd1c10b", - "zh:104050099efd30a630741f788f9576b19998e7a09347decbec3da0b21d64ba2d", - "zh:173f4ef3fdf0c7e2564a3db0fac560e9f5afdf6afd0b75d6646af6576b122b16", - "zh:41d50f975e535f968b3f37170fb07937c15b76d85ba947d0ce5e5ff9530eda65", - "zh:51a5038867e5e60757ed7f513dd6a973068241190d158a81d1b69296efb9cb8d", - "zh:6432a568e97a5a36cc8aebca5a7e9c879a55d3bc71d0da1ab849ad905f41c0be", - "zh:6bac6501394b87138a5e17c9f3a41e46ff7833ad0ba2a96197bb7787e95b641c", - "zh:6c0a7f5faacda644b022e7718e53f5868187435be6d000786d1ca05aa6683a25", - "zh:74c89de3fa6ef3027efe08f8473c2baeb41b4c6cee250ba7aeb5b64e8c79800d", + "h1:zG9uFP8l9u+yGZZvi5Te7PV62j50azpgwPunq2vTm1E=", + "zh:04ceb65210251339f07cd4611885d242cd4d0c7306e86dda9785396807c00451", + "zh:448f56199f3e99ff75d5c0afacae867ee795e4dfda6cb5f8e3b2a72ec3583dd8", + "zh:4b4c11ccfba7319e901df2dac836b1ae8f12185e37249e8d870ee10bb87a13fe", + "zh:4fa45c44c0de582c2edb8a2e054f55124520c16a39b2dfc0355929063b6395b1", + "zh:588508280501a06259e023b0695f6a18149a3816d259655c424d068982cbdd36", + "zh:737c4d99a87d2a4d1ac0a54a73d2cb62974ccb2edbd234f333abd079a32ebc9e", "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", - "zh:b29eabbf0a5298f0e95a1df214c7cfe06ea9bcf362c63b3ad2f72d85da7d4685", - "zh:e891458c7a61e5b964e09616f1a4f87d0471feae1ec04cc51776e7dec1a3abce", + "zh:a357ab512e5ebc6d1fda1382503109766e21bbfdfaa9ccda43d313c122069b30", + "zh:c51bfb15e7d52cc1a2eaec2a903ac2aff15d162c172b1b4c17675190e8147615", + "zh:e0951ee6fa9df90433728b96381fb867e3db98f66f735e0c3e24f8f16903f0ad", + "zh:e3cdcb4e73740621dabd82ee6a37d6cfce7fee2a03d8074df65086760f5cf556", + "zh:eff58323099f1bd9a0bec7cb04f717e7f1b2774c7d612bf7581797e1622613a0", ] } provider "registry.terraform.io/hashicorp/tls" { - version = "3.3.0" + version = "4.0.6" hashes = [ - "h1:A4xOtHhD4jCmn4nO1xCTk2Nl5IP5JpjicjF+Fuu2ZFQ=", - "h1:Uf8HqbZjYn8pKB0og2H9A8IXIKtHT+o8BE3+fjtO1ZQ=", - "h1:oitTcxYGyDvHuNsjPJUi00a+AT0k+TWgNsGUSM2CV/E=", - "h1:xx/b39Q9FVZSlDc97rlDmQ9dNaaxFFyVzP9kV+47z28=", - "zh:16140e8cc880f95b642b6bf6564f4e98760e9991864aacc8e21273423571e561", - "zh:16338b8457759c97fdd73153965d6063b037f2954fd512e569fcdc42b7fef743", - "zh:348bd44b7cd0c6d663bba36cecb474c17635a8f22b02187d034b8e57a8729c5a", - "zh:3832ac73c2335c0fac26138bacbd18160efaa3f06c562869acc129e814e27f86", - "zh:756d1e60690d0164eee9c93b498b4c8beabbfc1d8b7346cb6d2fa719055089d6", - "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", - "zh:93b911bcddba8dadc5339edb004c8019c230ea67477c73c4f741c236dd9511b1", - "zh:c0c4e5742e8ac004c507540423db52af3f44b8ec04443aa8e14669340819344f", - "zh:c78296a1dff8ccd5d50203aac353422fc18d425072ba947c88cf5b46de7d32d2", - "zh:d7143f444e0f7e6cd67fcaf080398b4f1487cf05de3e0e79af6c14e22812e38b", - "zh:e600ac76b118816ad72132eee4c22ab5fc044f67c3babc54537e1fc1ad53d295", - "zh:fca07af5f591e12d2dc178a550da69a4847bdb34f8180a5b8e04fde6b528cf99", + "h1:n3M50qfWfRSpQV9Pwcvuse03pEizqrmYEryxKky4so4=", + "zh:10de0d8af02f2e578101688fd334da3849f56ea91b0d9bd5b1f7a243417fdda8", + "zh:37fc01f8b2bc9d5b055dc3e78bfd1beb7c42cfb776a4c81106e19c8911366297", + "zh:4578ca03d1dd0b7f572d96bd03f744be24c726bfd282173d54b100fd221608bb", + "zh:6c475491d1250050765a91a493ef330adc24689e8837a0f07da5a0e1269e11c1", + "zh:81bde94d53cdababa5b376bbc6947668be4c45ab655de7aa2e8e4736dfd52509", + "zh:abdce260840b7b050c4e401d4f75c7a199fafe58a8b213947a258f75ac18b3e8", + "zh:b754cebfc5184873840f16a642a7c9ef78c34dc246a8ae29e056c79939963c7a", + "zh:c928b66086078f9917aef0eec15982f2e337914c5c4dbc31dd4741403db7eb18", + "zh:cded27bee5f24de6f2ee0cfd1df46a7f88e84aaffc2ecbf3ff7094160f193d50", + "zh:d65eb3867e8f69aaf1b8bb53bd637c99c6b649ba3db16ded50fa9a01076d1a27", + "zh:ecb0c8b528c7a619fa71852bb3fb5c151d47576c5aab2bf3af4db52588722eeb", + "zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c", ] } provider "registry.terraform.io/hashicorp/vault" { - version = "3.4.1" + version = "4.5.0" hashes = [ - "h1:HIjd/7KktGO5E/a0uICbIanUj0Jdd0j8aL/r+QxFhAs=", - "h1:X8P4B/zB97Dtj21qp0Rrswlz92WYCA5C59jpYGZeQuc=", - "h1:dXJBo807u69+Uib2hjoBQ68G2+nGXcNZeq/THVyQQVc=", - "h1:oow6cAwKiFpJBBWKsDqNmwZIrFTWWvoeIbqs+vyUDE0=", - "zh:1eb8370a1846e34e2bcc4d11eece5733735784a8eab447bbed3cfd822101b577", - "zh:2df3989327cea68b2167514b7ebddc67b09340f00bbf3fa85df03c97adfb9d25", - "zh:3dd1e317264f574985e856296deef71a76464918bf0566eb0d7f6389ea0586bd", - "zh:9750861f2822482aa608ea5a52b385bc42b2e1f2511094e6a975412618c4495d", - "zh:9b940e7f78975d29a4d0a116cf43c0bc1cb03bec4ad8d34887d64e6e60bacb9e", - "zh:9cb6e7ad2a62529d35dacd20695d49c2f02230cb785d46178cc10f4ec80e5a51", - "zh:a12718689bbcb37bcbb9132c18bffd354fad8ab5c8cb89cec1a0ee85c65b8cb7", - "zh:a6e38afacca1af4fab04a9f2dc49b8295eb462db68bdc7451352d0f950f804f8", - "zh:d6e0e994d51b9e07d5713d4796381f9e129e9de962e79caae2b7055f6f68297e", - "zh:ea4bbef7a1bb2553db473fa304c93845674167b61e8c9677107a96c8c696da12", - "zh:f985a8b7f4ef7d1eba9cef7d99997ee9c4a54ffe76dab7fa8b1fdec2a9edca7e", + "h1:jRi7YgsrO1Km4n/WkU+UOD98BM8mv+ckAxO/9gph2Kk=", + "zh:0a9301aa6a9b59db97682be568329526033bb50a4a308ad695c2a1877c1241c3", + "zh:0f8fee69ea4eaa27b86a391edc7de8e8b215e3c48f7074bab799986d5f707014", + "zh:2a2e51fe280e07700920bc8ed29b77e5c79fada0e4d5315d55ec0d2893bb5eed", + "zh:3fc7d9016bebe26a4c779ce6b87b181ed6a1af12499419726b8b0a0e3eaa7234", + "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", + "zh:813a9e4875e58dbca2526b3088c0f76dbb2a66b10b910497a0b703518eaa73cd", + "zh:889ed6f21b94f89b8cbc4224454ced01a2792f12f53379d2fb1a2f2749bf624a", + "zh:acf9c01d403584015005083e64d8479d167e4f54e87e540311010133fcb5b023", + "zh:b377945a4b6a75c79793cb92c873aacc9c087c2a6e5792a1613f3aa2f3693848", + "zh:be243567b2a76ba2a546449e89764f707477cf25dcdd6d7f3b808ddf40aaf9f6", + "zh:d879fa16f391fb75b779067c751f3b8f80f5f4d73b2ff86814662038878a0ce4", + "zh:e47fb3daac933f5dcb034379fe77c0bf834512da7348e7643457c9af3b2ab36b", ] } diff --git a/e2e/terraform/main.tf b/e2e/terraform/main.tf index f6e84ef5e23..ac2a4e84550 100644 --- a/e2e/terraform/main.tf +++ b/e2e/terraform/main.tf @@ -1,34 +1,12 @@ -# Copyright (c) HashiCorp, Inc. -# SPDX-License-Identifier: BUSL-1.1 - provider "aws" { region = var.region } -data "aws_caller_identity" "current" { -} - -resource "random_pet" "e2e" { -} - -resource "random_password" "windows_admin_password" { - length = 20 - special = true - override_special = "_%@" -} +module "provision-infra" { + source = "./provision-infra" -locals { - random_name = "${var.name}-${random_pet.e2e.id}" -} - -# Generates keys to use for provisioning and access -module "keys" { - name = local.random_name - path = "${path.root}/keys" - source = "mitchellh/dynamic-keys/aws" - version = "v2.0.0" -} - -data "aws_kms_alias" "e2e" { - name = "alias/${var.aws_kms_alias}" -} + server_count = var.client_count_linux + client_count_linux = var.client_count_linux + client_count_windows_2016_amd64 = var.client_count_windows_2016_amd64 + nomad_local_binary = var.nomad_local_binary +} \ No newline at end of file diff --git a/e2e/terraform/outputs.tf b/e2e/terraform/outputs.tf index c50436ef857..9ebe44b55fa 100644 --- a/e2e/terraform/outputs.tf +++ b/e2e/terraform/outputs.tf @@ -2,43 +2,19 @@ # SPDX-License-Identifier: BUSL-1.1 output "servers" { - value = aws_instance.server.*.public_ip + value = module.provision-infra.servers } output "linux_clients" { - value = aws_instance.client_ubuntu_jammy.*.public_ip + value = module.provision-infra.linux_clients } output "windows_clients" { - value = aws_instance.client_windows_2016_amd64.*.public_ip + value = module.provision-infra.windows_clients } output "message" { - value = < Date: Tue, 17 Dec 2024 15:49:25 +0100 Subject: [PATCH 15/15] Delete e2e/terraform/.terraform.lock.hcl --- e2e/terraform/.terraform.lock.hcl | 157 ------------------------------ 1 file changed, 157 deletions(-) delete mode 100644 e2e/terraform/.terraform.lock.hcl diff --git a/e2e/terraform/.terraform.lock.hcl b/e2e/terraform/.terraform.lock.hcl deleted file mode 100644 index 61a1d91478f..00000000000 --- a/e2e/terraform/.terraform.lock.hcl +++ /dev/null @@ -1,157 +0,0 @@ -# This file is maintained automatically by "terraform init". -# Manual edits may be lost in future updates. - -provider "registry.terraform.io/hashicorp/aws" { - version = "5.81.0" - hashes = [ - "h1:YoOBDt9gdoivbUh1iGoZNqRBUdBO+PBAxpSZFeTLLYE=", - "zh:05534adf6f02d6ec26dbeb37a4d2b6edb63f12dc9ab5cc05ab89329fcd793194", - "zh:1d224056866abc4c8f893d55bc6493b73688126fbeaf017ecfbcf5d2f16649c4", - "zh:486d28a0a4af2ea23964a8e9087d66e8d794e3438976633b8554684a9237499d", - "zh:4bc17c2e93034099b64eb94eaea31b48888b6abdf170e26cf0f6ea734926084c", - "zh:5c48c8e82fa8c410499eaa5980c0ebcf6a42360742dfd695393eb9b0bffd4232", - "zh:60c387caa94d67e0b768f5874abbd103638c4c9b14073b6cd121018efdfc77bc", - "zh:72ddd5e5e07aac1c1c54659df238e6490aac3abbd2e4f13ccf7a9d877c2e2d0f", - "zh:8b03d7c4e23a51c9d323f24784d6bfd044f03e6e512df8d458abc97c943a3d3e", - "zh:93b6a3c3299fc67d349f8ab80a9b6b65e0e9f3a7e7ea3da0cd87e3ca3b48137b", - "zh:9982fc3885797ee97aa45ac7eba0fe6870220748bfa3091141ff513dd7583809", - "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", - "zh:b7d60f8527dbffe11c83a05b63459d18fda921616242246a73cf3044b8732bcf", - "zh:be7a57524298df3c377cdd676e691500277a423ac50f7b33dd02b7d6f4e924fd", - "zh:c6ae0b1510804c705aab99659f228bdbafa663fa72ace50c811c0b9220c7dafb", - "zh:cdf524a269b4aeb5b1f081d91f54bae967ad50d9c392073a0db1602166a48dff", - ] -} - -provider "registry.terraform.io/hashicorp/external" { - version = "2.3.4" - hashes = [ - "h1:cCabxnWQ5fX1lS7ZqgUzsvWmKZw9FA7NRxAZ94vcTcc=", - "zh:037fd82cd86227359bc010672cd174235e2d337601d4686f526d0f53c87447cb", - "zh:0ea1db63d6173d01f2fa8eb8989f0809a55135a0d8d424b08ba5dabad73095fa", - "zh:17a4d0a306566f2e45778fbac48744b6fd9c958aaa359e79f144c6358cb93af0", - "zh:298e5408ab17fd2e90d2cd6d406c6d02344fe610de5b7dae943a58b958e76691", - "zh:38ecfd29ee0785fd93164812dcbe0664ebbe5417473f3b2658087ca5a0286ecb", - "zh:59f6a6f31acf66f4ea3667a555a70eba5d406c6e6d93c2c641b81d63261eeace", - "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", - "zh:ad0279dfd09d713db0c18469f585e58d04748ca72d9ada83883492e0dd13bd58", - "zh:c69f66fd21f5e2c8ecf7ca68d9091c40f19ad913aef21e3ce23836e91b8cbb5f", - "zh:d4a56f8c48aa86fc8e0c233d56850f5783f322d6336f3bf1916e293246b6b5d4", - "zh:f2b394ebd4af33f343835517e80fc876f79361f4688220833bc3c77655dd2202", - "zh:f31982f29f12834e5d21e010856eddd19d59cd8f449adf470655bfd19354377e", - ] -} - -provider "registry.terraform.io/hashicorp/hcp" { - version = "0.100.0" - hashes = [ - "h1:VN4+cxeAeAcDsq0X2wvGezrtX5SL6hNHp0UE73X8lQo=", - "zh:04014e6a3bbe7edcb09581c17f539071110b9cd42b1775a57698a91d21c36ee9", - "zh:07aa155c838ae2cf204a1878d6bf0683d9f341933e0d2ec5d6d0b05dd18f3bd3", - "zh:24cab0cf4f6a39c5b328d22543e6ae43bae81ba87029b534403bd00a50e9c4aa", - "zh:47a5949f0bcee6ea60dbcd3a327ac5322deb6fead95d4ec0388deef37351a59d", - "zh:541d4532c875b2ee7ecb98da9a1461e76788893b623b0adf7c634d9fff7770e3", - "zh:55e9e488433f2966cdf8dccf48d3089400f9a473be268dafd74680de889bcb51", - "zh:6851703ab97769b716e03b57ac949c5f4c5fabba83dbb9ffc1b4acdb9b6e77f2", - "zh:695eb5c8ccc79fd3596718ad4a3f9056e32bb8943d1bc3fe434f5981819a3e94", - "zh:7054ec9f4862a39fba0466f80a8c8e6cc649f0acfb57507733deac665ddf8445", - "zh:998f10aeae79826061f268d9dd930d20648d27e670959cbae3eae69ca1292c9e", - "zh:a0f253eed2d92dffa0f3048b6e697511941f0600317cb14643d70b960b1774c9", - "zh:cbbd5b0ce08327b2f7ffd4dc63d8eb8c91e0b83db55deb9ae439076bd7b8af07", - ] -} - -provider "registry.terraform.io/hashicorp/local" { - version = "2.5.2" - hashes = [ - "h1:IyFbOIO6mhikFNL/2h1iZJ6kyN3U00jgkpCLUCThAfE=", - "zh:136299545178ce281c56f36965bf91c35407c11897f7082b3b983d86cb79b511", - "zh:3b4486858aa9cb8163378722b642c57c529b6c64bfbfc9461d940a84cd66ebea", - "zh:4855ee628ead847741aa4f4fc9bed50cfdbf197f2912775dd9fe7bc43fa077c0", - "zh:4b8cd2583d1edcac4011caafe8afb7a95e8110a607a1d5fb87d921178074a69b", - "zh:52084ddaff8c8cd3f9e7bcb7ce4dc1eab00602912c96da43c29b4762dc376038", - "zh:71562d330d3f92d79b2952ffdda0dad167e952e46200c767dd30c6af8d7c0ed3", - "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", - "zh:805f81ade06ff68fa8b908d31892eaed5c180ae031c77ad35f82cb7a74b97cf4", - "zh:8b6b3ebeaaa8e38dd04e56996abe80db9be6f4c1df75ac3cccc77642899bd464", - "zh:ad07750576b99248037b897de71113cc19b1a8d0bc235eb99173cc83d0de3b1b", - "zh:b9f1c3bfadb74068f5c205292badb0661e17ac05eb23bfe8bd809691e4583d0e", - "zh:cc4cbcd67414fefb111c1bf7ab0bc4beb8c0b553d01719ad17de9a047adff4d1", - ] -} - -provider "registry.terraform.io/hashicorp/null" { - version = "3.2.3" - hashes = [ - "h1:I0Um8UkrMUb81Fxq/dxbr3HLP2cecTH2WMJiwKSrwQY=", - "zh:22d062e5278d872fe7aed834f5577ba0a5afe34a3bdac2b81f828d8d3e6706d2", - "zh:23dead00493ad863729495dc212fd6c29b8293e707b055ce5ba21ee453ce552d", - "zh:28299accf21763ca1ca144d8f660688d7c2ad0b105b7202554ca60b02a3856d3", - "zh:55c9e8a9ac25a7652df8c51a8a9a422bd67d784061b1de2dc9fe6c3cb4e77f2f", - "zh:756586535d11698a216291c06b9ed8a5cc6a4ec43eee1ee09ecd5c6a9e297ac1", - "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", - "zh:9d5eea62fdb587eeb96a8c4d782459f4e6b73baeece4d04b4a40e44faaee9301", - "zh:a6355f596a3fb8fc85c2fb054ab14e722991533f87f928e7169a486462c74670", - "zh:b5a65a789cff4ada58a5baffc76cb9767dc26ec6b45c00d2ec8b1b027f6db4ed", - "zh:db5ab669cf11d0e9f81dc380a6fdfcac437aea3d69109c7aef1a5426639d2d65", - "zh:de655d251c470197bcbb5ac45d289595295acb8f829f6c781d4a75c8c8b7c7dd", - "zh:f5c68199f2e6076bce92a12230434782bf768103a427e9bb9abee99b116af7b5", - ] -} - -provider "registry.terraform.io/hashicorp/random" { - version = "3.6.3" - hashes = [ - "h1:zG9uFP8l9u+yGZZvi5Te7PV62j50azpgwPunq2vTm1E=", - "zh:04ceb65210251339f07cd4611885d242cd4d0c7306e86dda9785396807c00451", - "zh:448f56199f3e99ff75d5c0afacae867ee795e4dfda6cb5f8e3b2a72ec3583dd8", - "zh:4b4c11ccfba7319e901df2dac836b1ae8f12185e37249e8d870ee10bb87a13fe", - "zh:4fa45c44c0de582c2edb8a2e054f55124520c16a39b2dfc0355929063b6395b1", - "zh:588508280501a06259e023b0695f6a18149a3816d259655c424d068982cbdd36", - "zh:737c4d99a87d2a4d1ac0a54a73d2cb62974ccb2edbd234f333abd079a32ebc9e", - "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", - "zh:a357ab512e5ebc6d1fda1382503109766e21bbfdfaa9ccda43d313c122069b30", - "zh:c51bfb15e7d52cc1a2eaec2a903ac2aff15d162c172b1b4c17675190e8147615", - "zh:e0951ee6fa9df90433728b96381fb867e3db98f66f735e0c3e24f8f16903f0ad", - "zh:e3cdcb4e73740621dabd82ee6a37d6cfce7fee2a03d8074df65086760f5cf556", - "zh:eff58323099f1bd9a0bec7cb04f717e7f1b2774c7d612bf7581797e1622613a0", - ] -} - -provider "registry.terraform.io/hashicorp/tls" { - version = "4.0.6" - hashes = [ - "h1:n3M50qfWfRSpQV9Pwcvuse03pEizqrmYEryxKky4so4=", - "zh:10de0d8af02f2e578101688fd334da3849f56ea91b0d9bd5b1f7a243417fdda8", - "zh:37fc01f8b2bc9d5b055dc3e78bfd1beb7c42cfb776a4c81106e19c8911366297", - "zh:4578ca03d1dd0b7f572d96bd03f744be24c726bfd282173d54b100fd221608bb", - "zh:6c475491d1250050765a91a493ef330adc24689e8837a0f07da5a0e1269e11c1", - "zh:81bde94d53cdababa5b376bbc6947668be4c45ab655de7aa2e8e4736dfd52509", - "zh:abdce260840b7b050c4e401d4f75c7a199fafe58a8b213947a258f75ac18b3e8", - "zh:b754cebfc5184873840f16a642a7c9ef78c34dc246a8ae29e056c79939963c7a", - "zh:c928b66086078f9917aef0eec15982f2e337914c5c4dbc31dd4741403db7eb18", - "zh:cded27bee5f24de6f2ee0cfd1df46a7f88e84aaffc2ecbf3ff7094160f193d50", - "zh:d65eb3867e8f69aaf1b8bb53bd637c99c6b649ba3db16ded50fa9a01076d1a27", - "zh:ecb0c8b528c7a619fa71852bb3fb5c151d47576c5aab2bf3af4db52588722eeb", - "zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c", - ] -} - -provider "registry.terraform.io/hashicorp/vault" { - version = "4.5.0" - hashes = [ - "h1:jRi7YgsrO1Km4n/WkU+UOD98BM8mv+ckAxO/9gph2Kk=", - "zh:0a9301aa6a9b59db97682be568329526033bb50a4a308ad695c2a1877c1241c3", - "zh:0f8fee69ea4eaa27b86a391edc7de8e8b215e3c48f7074bab799986d5f707014", - "zh:2a2e51fe280e07700920bc8ed29b77e5c79fada0e4d5315d55ec0d2893bb5eed", - "zh:3fc7d9016bebe26a4c779ce6b87b181ed6a1af12499419726b8b0a0e3eaa7234", - "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", - "zh:813a9e4875e58dbca2526b3088c0f76dbb2a66b10b910497a0b703518eaa73cd", - "zh:889ed6f21b94f89b8cbc4224454ced01a2792f12f53379d2fb1a2f2749bf624a", - "zh:acf9c01d403584015005083e64d8479d167e4f54e87e540311010133fcb5b023", - "zh:b377945a4b6a75c79793cb92c873aacc9c087c2a6e5792a1613f3aa2f3693848", - "zh:be243567b2a76ba2a546449e89764f707477cf25dcdd6d7f3b808ddf40aaf9f6", - "zh:d879fa16f391fb75b779067c751f3b8f80f5f4d73b2ff86814662038878a0ce4", - "zh:e47fb3daac933f5dcb034379fe77c0bf834512da7348e7643457c9af3b2ab36b", - ] -}