From 4dba2a1770384a77004fb14579154c7a002e125b Mon Sep 17 00:00:00 2001 From: Thiago Sgobe Date: Wed, 5 Oct 2022 09:48:42 -0300 Subject: [PATCH 01/61] add escape blueprint var capability --- pkg/config/expand.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/pkg/config/expand.go b/pkg/config/expand.go index 8c7c48e837..c392164099 100644 --- a/pkg/config/expand.go +++ b/pkg/config/expand.go @@ -36,6 +36,7 @@ const ( deploymentVariableExp string = `^\$\(vars\.(.*)\)$` anyVariableExp string = `\$\((.*)\)` literalExp string = `^\(\((.*)\)\)$` + escapeVariableExp string = `\\\$\((.*?)\)` // the greediness and non-greediness of expression below is important // consume all whitespace at beginning and end // consume only up to first period to get variable source @@ -398,6 +399,13 @@ type varContext struct { blueprint Blueprint } +// Escape blueprint variable +// Convert \$(var.variable) to $(var.variable) +func expandEscapeVariable(str string) string { + re := regexp.MustCompile(escapeVariableExp) + return re.ReplaceAllString(str, (`$(${1})`)) +} + // Needs DeploymentGroups, variable string, current group, func expandSimpleVariable( context varContext, @@ -503,6 +511,15 @@ func isSimpleVariable(str string) bool { return matched } +// isEscapeVariable checks if the entire string is an escaped variable \$(not.var) +func isEscapeVariable(str string) bool { + matched, err := regexp.MatchString(escapeVariableExp, str) + if err != nil { + log.Fatalf("isEscapeVariable(%s): %v", str, err) + } + return matched +} + // hasVariable checks to see if any variable exists in a string func hasVariable(str string) bool { matched, err := regexp.MatchString(anyVariableExp, str) @@ -523,6 +540,9 @@ func handleVariable( if isSimpleVariable(val) { return expandSimpleVariable(context, modToGrp) } + if isEscapeVariable(val) { + return expandEscapeVariable(val), nil + } return expandVariable(context, modToGrp) } return val, nil From abc08375991cb359a2abcd4e1369fc3dfc717166 Mon Sep 17 00:00:00 2001 From: Thiago Sgobe Date: Wed, 5 Oct 2022 09:49:44 -0300 Subject: [PATCH 02/61] Add escape literal var capability --- pkg/modulewriter/hcl_utils.go | 10 +++++++++- pkg/modulewriter/tfwriter.go | 6 +++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/pkg/modulewriter/hcl_utils.go b/pkg/modulewriter/hcl_utils.go index dc5586f8b3..9990534576 100644 --- a/pkg/modulewriter/hcl_utils.go +++ b/pkg/modulewriter/hcl_utils.go @@ -17,11 +17,18 @@ package modulewriter import ( "fmt" "path/filepath" + "regexp" "github.com/hashicorp/hcl/v2/hclwrite" "github.com/zclconf/go-cty/cty" ) +func escapeLiteralVariables(hclBytes []byte) []byte { + // Convert \((not.variable)) to ((not.variable)) + re := regexp.MustCompile(`\\\\\(\((.*?)\)\)`) + return re.ReplaceAll(hclBytes, []byte(`((${1}))`)) +} + func writeHclAttributes(vars map[string]cty.Value, dst string) error { if err := createBaseFile(dst); err != nil { return fmt.Errorf("error creating variables file %v: %v", filepath.Base(dst), err) @@ -38,7 +45,8 @@ func writeHclAttributes(vars map[string]cty.Value, dst string) error { } // Write file - err := appendHCLToFile(dst, hclFile.Bytes()) + hclBytes := escapeLiteralVariables(hclFile.Bytes()) + err := appendHCLToFile(dst, hclBytes) if err != nil { return fmt.Errorf("error writing HCL to %v: %v", filepath.Base(dst), err) } diff --git a/pkg/modulewriter/tfwriter.go b/pkg/modulewriter/tfwriter.go index 700fb89d32..1c6525c3cd 100644 --- a/pkg/modulewriter/tfwriter.go +++ b/pkg/modulewriter/tfwriter.go @@ -65,8 +65,12 @@ func createBaseFile(path string) error { } func handleLiteralVariables(hclBytes []byte) []byte { + // Convert ((var.variable)) to var.variable re := regexp.MustCompile(`"\(\((.*?)\)\)"`) - return re.ReplaceAll(hclBytes, []byte(`${1}`)) + hclBytes = re.ReplaceAll(hclBytes, []byte(`${1}`)) + // Convert \((not.variable)) to ((not.variable)) + re = regexp.MustCompile(`\\\\\(\((.*?)\)\)`) + return re.ReplaceAll(hclBytes, []byte(`((${1}))`)) } func appendHCLToFile(path string, hclBytes []byte) error { From d75cfd3eb9af07948b7f8ac4b6389be49e049049 Mon Sep 17 00:00:00 2001 From: Thiago Sgobe Date: Wed, 5 Oct 2022 09:56:58 -0300 Subject: [PATCH 03/61] Add escape reference into README --- examples/README.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/examples/README.md b/examples/README.md index d1ef417c33..490b512a70 100644 --- a/examples/README.md +++ b/examples/README.md @@ -795,3 +795,28 @@ everything inside will be provided as is to the module. Whenever possible, blueprint variables are preferred over literal variables. `ghpc` will perform basic validation making sure all blueprint variables are defined before creating a deployment, making debugging quicker and easier. + +### Escape Variables + +Under circumstances where is needed escape either a literal variable or blueprint variables format, a non-quoted backslash `\` is the escape character. It preserves the literal value of the next character that follows: + +* `\$(not.bp_var)` evaluates to `$(not.bp_var)`. +* `\((not.literal_var))` evaluates to `((not.literal_var))`. + +```yaml +deployment_groups: + - group: primary + modules: + - id: resource1 + source: path/to/module/1 + settings: + key1: \((not.literal_var)) ## Evaluates to "((not.literal_var))". + ... + - id: resource2 + source: path/to/module/2 + ... + settings: + key1: | + #!/bin/bash + echo \$(cat /tmp/file1) ## Evaluates to "echo $(cat /tmp/file1)" +``` From 6c74b4100da8f29c7007f2324f7be1f393bdb217 Mon Sep 17 00:00:00 2001 From: Thiago Sgobe Date: Thu, 6 Oct 2022 08:10:04 -0300 Subject: [PATCH 04/61] Check multiple espace variables within single string --- pkg/config/expand.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pkg/config/expand.go b/pkg/config/expand.go index c392164099..c8bfab9e59 100644 --- a/pkg/config/expand.go +++ b/pkg/config/expand.go @@ -37,6 +37,7 @@ const ( anyVariableExp string = `\$\((.*)\)` literalExp string = `^\(\((.*)\)\)$` escapeVariableExp string = `\\\$\((.*?)\)` + nonEscapeVariableExp string = `(?:\s|^|[[:word:]]|[^\\])\$\((.*)\)` // the greediness and non-greediness of expression below is important // consume all whitespace at beginning and end // consume only up to first period to get variable source @@ -513,6 +514,10 @@ func isSimpleVariable(str string) bool { // isEscapeVariable checks if the entire string is an escaped variable \$(not.var) func isEscapeVariable(str string) bool { + // if string has multiple variables all of them must have escape character + if hasNoEscapeVariable(str) { + return false + } matched, err := regexp.MatchString(escapeVariableExp, str) if err != nil { log.Fatalf("isEscapeVariable(%s): %v", str, err) @@ -520,6 +525,15 @@ func isEscapeVariable(str string) bool { return matched } +// hasNoEscapeVariable checks to see if any variable in string is not escape +func hasNoEscapeVariable(str string) bool { + matched, err := regexp.MatchString(nonEscapeVariableExp, str) + if err != nil { + log.Fatalf("hasNoEscapeVariable(%s): %v", str, err) + } + return matched +} + // hasVariable checks to see if any variable exists in a string func hasVariable(str string) bool { matched, err := regexp.MatchString(anyVariableExp, str) From a7d9e988d019b5275f9df3c4702e7acf57e8fb3c Mon Sep 17 00:00:00 2001 From: Thiago Sgobe Date: Fri, 7 Oct 2022 12:30:29 -0300 Subject: [PATCH 05/61] Adjust names and comments --- examples/README.md | 2 +- pkg/config/expand.go | 15 +++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/examples/README.md b/examples/README.md index 490b512a70..3c6f6af760 100644 --- a/examples/README.md +++ b/examples/README.md @@ -798,7 +798,7 @@ defined before creating a deployment, making debugging quicker and easier. ### Escape Variables -Under circumstances where is needed escape either a literal variable or blueprint variables format, a non-quoted backslash `\` is the escape character. It preserves the literal value of the next character that follows: +Under circumstances where the variable notation conflicts with the content of a setting or string, for instance when defining a startup-script runner that uses a subshell like in the example below, a non-quoted backslash (`\`) can be used as an escape character. It preserves the literal value of the next character that follows: * `\$(not.bp_var)` evaluates to `$(not.bp_var)`. * `\((not.literal_var))` evaluates to `((not.literal_var))`. diff --git a/pkg/config/expand.go b/pkg/config/expand.go index c8bfab9e59..5459407d8a 100644 --- a/pkg/config/expand.go +++ b/pkg/config/expand.go @@ -37,7 +37,10 @@ const ( anyVariableExp string = `\$\((.*)\)` literalExp string = `^\(\((.*)\)\)$` escapeVariableExp string = `\\\$\((.*?)\)` - nonEscapeVariableExp string = `(?:\s|^|[[:word:]]|[^\\])\$\((.*)\)` + // Checks if a non-escaped variable exists only as a substring, ex: + // Matches: "a$(vars.example)", "word $(vars.example)", "word$(vars.example)", "$(vars.example)" + // Doesn't match: "\$(vars.example)", "no variable in this string" + nonEscapeVariableExp string = `(?:\s|^|[[:word:]]|[^\\])\$\((.*)\)` // the greediness and non-greediness of expression below is important // consume all whitespace at beginning and end // consume only up to first period to get variable source @@ -512,10 +515,10 @@ func isSimpleVariable(str string) bool { return matched } -// isEscapeVariable checks if the entire string is an escaped variable \$(not.var) +// isEscapeVariable checks if variables within string are escaped variables func isEscapeVariable(str string) bool { // if string has multiple variables all of them must have escape character - if hasNoEscapeVariable(str) { + if hasNonEscapedVariable(str) { return false } matched, err := regexp.MatchString(escapeVariableExp, str) @@ -525,11 +528,11 @@ func isEscapeVariable(str string) bool { return matched } -// hasNoEscapeVariable checks to see if any variable in string is not escape -func hasNoEscapeVariable(str string) bool { +// hasNonEscapedVariable checks to see if any variable in string is not escape +func hasNonEscapedVariable(str string) bool { matched, err := regexp.MatchString(nonEscapeVariableExp, str) if err != nil { - log.Fatalf("hasNoEscapeVariable(%s): %v", str, err) + log.Fatalf("hasNonEscapedVariable(%s): %v", str, err) } return matched } From 061ab8ccf926ba56d1fb97e2fd97cfaa4fdcaf88 Mon Sep 17 00:00:00 2001 From: Nick Stroud Date: Mon, 10 Oct 2022 15:37:34 -0700 Subject: [PATCH 06/61] Remove Batch startup script workaround --- .../modules/scheduler/cloud-batch-login-node/README.md | 2 +- .../modules/scheduler/cloud-batch-login-node/main.tf | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/community/modules/scheduler/cloud-batch-login-node/README.md b/community/modules/scheduler/cloud-batch-login-node/README.md index 80c214e954..a953ef9429 100644 --- a/community/modules/scheduler/cloud-batch-login-node/README.md +++ b/community/modules/scheduler/cloud-batch-login-node/README.md @@ -88,7 +88,7 @@ limitations under the License. | Name | Source | Version | |------|--------|---------| -| [login\_startup\_script](#module\_login\_startup\_script) | github.com/GoogleCloudPlatform/hpc-toolkit//modules/scripts/startup-script | v1.0.0 | +| [login\_startup\_script](#module\_login\_startup\_script) | github.com/GoogleCloudPlatform/hpc-toolkit//modules/scripts/startup-script | v1.6.0 | ## Resources diff --git a/community/modules/scheduler/cloud-batch-login-node/main.tf b/community/modules/scheduler/cloud-batch-login-node/main.tf index c43ad0bfab..e408e6112b 100644 --- a/community/modules/scheduler/cloud-batch-login-node/main.tf +++ b/community/modules/scheduler/cloud-batch-login-node/main.tf @@ -33,7 +33,7 @@ locals { } module "login_startup_script" { - source = "github.com/GoogleCloudPlatform/hpc-toolkit//modules/scripts/startup-script?ref=v1.0.0" + source = "github.com/GoogleCloudPlatform/hpc-toolkit//modules/scripts/startup-script?ref=v1.6.0" labels = var.labels project_id = var.project_id deployment_name = var.deployment_name @@ -41,12 +41,7 @@ module "login_startup_script" { runners = [ { content = local.batch_startup_script - destination = "/tmp/startup-scripts/batch_startup_script.sh" - type = "data" - }, - { # TODO: This workaround should be removed once startup-script supports Bash syntax - content = "bash /tmp/startup-scripts/batch_startup_script.sh" - destination = "/tmp/startup-scripts/invoke_batch_startup_script.sh" + destination = "batch_startup_script.sh" type = "shell" }, { From 92aba1b16f67ebf2157886559fb0e1457fec5a41 Mon Sep 17 00:00:00 2001 From: Alex Heye Date: Mon, 10 Oct 2022 20:51:00 +0000 Subject: [PATCH 07/61] Add additional network interfaces to vm-instance This commit adds the option to specify more than one network interface. Additional network interfaces more closely match the terraform format, and allow a lot more direct configuration. This way, the simple route is provided via defaults and the first network interface and additional network interfaces are targetted more towards knowledable users with specific requirements. access_config has been simplified to `disable_public_ips` similar to the default network interface. This could be expanded later on to provide full customization. alias_ip_range and ipv6_access_config have not been included, but could be if they are needed at a future time. --- modules/compute/vm-instance/README.md | 1 + modules/compute/vm-instance/main.tf | 18 +++++ modules/compute/vm-instance/variables.tf | 27 ++++++++ .../test_configs/2-network-interfaces.yaml | 65 +++++++++++++++++++ 4 files changed, 111 insertions(+) create mode 100644 tools/validate_configs/test_configs/2-network-interfaces.yaml diff --git a/modules/compute/vm-instance/README.md b/modules/compute/vm-instance/README.md index eba02d5da0..0131ede39d 100644 --- a/modules/compute/vm-instance/README.md +++ b/modules/compute/vm-instance/README.md @@ -133,6 +133,7 @@ No modules. | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| +| [additional\_network\_interfaces](#input\_additional\_network\_interfaces) | A list of additional network interfaces. The options, with the exception of
`disable_public_ips`, match that of the terraform network\_interface block of
google\_compute\_instance. For descriptions of the subfields or more
information see the documentation:
https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_instance#nested_network_interface

network (string, required if subnetwork is not supplied)
subnetwork (string, required if network is not supplied)
subnetwork\_project (string, optional)
network\_ip (string, optional)
disable\_public\_ips (bool, optional, whether or not to create a public IP for the instance in this network, defaults to true)
nic\_type (string, optional, choose from ["GVNIC", "VIRTIO\_NET"])
stack\_type (string, optional, choose from ["IPV4\_ONLY", "IPV4\_IPV6"])
queue\_count (number, optional) | `list(map(any))` | `[]` | no | | [auto\_delete\_boot\_disk](#input\_auto\_delete\_boot\_disk) | Controls if boot disk should be auto-deleted when instance is deleted. | `bool` | `true` | no | | [bandwidth\_tier](#input\_bandwidth\_tier) | Tier 1 bandwidth increases the maximum egress bandwidth for VMs.
Using the `tier_1_enabled` setting will enable both gVNIC and TIER\_1 higher bandwidth networking.
Using the `gvnic_enabled` setting will only enable gVNIC and will not enable TIER\_1.
Note that TIER\_1 only works with specific machine families & shapes and must be using an image that supports gVNIC. See [official docs](https://cloud.google.com/compute/docs/networking/configure-vm-with-high-bandwidth-configuration) for more details. | `string` | `"not_enabled"` | no | | [deployment\_name](#input\_deployment\_name) | Name of the deployment, used to name the cluster | `string` | n/a | yes | diff --git a/modules/compute/vm-instance/main.tf b/modules/compute/vm-instance/main.tf index f00d8f8f89..98a35cc3dc 100644 --- a/modules/compute/vm-instance/main.tf +++ b/modules/compute/vm-instance/main.tf @@ -133,6 +133,24 @@ resource "google_compute_instance" "compute_vm" { nic_type = local.enable_gvnic ? "GVNIC" : null } + dynamic "network_interface" { + for_each = var.additional_network_interfaces + + content { + network = lookup(network_interface.value, "network", null) + subnetwork = lookup(network_interface.value, "subnetwork", null) + subnetwork_project = lookup(network_interface.value, "subnetwork_project", null) + network_ip = lookup(network_interface.value, "network_ip", null) + nic_type = lookup(network_interface.value, "nic_type", null) + stack_type = lookup(network_interface.value, "stack_type", null) + queue_count = lookup(network_interface.value, "queue_count", null) + dynamic "access_config" { + for_each = lookup(network_interface.value, "disable_public_ips", true) ? [] : [1] + content {} + } + } + } + network_performance_config { total_egress_bandwidth_tier = local.enable_tier_1 ? "TIER_1" : "DEFAULT" } diff --git a/modules/compute/vm-instance/variables.tf b/modules/compute/vm-instance/variables.tf index 307baf708f..a395071e6f 100644 --- a/modules/compute/vm-instance/variables.tf +++ b/modules/compute/vm-instance/variables.tf @@ -136,6 +136,33 @@ variable "subnetwork_self_link" { default = null } +variable "additional_network_interfaces" { + description = <<-EOT + A list of additional network interfaces. The options, with the exception of + `disable_public_ips`, match that of the terraform network_interface block of + google_compute_instance. For descriptions of the subfields or more + information see the documentation: + https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_instance#nested_network_interface + + network (string, required if subnetwork is not supplied) + subnetwork (string, required if network is not supplied) + subnetwork_project (string, optional) + network_ip (string, optional) + disable_public_ips (bool, optional, whether or not to create a public IP for the instance in this network, defaults to true) + nic_type (string, optional, choose from ["GVNIC", "VIRTIO_NET"]) + stack_type (string, optional, choose from ["IPV4_ONLY", "IPV4_IPV6"]) + queue_count (number, optional) + EOT + type = list(map(any)) + default = [] + validation { + condition = alltrue([ + for ni in var.additional_network_interfaces : can(ni["network"]) != can(ni["subnetwork"]) + ]) + error_message = "All additional network interfaces must define exactly one of \"network\" or \"subnetwork\"." + } +} + variable "zone" { description = "Compute Platform zone" type = string diff --git a/tools/validate_configs/test_configs/2-network-interfaces.yaml b/tools/validate_configs/test_configs/2-network-interfaces.yaml new file mode 100644 index 0000000000..8fbd0999be --- /dev/null +++ b/tools/validate_configs/test_configs/2-network-interfaces.yaml @@ -0,0 +1,65 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +--- + +blueprint_name: two-network-interfaces + +vars: + project_id: ## Set GCP Project ID Here ## + deployment_name: two-nets + region: us-central1 + zone: us-central1-c + +deployment_groups: +- group: primary + modules: + # Source is an embedded module, denoted by "modules/*" without ./, ../, / + # as a prefix. To refer to a local or community module, prefix with ./, ../ or / + # Example - ./modules/network/vpc + - id: network1 + source: modules/network/pre-existing-vpc + + - id: network2 + source: modules/network/vpc + settings: + network_address_range: 10.1.0.0/16 + subnetworks: + - subnet_name: primary-subnet-two + subnet_region: $(vars.region) + new_bits: 8 + + - id: network3 + source: modules/network/vpc + settings: + network_name: networkthree + network_address_range: 10.0.0.0/16 + subnetworks: + - subnet_name: primary-subnet-three + subnet_region: $(vars.region) + new_bits: 8 + + - id: workstation + source: ./modules/compute/vm-instance + use: + - network1 + settings: + additional_network_interfaces: + - subnetwork: $(network2.subnetwork_self_link) + nic_type: GVNIC + queue_count: 12 + disable_public_ips: false + - subnetwork: $(network3.subnetwork_self_link) + nic_type: GVNIC + queue_count: 12 From 2efc211b18fdd7f8c2432848f505aed8f8cb01ba Mon Sep 17 00:00:00 2001 From: Nick Stroud Date: Mon, 10 Oct 2022 17:43:07 -0700 Subject: [PATCH 08/61] Improve Batch output instructions and add README to login node --- .../scheduler/cloud-batch-job/README.md | 10 +++--- .../scheduler/cloud-batch-job/outputs.tf | 26 ++++++++++---- .../scheduler/cloud-batch-login-node/main.tf | 34 ++++++++++++++++++- .../cloud-batch-login-node/outputs.tf | 18 ++++------ 4 files changed, 63 insertions(+), 25 deletions(-) diff --git a/community/modules/scheduler/cloud-batch-job/README.md b/community/modules/scheduler/cloud-batch-job/README.md index 7aa72c9036..f56cfaa66b 100644 --- a/community/modules/scheduler/cloud-batch-job/README.md +++ b/community/modules/scheduler/cloud-batch-job/README.md @@ -172,9 +172,9 @@ limitations under the License. | Name | Description | |------|-------------| | [gcloud\_version](#output\_gcloud\_version) | The version of gcloud to be used. | -| [instance\_template](#output\_instance\_template) | Instance template used by the Google Cloud Batch job. | -| [instructions](#output\_instructions) | Instructions for submitting Google Cloud Batch job. | -| [job\_filename](#output\_job\_filename) | The filename of the generated Google Cloud Batch job template. | -| [job\_id](#output\_job\_id) | The Google Cloud Batch job id. | -| [job\_template\_contents](#output\_job\_template\_contents) | The generated Google Cloud Batch job template. | +| [instance\_template](#output\_instance\_template) | Instance template used by the Batch job. | +| [instructions](#output\_instructions) | Instructions for submitting the Batch job. | +| [job\_filename](#output\_job\_filename) | The filename of the generated Batch job template. | +| [job\_id](#output\_job\_id) | The Batch job id. | +| [job\_template\_contents](#output\_job\_template\_contents) | The generated Batch job template. | diff --git a/community/modules/scheduler/cloud-batch-job/outputs.tf b/community/modules/scheduler/cloud-batch-job/outputs.tf index 4822c45bdb..346668ab0d 100644 --- a/community/modules/scheduler/cloud-batch-job/outputs.tf +++ b/community/modules/scheduler/cloud-batch-job/outputs.tf @@ -14,11 +14,23 @@ * limitations under the License. */ +locals { + provided_instance_tpl_msg = "An instance template was provided to be used by your Batch job" + generated_instance_tpl_msg = "An instance template was created for your Batch job" +} + output "instructions" { - description = "Instructions for submitting Google Cloud Batch job." + description = "Instructions for submitting the Batch job." value = <<-EOT + + A Batch job template file has been created locally at: + ${abspath(local.job_template_output_path)} + + ${var.instance_template == null ? local.generated_instance_tpl_msg : local.provided_instance_tpl_msg} & referenced in the above file: + ${local.instance_template} + + Use the following commands to: - Submit your job: gcloud ${var.gcloud_version} batch jobs submit ${local.job_id} --config=${abspath(local.job_template_output_path)} --location=${var.region} --project=${var.project_id} @@ -28,28 +40,28 @@ output "instructions" { Delete job: gcloud ${var.gcloud_version} batch jobs delete ${local.job_id} --location=${var.region} --project=${var.project_id} - List all jobs in region: + List all jobs: gcloud ${var.gcloud_version} batch jobs list --project=${var.project_id} EOT } output "instance_template" { - description = "Instance template used by the Google Cloud Batch job." + description = "Instance template used by the Batch job." value = local.instance_template } output "job_template_contents" { - description = "The generated Google Cloud Batch job template." + description = "The generated Batch job template." value = local.job_template_contents } output "job_filename" { - description = "The filename of the generated Google Cloud Batch job template." + description = "The filename of the generated Batch job template." value = local.job_filename } output "job_id" { - description = "The Google Cloud Batch job id." + description = "The Batch job id." value = local.job_id } diff --git a/community/modules/scheduler/cloud-batch-login-node/main.tf b/community/modules/scheduler/cloud-batch-login-node/main.tf index e408e6112b..7262216cf8 100644 --- a/community/modules/scheduler/cloud-batch-login-node/main.tf +++ b/community/modules/scheduler/cloud-batch-login-node/main.tf @@ -19,6 +19,8 @@ data "google_compute_instance_template" "batch_instance_template" { } locals { + job_template_destination = "${var.batch_job_directory}/${var.job_filename}" + instance_template_metadata = data.google_compute_instance_template.batch_instance_template.metadata batch_startup_script = local.instance_template_metadata["startup-script"] startup_metadata = { startup-script = module.login_startup_script.startup_script } @@ -30,6 +32,31 @@ locals { oslogin_metadata = var.enable_oslogin == "INHERIT" ? {} : { enable-oslogin = lookup(local.oslogin_api_values, var.enable_oslogin, "") } login_metadata = merge(local.instance_template_metadata, local.startup_metadata, local.oslogin_metadata) + + batch_command_instructions = <<-EOT + Submit your job from login node: + gcloud ${var.gcloud_version} batch jobs submit ${var.job_id} --config=${local.job_template_destination} --location=${var.region} --project=${var.project_id} + + Check status: + gcloud ${var.gcloud_version} batch jobs describe ${var.job_id} --location=${var.region} --project=${var.project_id} | grep state: + + Delete job: + gcloud ${var.gcloud_version} batch jobs delete ${var.job_id} --location=${var.region} --project=${var.project_id} + + List all jobs: + gcloud ${var.gcloud_version} batch jobs list --project=${var.project_id} + EOT + + readme_contents = <<-EOT + # Batch Job Templates + + This folder contains Batch job templates created by the Cloud HPC Toolkit. + These templates can be edited before submitting to Batch to capture more + complex workloads. + + Use the following commands to: + ${local.batch_command_instructions} + EOT } module "login_startup_script" { @@ -44,9 +71,14 @@ module "login_startup_script" { destination = "batch_startup_script.sh" type = "shell" }, + { + content = local.readme_contents + destination = "${var.batch_job_directory}/README.md" + type = "data" + }, { content = var.job_template_contents - destination = "${var.batch_job_directory}/${var.job_filename}" + destination = local.job_template_destination type = "data" } ] diff --git a/community/modules/scheduler/cloud-batch-login-node/outputs.tf b/community/modules/scheduler/cloud-batch-login-node/outputs.tf index a7e34f0223..5845bd0289 100644 --- a/community/modules/scheduler/cloud-batch-login-node/outputs.tf +++ b/community/modules/scheduler/cloud-batch-login-node/outputs.tf @@ -22,21 +22,15 @@ output "login_node_name" { output "instructions" { description = "Instructions for accessing the login node and submitting Google Cloud Batch jobs" value = <<-EOT - Use the following commands to: + A Batch job template file will be placed on the Batch login node at: + ${local.job_template_destination} + + + Use the following commands to: SSH into the login node: gcloud compute ssh --zone ${google_compute_instance_from_template.batch_login.zone} ${google_compute_instance_from_template.batch_login.name} --project ${google_compute_instance_from_template.batch_login.project} - Submit your job from login node: - gcloud ${var.gcloud_version} batch jobs submit ${var.job_id} --config=${var.batch_job_directory}/${var.job_filename} --location=${var.region} --project=${var.project_id} - - Check status: - gcloud ${var.gcloud_version} batch jobs describe ${var.job_id} --location=${var.region} --project=${var.project_id} | grep state: - - Delete job: - gcloud ${var.gcloud_version} batch jobs delete ${var.job_id} --location=${var.region} --project=${var.project_id} - - List all jobs in region: - gcloud ${var.gcloud_version} batch jobs list --project=${var.project_id} + ${local.batch_command_instructions} EOT } From d5562014c96edd8c0a6720cf54f1060aefbfb13c Mon Sep 17 00:00:00 2001 From: Thiago Sgobe Date: Tue, 11 Oct 2022 09:07:18 -0300 Subject: [PATCH 09/61] Add escape blueprint vars func in the writers --- pkg/config/expand.go | 40 +++-------------------------------- pkg/modulewriter/hcl_utils.go | 7 ++++++ pkg/modulewriter/tfwriter.go | 9 ++++++++ 3 files changed, 19 insertions(+), 37 deletions(-) diff --git a/pkg/config/expand.go b/pkg/config/expand.go index 5459407d8a..97ac69a40d 100644 --- a/pkg/config/expand.go +++ b/pkg/config/expand.go @@ -34,13 +34,11 @@ const ( roleLabel string = "ghpc_role" simpleVariableExp string = `^\$\((.*)\)$` deploymentVariableExp string = `^\$\(vars\.(.*)\)$` - anyVariableExp string = `\$\((.*)\)` - literalExp string = `^\(\((.*)\)\)$` - escapeVariableExp string = `\\\$\((.*?)\)` - // Checks if a non-escaped variable exists only as a substring, ex: + // Checks if a variable exists only as a substring, ex: // Matches: "a$(vars.example)", "word $(vars.example)", "word$(vars.example)", "$(vars.example)" // Doesn't match: "\$(vars.example)", "no variable in this string" - nonEscapeVariableExp string = `(?:\s|^|[[:word:]]|[^\\])\$\((.*)\)` + anyVariableExp string = `(^|[^\\])\$\((.*)\)` + literalExp string = `^\(\((.*)\)\)$` // the greediness and non-greediness of expression below is important // consume all whitespace at beginning and end // consume only up to first period to get variable source @@ -403,13 +401,6 @@ type varContext struct { blueprint Blueprint } -// Escape blueprint variable -// Convert \$(var.variable) to $(var.variable) -func expandEscapeVariable(str string) string { - re := regexp.MustCompile(escapeVariableExp) - return re.ReplaceAllString(str, (`$(${1})`)) -} - // Needs DeploymentGroups, variable string, current group, func expandSimpleVariable( context varContext, @@ -515,28 +506,6 @@ func isSimpleVariable(str string) bool { return matched } -// isEscapeVariable checks if variables within string are escaped variables -func isEscapeVariable(str string) bool { - // if string has multiple variables all of them must have escape character - if hasNonEscapedVariable(str) { - return false - } - matched, err := regexp.MatchString(escapeVariableExp, str) - if err != nil { - log.Fatalf("isEscapeVariable(%s): %v", str, err) - } - return matched -} - -// hasNonEscapedVariable checks to see if any variable in string is not escape -func hasNonEscapedVariable(str string) bool { - matched, err := regexp.MatchString(nonEscapeVariableExp, str) - if err != nil { - log.Fatalf("hasNonEscapedVariable(%s): %v", str, err) - } - return matched -} - // hasVariable checks to see if any variable exists in a string func hasVariable(str string) bool { matched, err := regexp.MatchString(anyVariableExp, str) @@ -557,9 +526,6 @@ func handleVariable( if isSimpleVariable(val) { return expandSimpleVariable(context, modToGrp) } - if isEscapeVariable(val) { - return expandEscapeVariable(val), nil - } return expandVariable(context, modToGrp) } return val, nil diff --git a/pkg/modulewriter/hcl_utils.go b/pkg/modulewriter/hcl_utils.go index 9990534576..2bf2398413 100644 --- a/pkg/modulewriter/hcl_utils.go +++ b/pkg/modulewriter/hcl_utils.go @@ -23,6 +23,12 @@ import ( "github.com/zclconf/go-cty/cty" ) +func escapeBlueprintVariables(hclBytes []byte) []byte { + // Convert \$(not.variable) to $(not.variable) + re := regexp.MustCompile(`\\\\\$\((.*?)\)`) + return re.ReplaceAll(hclBytes, []byte(`$(${1})`)) +} + func escapeLiteralVariables(hclBytes []byte) []byte { // Convert \((not.variable)) to ((not.variable)) re := regexp.MustCompile(`\\\\\(\((.*?)\)\)`) @@ -46,6 +52,7 @@ func writeHclAttributes(vars map[string]cty.Value, dst string) error { // Write file hclBytes := escapeLiteralVariables(hclFile.Bytes()) + hclBytes = escapeBlueprintVariables(hclBytes) err := appendHCLToFile(dst, hclBytes) if err != nil { return fmt.Errorf("error writing HCL to %v: %v", filepath.Base(dst), err) diff --git a/pkg/modulewriter/tfwriter.go b/pkg/modulewriter/tfwriter.go index 1c6525c3cd..0b4de88611 100644 --- a/pkg/modulewriter/tfwriter.go +++ b/pkg/modulewriter/tfwriter.go @@ -64,6 +64,12 @@ func createBaseFile(path string) error { return err } +func handleBlueprintVariables(hclBytes []byte) []byte { + // Convert \$(not.variable) to $(not.variable) + re := regexp.MustCompile(`\\\\\$\((.*?)\)`) + return re.ReplaceAll(hclBytes, []byte(`$(${1})`)) +} + func handleLiteralVariables(hclBytes []byte) []byte { // Convert ((var.variable)) to var.variable re := regexp.MustCompile(`"\(\((.*?)\)\)"`) @@ -118,6 +124,7 @@ func writeOutputs( // Write file hclBytes := handleLiteralVariables(hclFile.Bytes()) + hclBytes = handleBlueprintVariables(hclBytes) err := appendHCLToFile(outputsPath, hclBytes) if err != nil { return fmt.Errorf("error writing HCL to outputs.tf file: %v", err) @@ -291,6 +298,7 @@ func writeMain( } // Write file hclBytes := handleLiteralVariables(hclFile.Bytes()) + hclBytes = handleBlueprintVariables(hclBytes) if err := appendHCLToFile(mainPath, hclBytes); err != nil { return fmt.Errorf("error writing HCL to main.tf file: %v", err) } @@ -345,6 +353,7 @@ func writeProviders(vars map[string]cty.Value, dst string) error { // Write file hclBytes := handleLiteralVariables(hclFile.Bytes()) + hclBytes = handleBlueprintVariables(hclBytes) if err := appendHCLToFile(providersPath, hclBytes); err != nil { return fmt.Errorf("error writing HCL to providers.tf file: %v", err) } From d29e89a3229e50bca98d4f5b17b4bd22f908fe69 Mon Sep 17 00:00:00 2001 From: Nick Stroud Date: Tue, 11 Oct 2022 09:23:43 -0700 Subject: [PATCH 10/61] Address feedback --- community/modules/scheduler/cloud-batch-job/outputs.tf | 7 +++---- .../modules/scheduler/cloud-batch-login-node/outputs.tf | 1 - 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/community/modules/scheduler/cloud-batch-job/outputs.tf b/community/modules/scheduler/cloud-batch-job/outputs.tf index 346668ab0d..52702476da 100644 --- a/community/modules/scheduler/cloud-batch-job/outputs.tf +++ b/community/modules/scheduler/cloud-batch-job/outputs.tf @@ -15,8 +15,8 @@ */ locals { - provided_instance_tpl_msg = "An instance template was provided to be used by your Batch job" - generated_instance_tpl_msg = "An instance template was created for your Batch job" + provided_instance_tpl_msg = "The Batch job template uses the existing VM instance template:" + generated_instance_tpl_msg = "The Batch job template uses a new VM instance template created matching the provided settings:" } output "instructions" { @@ -26,10 +26,9 @@ output "instructions" { A Batch job template file has been created locally at: ${abspath(local.job_template_output_path)} - ${var.instance_template == null ? local.generated_instance_tpl_msg : local.provided_instance_tpl_msg} & referenced in the above file: + ${var.instance_template == null ? local.generated_instance_tpl_msg : local.provided_instance_tpl_msg} ${local.instance_template} - Use the following commands to: Submit your job: gcloud ${var.gcloud_version} batch jobs submit ${local.job_id} --config=${abspath(local.job_template_output_path)} --location=${var.region} --project=${var.project_id} diff --git a/community/modules/scheduler/cloud-batch-login-node/outputs.tf b/community/modules/scheduler/cloud-batch-login-node/outputs.tf index 5845bd0289..9e42496cad 100644 --- a/community/modules/scheduler/cloud-batch-login-node/outputs.tf +++ b/community/modules/scheduler/cloud-batch-login-node/outputs.tf @@ -26,7 +26,6 @@ output "instructions" { A Batch job template file will be placed on the Batch login node at: ${local.job_template_destination} - Use the following commands to: SSH into the login node: gcloud compute ssh --zone ${google_compute_instance_from_template.batch_login.zone} ${google_compute_instance_from_template.batch_login.name} --project ${google_compute_instance_from_template.batch_login.project} From a25260b38d51ea53d9449cf91efcd20aa5c32608 Mon Sep 17 00:00:00 2001 From: Alex Heye Date: Tue, 11 Oct 2022 22:34:02 +0000 Subject: [PATCH 11/61] Make network_interfaces override other network variables additional_network_interfaces has been renamed to network_interfaces. As part of that, it will now override the network and subnetwork inputs if the list size is greater than 0. All values are objects now as well, making all fields mandatory if used. New validations have been added for simple string choices. --- modules/compute/vm-instance/README.md | 2 +- modules/compute/vm-instance/main.tf | 65 ++++++---- modules/compute/vm-instance/variables.tf | 58 +++++++-- .../test_configs/2-network-interfaces.yaml | 118 ++++++++++++++++-- 4 files changed, 200 insertions(+), 43 deletions(-) diff --git a/modules/compute/vm-instance/README.md b/modules/compute/vm-instance/README.md index 0131ede39d..143bdee214 100644 --- a/modules/compute/vm-instance/README.md +++ b/modules/compute/vm-instance/README.md @@ -133,7 +133,6 @@ No modules. | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| -| [additional\_network\_interfaces](#input\_additional\_network\_interfaces) | A list of additional network interfaces. The options, with the exception of
`disable_public_ips`, match that of the terraform network\_interface block of
google\_compute\_instance. For descriptions of the subfields or more
information see the documentation:
https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_instance#nested_network_interface

network (string, required if subnetwork is not supplied)
subnetwork (string, required if network is not supplied)
subnetwork\_project (string, optional)
network\_ip (string, optional)
disable\_public\_ips (bool, optional, whether or not to create a public IP for the instance in this network, defaults to true)
nic\_type (string, optional, choose from ["GVNIC", "VIRTIO\_NET"])
stack\_type (string, optional, choose from ["IPV4\_ONLY", "IPV4\_IPV6"])
queue\_count (number, optional) | `list(map(any))` | `[]` | no | | [auto\_delete\_boot\_disk](#input\_auto\_delete\_boot\_disk) | Controls if boot disk should be auto-deleted when instance is deleted. | `bool` | `true` | no | | [bandwidth\_tier](#input\_bandwidth\_tier) | Tier 1 bandwidth increases the maximum egress bandwidth for VMs.
Using the `tier_1_enabled` setting will enable both gVNIC and TIER\_1 higher bandwidth networking.
Using the `gvnic_enabled` setting will only enable gVNIC and will not enable TIER\_1.
Note that TIER\_1 only works with specific machine families & shapes and must be using an image that supports gVNIC. See [official docs](https://cloud.google.com/compute/docs/networking/configure-vm-with-high-bandwidth-configuration) for more details. | `string` | `"not_enabled"` | no | | [deployment\_name](#input\_deployment\_name) | Name of the deployment, used to name the cluster | `string` | n/a | yes | @@ -150,6 +149,7 @@ No modules. | [machine\_type](#input\_machine\_type) | Machine type to use for the instance creation | `string` | `"c2-standard-60"` | no | | [metadata](#input\_metadata) | Metadata, provided as a map | `map(string)` | `{}` | no | | [name\_prefix](#input\_name\_prefix) | Name Prefix | `string` | `null` | no | +| [network\_interfaces](#input\_network\_interfaces) | A list of network interfaces. The options match that of the terraform
network\_interface block of google\_compute\_instance. For descriptions of the
subfields or more information see the documentation:
https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_instance#nested_network_interface

**\_NOTE:\_** If `network_interfaces` are set, `network_self_link` and
`subnetwork_self_link` will be ignored, even if they are provided through
the `use` field. `bandwidth_tier` and `disable_public_ips` also do not apply
to network interfaces defined in this variable.

Subfields:
network (string, required if subnetwork is not supplied)
subnetwork (string, required if network is not supplied)
subnetwork\_project (string, optional)
network\_ip (string, optional)
nic\_type (string, optional, choose from ["GVNIC", "VIRTIO\_NET"])
stack\_type (string, optional, choose from ["IPV4\_ONLY", "IPV4\_IPV6"])
queue\_count (number, optional)
access\_config (object, optional)
ipv6\_access\_config (object, optional)
alias\_ip\_range (list(object), optional) |
list(object({
network = string,
subnetwork = string,
subnetwork_project = string,
network_ip = string,
nic_type = string,
stack_type = string,
queue_count = number,
access_config = list(object({
nat_ip = string
public_ptr_domain_name = string
network_tier = string
})),
ipv6_access_config = list(object({
public_ptr_domain_name = string,
network_tier = string
})),
alias_ip_range = list(object({
ip_cidr_range = string
subnetwork_range_name = string
}))
}))
| `[]` | no | | [network\_self\_link](#input\_network\_self\_link) | The self link of the network to attach the VM. | `string` | `"default"` | no | | [network\_storage](#input\_network\_storage) | An array of network attached storage mounts to be configured. |
list(object({
server_ip = string,
remote_mount = string,
local_mount = string,
fs_type = string,
mount_options = string
}))
| `[]` | no | | [on\_host\_maintenance](#input\_on\_host\_maintenance) | Describes maintenance behavior for the instance. If left blank this will default to `MIGRATE` except for when `placement_policy`, spot provisioning, or GPUs require it to be `TERMINATE` | `string` | `null` | no | diff --git a/modules/compute/vm-instance/main.tf b/modules/compute/vm-instance/main.tf index 98a35cc3dc..a97232fcb7 100644 --- a/modules/compute/vm-instance/main.tf +++ b/modules/compute/vm-instance/main.tf @@ -61,6 +61,22 @@ locals { smt_capable = local.smt_capable_family && local.smt_capable_vcpu && local.machine_not_shared_core set_threads_per_core = var.threads_per_core != null && (var.threads_per_core == 0 && local.smt_capable || try(var.threads_per_core >= 1, false)) threads_per_core = var.threads_per_core == 2 ? 2 : 1 + + # Network Interfaces + # Support for `use` input and base network paramters like `network_self_link` and `subnetwork_self_link` + base_network_interface = { + network = var.network_self_link + subnetwork = var.subnetwork_self_link + subnetwork_project = var.project_id + network_ip = null + nic_type = local.enable_gvnic ? "GVNIC" : null + stack_type = null + queue_count = null + access_config = var.disable_public_ips ? [] : [{}] + ipv6_access_config = [] + alias_ip_range = [] + } + network_interfaces = length(var.network_interfaces) == 0 ? [local.base_network_interface] : var.network_interfaces } data "google_compute_image" "compute_image" { @@ -122,31 +138,38 @@ resource "google_compute_instance" "compute_vm" { } } - network_interface { - dynamic "access_config" { - for_each = var.disable_public_ips == true ? [] : [1] - content {} - } - - network = var.network_self_link - subnetwork = var.subnetwork_self_link - nic_type = local.enable_gvnic ? "GVNIC" : null - } - dynamic "network_interface" { - for_each = var.additional_network_interfaces + for_each = local.network_interfaces content { - network = lookup(network_interface.value, "network", null) - subnetwork = lookup(network_interface.value, "subnetwork", null) - subnetwork_project = lookup(network_interface.value, "subnetwork_project", null) - network_ip = lookup(network_interface.value, "network_ip", null) - nic_type = lookup(network_interface.value, "nic_type", null) - stack_type = lookup(network_interface.value, "stack_type", null) - queue_count = lookup(network_interface.value, "queue_count", null) + network = network_interface.value.network + subnetwork = network_interface.value.subnetwork + subnetwork_project = network_interface.value.subnetwork_project + network_ip = network_interface.value.network_ip + nic_type = network_interface.value.nic_type + stack_type = network_interface.value.stack_type + queue_count = network_interface.value.queue_count dynamic "access_config" { - for_each = lookup(network_interface.value, "disable_public_ips", true) ? [] : [1] - content {} + for_each = network_interface.value.access_config + content { + nat_ip = access_config.value.nat_ip + public_ptr_domain_name = access_config.value.public_ptr_domain_name + network_tier = access_config.value.network_tier + } + } + dynamic "ipv6_access_config" { + for_each = network_interface.value.ipv6_access_config + content { + public_ptr_domain_name = ipv6_access_config.value.public_ptr_domain_name + network_tier = ipv6_access_config.value.network_tier + } + } + dynamic "alias_ip_range" { + for_each = network_interface.value.alias_ip_range + content { + ip_cidr_range = alias_ip_range.value.ip_cidr_range + subnetwork_range_name = alias_ip_range.value.subnetwork_range_name + } } } } diff --git a/modules/compute/vm-instance/variables.tf b/modules/compute/vm-instance/variables.tf index a395071e6f..297624d681 100644 --- a/modules/compute/vm-instance/variables.tf +++ b/modules/compute/vm-instance/variables.tf @@ -136,31 +136,71 @@ variable "subnetwork_self_link" { default = null } -variable "additional_network_interfaces" { +variable "network_interfaces" { description = <<-EOT - A list of additional network interfaces. The options, with the exception of - `disable_public_ips`, match that of the terraform network_interface block of - google_compute_instance. For descriptions of the subfields or more - information see the documentation: + A list of network interfaces. The options match that of the terraform + network_interface block of google_compute_instance. For descriptions of the + subfields or more information see the documentation: https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_instance#nested_network_interface + **_NOTE:_** If `network_interfaces` are set, `network_self_link` and + `subnetwork_self_link` will be ignored, even if they are provided through + the `use` field. `bandwidth_tier` and `disable_public_ips` also do not apply + to network interfaces defined in this variable. + + Subfields: network (string, required if subnetwork is not supplied) subnetwork (string, required if network is not supplied) subnetwork_project (string, optional) network_ip (string, optional) - disable_public_ips (bool, optional, whether or not to create a public IP for the instance in this network, defaults to true) nic_type (string, optional, choose from ["GVNIC", "VIRTIO_NET"]) stack_type (string, optional, choose from ["IPV4_ONLY", "IPV4_IPV6"]) queue_count (number, optional) + access_config (object, optional) + ipv6_access_config (object, optional) + alias_ip_range (list(object), optional) EOT - type = list(map(any)) - default = [] + type = list(object({ + network = string, + subnetwork = string, + subnetwork_project = string, + network_ip = string, + nic_type = string, + stack_type = string, + queue_count = number, + access_config = list(object({ + nat_ip = string + public_ptr_domain_name = string + network_tier = string + })), + ipv6_access_config = list(object({ + public_ptr_domain_name = string, + network_tier = string + })), + alias_ip_range = list(object({ + ip_cidr_range = string + subnetwork_range_name = string + })) + })) + default = [] validation { condition = alltrue([ - for ni in var.additional_network_interfaces : can(ni["network"]) != can(ni["subnetwork"]) + for ni in var.network_interfaces : (ni.network == null) != (ni.subnetwork == null) ]) error_message = "All additional network interfaces must define exactly one of \"network\" or \"subnetwork\"." } + validation { + condition = alltrue([ + for ni in var.network_interfaces : ni.nic_type == "GVNIC" || ni.nic_type == "VIRTIO_NET" || ni.nic_type == null + ]) + error_message = "In the variable network_interfaces, field \"nic_type\" must be either \"GVNIC\", \"VIRTIO_NET\" or null." + } + validation { + condition = alltrue([ + for ni in var.network_interfaces : ni.stack_type == "IPV4_ONLY" || ni.stack_type == "IPV4_IPV6" || ni.stack_type == null + ]) + error_message = "In the variable network_interfaces, field \"stack_type\" must be either \"IPV4_ONLY\", \"IPV4_IPV6\" or null." + } } variable "zone" { diff --git a/tools/validate_configs/test_configs/2-network-interfaces.yaml b/tools/validate_configs/test_configs/2-network-interfaces.yaml index 8fbd0999be..9af616513c 100644 --- a/tools/validate_configs/test_configs/2-network-interfaces.yaml +++ b/tools/validate_configs/test_configs/2-network-interfaces.yaml @@ -28,38 +28,132 @@ deployment_groups: # Source is an embedded module, denoted by "modules/*" without ./, ../, / # as a prefix. To refer to a local or community module, prefix with ./, ../ or / # Example - ./modules/network/vpc - - id: network1 + - id: default source: modules/network/pre-existing-vpc - - id: network2 + - id: new-network-1 source: modules/network/vpc settings: network_address_range: 10.1.0.0/16 subnetworks: - - subnet_name: primary-subnet-two + - subnet_name: primary-subnet-one subnet_region: $(vars.region) new_bits: 8 - - id: network3 + - id: new-network-2 source: modules/network/vpc settings: - network_name: networkthree + network_name: networktwo network_address_range: 10.0.0.0/16 subnetworks: - - subnet_name: primary-subnet-three + - subnet_name: primary-subnet-two subnet_region: $(vars.region) new_bits: 8 - - id: workstation + - id: one-used-existing-ni source: ./modules/compute/vm-instance use: - - network1 + - default + settings: + name_prefix: one-used-existing-ni + machine_type: n2-standard-2 + + - id: one-used-new-ni + source: ./modules/compute/vm-instance + use: + - new-network-1 + settings: + name_prefix: one-used-new-ni + machine_type: n2-standard-2 + + - id: one-explicit-existing-ni + source: ./modules/compute/vm-instance settings: - additional_network_interfaces: - - subnetwork: $(network2.subnetwork_self_link) + name_prefix: one-explicit-existing-ni + machine_type: n2-standard-2 + network_interfaces: + - network: null + subnetwork: $(default.subnetwork_self_link) + subnetwork_project: $(vars.project_id) + network_ip: null + stack_type: null + access_config: [] + ipv6_access_config: [] + alias_ip_range: [] + nic_type: VIRTIO_NET + queue_count: null + + - id: one-explicit-new-ni + source: ./modules/compute/vm-instance + settings: + name_prefix: one-explicit-new-ni + machine_type: n2-standard-2 + network_interfaces: + - network: null + subnetwork: $(new-network-1.subnetwork_self_link) + subnetwork_project: $(vars.project_id) + network_ip: null + stack_type: null + access_config: [] + ipv6_access_config: [] + alias_ip_range: [] + nic_type: VIRTIO_NET + queue_count: null + + - id: two-explicit-mixed-ni + source: ./modules/compute/vm-instance + settings: + name_prefix: two-explicit-mixed-ni + network_interfaces: + - network: null + subnetwork: $(default.subnetwork_self_link) + subnetwork_project: $(vars.project_id) + network_ip: null + stack_type: null + access_config: + - nat_ip: null + public_ptr_domain_name: null + network_tier: null + ipv6_access_config: [] + alias_ip_range: [] + nic_type: null + queue_count: 8 + - network: null + subnetwork: $(new-network-1.subnetwork_self_link) + subnetwork_project: $(vars.project_id) + network_ip: null + stack_type: null + access_config: [] + ipv6_access_config: [] + alias_ip_range: [] nic_type: GVNIC queue_count: 12 - disable_public_ips: false - - subnetwork: $(network3.subnetwork_self_link) + + - id: two-explicit-new-ni + source: ./modules/compute/vm-instance + settings: + name_prefix: two-explicit-new-ni + network_interfaces: + - network: null + subnetwork: $(new-network-1.subnetwork_self_link) + subnetwork_project: $(vars.project_id) + network_ip: null + stack_type: null + access_config: [] + ipv6_access_config: [] + alias_ip_range: [] + nic_type: null + queue_count: 8 + - network: null + subnetwork: $(new-network-2.subnetwork_self_link) + subnetwork_project: $(vars.project_id) + network_ip: null + stack_type: null + access_config: + - nat_ip: null + public_ptr_domain_name: null + network_tier: null + ipv6_access_config: [] + alias_ip_range: [] nic_type: GVNIC queue_count: 12 From 5ed9c0996ebce5fedd6956ca01ff367c40481dd4 Mon Sep 17 00:00:00 2001 From: Alex Heye Date: Tue, 11 Oct 2022 23:59:19 +0000 Subject: [PATCH 12/61] Fix link to the hpc-cluster-localssd example The "yaml" characters were missing, and have been added back. --- examples/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/README.md b/examples/README.md index bda45e4ff8..eeece90304 100644 --- a/examples/README.md +++ b/examples/README.md @@ -24,7 +24,7 @@ md_toc github examples/README.md | sed -e "s/\s-\s/ * /" * [spack-gromacs.yaml](#spack-gromacsyaml--) * [omnia-cluster.yaml](#omnia-clusteryaml--) * [hpc-cluster-small-sharedvpc.yaml](#hpc-cluster-small-sharedvpcyaml--) - * [hpc-cluster-localssd.yaml](#hpc-cluster-localssd--) + * [hpc-cluster-localssd.yaml](#hpc-cluster-localssdyaml--) * [htcondor-pool.yaml](#htcondor-poolyaml--) * [quantum-circuit-simulator.yaml](#quantum-circuit-simulatoryaml-) * [Blueprint Schema](#blueprint-schema) From d071b256f1796effbdd998593ea937fbacf9f504 Mon Sep 17 00:00:00 2001 From: Carlos Boneti Date: Tue, 11 Oct 2022 19:38:10 -0700 Subject: [PATCH 13/61] Fix EXAScaler issue with Slurm-on-GCP V5 Signed-off-by: Carlos Boneti --- community/modules/file-system/DDN-EXAScaler/outputs.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/community/modules/file-system/DDN-EXAScaler/outputs.tf b/community/modules/file-system/DDN-EXAScaler/outputs.tf index 4713a921a5..3b99ad8702 100644 --- a/community/modules/file-system/DDN-EXAScaler/outputs.tf +++ b/community/modules/file-system/DDN-EXAScaler/outputs.tf @@ -68,7 +68,7 @@ output "network_storage" { description = "Describes a EXAScaler system to be mounted by other systems." value = { server_ip = split(":", split(" ", module.ddn_exascaler.mount_command)[3])[0] - remote_mount = var.fsname + remote_mount = length(regexall("^/.*", var.fsname)) > 0 ? var.fsname : format("/%s", var.fsname) local_mount = var.local_mount != null ? var.local_mount : format("/mnt/%s", var.fsname) fs_type = "lustre" mount_options = "" From 9dd214f28c7de4d02ce96598a6d96c6f73230c24 Mon Sep 17 00:00:00 2001 From: Carlos Boneti Date: Tue, 11 Oct 2022 22:00:12 -0700 Subject: [PATCH 14/61] Adding fix for pre-existing-network-storage+lustre Similar to previous fix for Exascaler, pre-existing-network-storage will detece any pre-existing / in the remote mount address and add one only when neede. Signed-off-by: Carlos Boneti --- .../pre-existing-network-storage/outputs.tf | 11 ++++++----- .../ddn_exascaler_luster_client_install.tftpl | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/modules/file-system/pre-existing-network-storage/outputs.tf b/modules/file-system/pre-existing-network-storage/outputs.tf index c38ce6b892..43f9e2b567 100644 --- a/modules/file-system/pre-existing-network-storage/outputs.tf +++ b/modules/file-system/pre-existing-network-storage/outputs.tf @@ -26,12 +26,13 @@ output "network_storage" { } locals { + remote_mount_with_slash = length(regexall("^/.*", var.remote_mount)) > 0 ? var.remote_mount : format("/%s", var.remote_mount) # Client Install ddn_lustre_client_install_script = templatefile( "${path.module}/templates/ddn_exascaler_luster_client_install.tftpl", { server_ip = split("@", var.server_ip)[0] - remote_mount = var.remote_mount + remote_mount = local.remote_mount_with_slash local_mount = var.local_mount } ) @@ -41,20 +42,20 @@ locals { } # Mounting - ddn_lustre_mount_cmd = "mount -t ${var.fs_type} ${var.server_ip}:/${var.remote_mount} ${var.local_mount}" + ddn_lustre_mount_cmd = "mount -t ${var.fs_type} ${var.server_ip}:${local.remote_mount_with_slash} ${var.local_mount}" mount_commands = { "lustre" = local.ddn_lustre_mount_cmd } mount_script = <<-EOT #!/bin/bash - findmnt --source ${var.server_ip}:/${var.remote_mount} --target ${var.local_mount} &> /dev/null + findmnt --source ${var.server_ip}:${local.remote_mount_with_slash} --target ${var.local_mount} &> /dev/null if [[ $? != 0 ]]; then - echo "Mounting --source ${var.server_ip}:/${var.remote_mount} --target ${var.local_mount}" + echo "Mounting --source ${var.server_ip}:${local.remote_mount_with_slash} --target ${var.local_mount}" mkdir -p ${var.local_mount} ${lookup(local.mount_commands, var.fs_type, "exit 1")} else - echo "Skipping mounting source: ${var.server_ip}:/${var.remote_mount}, already mounted to target:${var.local_mount}" + echo "Skipping mounting source: ${var.server_ip}:${local.remote_mount_with_slash}, already mounted to target:${var.local_mount}" fi EOT } diff --git a/modules/file-system/pre-existing-network-storage/templates/ddn_exascaler_luster_client_install.tftpl b/modules/file-system/pre-existing-network-storage/templates/ddn_exascaler_luster_client_install.tftpl index 649abc4c4a..f4ae0a9848 100644 --- a/modules/file-system/pre-existing-network-storage/templates/ddn_exascaler_luster_client_install.tftpl +++ b/modules/file-system/pre-existing-network-storage/templates/ddn_exascaler_luster_client_install.tftpl @@ -32,7 +32,7 @@ cat >/etc/esc-client.conf< Date: Wed, 12 Oct 2022 17:27:02 +0000 Subject: [PATCH 15/61] Fix default net interface, formatting improvements --- modules/compute/vm-instance/README.md | 2 +- modules/compute/vm-instance/main.tf | 11 ++++++++--- modules/compute/vm-instance/variables.tf | 6 +++--- .../test_configs/2-network-interfaces.yaml | 14 ++++++++++---- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/modules/compute/vm-instance/README.md b/modules/compute/vm-instance/README.md index 143bdee214..1368ce4703 100644 --- a/modules/compute/vm-instance/README.md +++ b/modules/compute/vm-instance/README.md @@ -149,7 +149,7 @@ No modules. | [machine\_type](#input\_machine\_type) | Machine type to use for the instance creation | `string` | `"c2-standard-60"` | no | | [metadata](#input\_metadata) | Metadata, provided as a map | `map(string)` | `{}` | no | | [name\_prefix](#input\_name\_prefix) | Name Prefix | `string` | `null` | no | -| [network\_interfaces](#input\_network\_interfaces) | A list of network interfaces. The options match that of the terraform
network\_interface block of google\_compute\_instance. For descriptions of the
subfields or more information see the documentation:
https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_instance#nested_network_interface

**\_NOTE:\_** If `network_interfaces` are set, `network_self_link` and
`subnetwork_self_link` will be ignored, even if they are provided through
the `use` field. `bandwidth_tier` and `disable_public_ips` also do not apply
to network interfaces defined in this variable.

Subfields:
network (string, required if subnetwork is not supplied)
subnetwork (string, required if network is not supplied)
subnetwork\_project (string, optional)
network\_ip (string, optional)
nic\_type (string, optional, choose from ["GVNIC", "VIRTIO\_NET"])
stack\_type (string, optional, choose from ["IPV4\_ONLY", "IPV4\_IPV6"])
queue\_count (number, optional)
access\_config (object, optional)
ipv6\_access\_config (object, optional)
alias\_ip\_range (list(object), optional) |
list(object({
network = string,
subnetwork = string,
subnetwork_project = string,
network_ip = string,
nic_type = string,
stack_type = string,
queue_count = number,
access_config = list(object({
nat_ip = string
public_ptr_domain_name = string
network_tier = string
})),
ipv6_access_config = list(object({
public_ptr_domain_name = string,
network_tier = string
})),
alias_ip_range = list(object({
ip_cidr_range = string
subnetwork_range_name = string
}))
}))
| `[]` | no | +| [network\_interfaces](#input\_network\_interfaces) | A list of network interfaces. The options match that of the terraform
network\_interface block of google\_compute\_instance. For descriptions of the
subfields or more information see the documentation:
https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_instance#nested_network_interface

**\_NOTE:\_** If `network_interfaces` are set, `network_self_link` and
`subnetwork_self_link` will be ignored, even if they are provided through
the `use` field. `bandwidth_tier` and `disable_public_ips` also do not apply
to network interfaces defined in this variable.

Subfields:
network (string, required if subnetwork is not supplied)
subnetwork (string, required if network is not supplied)
subnetwork\_project (string, optional)
network\_ip (string, optional)
nic\_type (string, optional, choose from ["GVNIC", "VIRTIO\_NET"])
stack\_type (string, optional, choose from ["IPV4\_ONLY", "IPV4\_IPV6"])
queue\_count (number, optional)
access\_config (object, optional)
ipv6\_access\_config (object, optional)
alias\_ip\_range (list(object), optional) |
list(object({
network = string,
subnetwork = string,
subnetwork_project = string,
network_ip = string,
nic_type = string,
stack_type = string,
queue_count = number,
access_config = list(object({
nat_ip = string,
public_ptr_domain_name = string,
network_tier = string
})),
ipv6_access_config = list(object({
public_ptr_domain_name = string,
network_tier = string
})),
alias_ip_range = list(object({
ip_cidr_range = string,
subnetwork_range_name = string
}))
}))
| `[]` | no | | [network\_self\_link](#input\_network\_self\_link) | The self link of the network to attach the VM. | `string` | `"default"` | no | | [network\_storage](#input\_network\_storage) | An array of network attached storage mounts to be configured. |
list(object({
server_ip = string,
remote_mount = string,
local_mount = string,
fs_type = string,
mount_options = string
}))
| `[]` | no | | [on\_host\_maintenance](#input\_on\_host\_maintenance) | Describes maintenance behavior for the instance. If left blank this will default to `MIGRATE` except for when `placement_policy`, spot provisioning, or GPUs require it to be `TERMINATE` | `string` | `null` | no | diff --git a/modules/compute/vm-instance/main.tf b/modules/compute/vm-instance/main.tf index a97232fcb7..e69d61ca51 100644 --- a/modules/compute/vm-instance/main.tf +++ b/modules/compute/vm-instance/main.tf @@ -64,7 +64,12 @@ locals { # Network Interfaces # Support for `use` input and base network paramters like `network_self_link` and `subnetwork_self_link` - base_network_interface = { + empty_access_config = { + nat_ip = null, + public_ptr_domain_name = null, + network_tier = null + } + default_network_interface = { network = var.network_self_link subnetwork = var.subnetwork_self_link subnetwork_project = var.project_id @@ -72,11 +77,11 @@ locals { nic_type = local.enable_gvnic ? "GVNIC" : null stack_type = null queue_count = null - access_config = var.disable_public_ips ? [] : [{}] + access_config = var.disable_public_ips ? [] : [local.empty_access_config] ipv6_access_config = [] alias_ip_range = [] } - network_interfaces = length(var.network_interfaces) == 0 ? [local.base_network_interface] : var.network_interfaces + network_interfaces = coalescelist(var.network_interfaces, [local.default_network_interface]) } data "google_compute_image" "compute_image" { diff --git a/modules/compute/vm-instance/variables.tf b/modules/compute/vm-instance/variables.tf index 297624d681..84e55d919b 100644 --- a/modules/compute/vm-instance/variables.tf +++ b/modules/compute/vm-instance/variables.tf @@ -169,8 +169,8 @@ variable "network_interfaces" { stack_type = string, queue_count = number, access_config = list(object({ - nat_ip = string - public_ptr_domain_name = string + nat_ip = string, + public_ptr_domain_name = string, network_tier = string })), ipv6_access_config = list(object({ @@ -178,7 +178,7 @@ variable "network_interfaces" { network_tier = string })), alias_ip_range = list(object({ - ip_cidr_range = string + ip_cidr_range = string, subnetwork_range_name = string })) })) diff --git a/tools/validate_configs/test_configs/2-network-interfaces.yaml b/tools/validate_configs/test_configs/2-network-interfaces.yaml index 9af616513c..f721e06893 100644 --- a/tools/validate_configs/test_configs/2-network-interfaces.yaml +++ b/tools/validate_configs/test_configs/2-network-interfaces.yaml @@ -28,7 +28,7 @@ deployment_groups: # Source is an embedded module, denoted by "modules/*" without ./, ../, / # as a prefix. To refer to a local or community module, prefix with ./, ../ or / # Example - ./modules/network/vpc - - id: default + - id: default-network source: modules/network/pre-existing-vpc - id: new-network-1 @@ -50,14 +50,16 @@ deployment_groups: subnet_region: $(vars.region) new_bits: 8 + # Test adding a pre-existing network via "use" - id: one-used-existing-ni source: ./modules/compute/vm-instance use: - - default + - default-network settings: name_prefix: one-used-existing-ni machine_type: n2-standard-2 + # Test adding a newly created network via "use" - id: one-used-new-ni source: ./modules/compute/vm-instance use: @@ -66,6 +68,7 @@ deployment_groups: name_prefix: one-used-new-ni machine_type: n2-standard-2 + # Test adding one pre-existing network via "network_interfaces" - id: one-explicit-existing-ni source: ./modules/compute/vm-instance settings: @@ -73,7 +76,7 @@ deployment_groups: machine_type: n2-standard-2 network_interfaces: - network: null - subnetwork: $(default.subnetwork_self_link) + subnetwork: $(default-network.subnetwork_self_link) subnetwork_project: $(vars.project_id) network_ip: null stack_type: null @@ -83,6 +86,7 @@ deployment_groups: nic_type: VIRTIO_NET queue_count: null + # Test adding one newly created network via "network_interfaces" - id: one-explicit-new-ni source: ./modules/compute/vm-instance settings: @@ -100,13 +104,14 @@ deployment_groups: nic_type: VIRTIO_NET queue_count: null + # Test adding both a pre-existing network and a newly created network via "network_interfaces" - id: two-explicit-mixed-ni source: ./modules/compute/vm-instance settings: name_prefix: two-explicit-mixed-ni network_interfaces: - network: null - subnetwork: $(default.subnetwork_self_link) + subnetwork: $(default-network.subnetwork_self_link) subnetwork_project: $(vars.project_id) network_ip: null stack_type: null @@ -129,6 +134,7 @@ deployment_groups: nic_type: GVNIC queue_count: 12 + # Test adding two newly created networks via "network_interfaces" - id: two-explicit-new-ni source: ./modules/compute/vm-instance settings: From 430c13e85c8d096ac640e8c3a82e54332bd2489c Mon Sep 17 00:00:00 2001 From: Thiago Sgobe Date: Thu, 13 Oct 2022 09:16:17 -0300 Subject: [PATCH 16/61] Add tests --- pkg/modulewriter/modulewriter_test.go | 94 +++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) diff --git a/pkg/modulewriter/modulewriter_test.go b/pkg/modulewriter/modulewriter_test.go index 75c7e65294..8f6d2fe0f7 100644 --- a/pkg/modulewriter/modulewriter_test.go +++ b/pkg/modulewriter/modulewriter_test.go @@ -639,6 +639,55 @@ func (s *MySuite) TestWriteProviders(c *C) { c.Assert(exists, Equals, true) } +func (s *MySuite) TestHandleLiteralVariables(c *C) { + // Setup + hclFile := hclwrite.NewEmptyFile() + hclBody := hclFile.Body() + + // Set literal var value + hclBody.SetAttributeValue("dummyAttributeName1", cty.StringVal("((var.literal))")) + + // Set escaped var value + hclBody.SetAttributeValue("dummyAttributeName2", cty.StringVal("\\((not.var))")) + hclBody.SetAttributeValue("dummyAttributeName3", cty.StringVal("abc\\((not.var))abc")) + hclBody.SetAttributeValue("dummyAttributeName4", cty.StringVal("abc \\((not.var)) abc")) + hclBody.AppendNewline() + hclBytes := handleLiteralVariables(hclFile.Bytes()) + hclString := string(hclBytes) + + // Sucess + exists := strings.Contains(hclString, "dummyAttributeName1 = var.literal") + c.Assert(exists, Equals, true) + exists = strings.Contains(hclString, "dummyAttributeName2 = \"((not.var))\"") + c.Assert(exists, Equals, true) + exists = strings.Contains(hclString, "dummyAttributeName3 = \"abc((not.var))abc\"") + c.Assert(exists, Equals, true) + exists = strings.Contains(hclString, "dummyAttributeName4 = \"abc ((not.var)) abc\"") + c.Assert(exists, Equals, true) +} + +func (s *MySuite) TestHandleBlueprintVariables(c *C) { + // Setup + hclFile := hclwrite.NewEmptyFile() + hclBody := hclFile.Body() + + // Set escaped var value + hclBody.SetAttributeValue("dummyAttributeName1", cty.StringVal("\\$(not.var)")) + hclBody.SetAttributeValue("dummyAttributeName2", cty.StringVal("abc\\$(not.var)abc")) + hclBody.SetAttributeValue("dummyAttributeName3", cty.StringVal("abc \\$(not.var) abc")) + hclBody.AppendNewline() + hclBytes := handleBlueprintVariables(hclFile.Bytes()) + hclString := string(hclBytes) + + // Sucess + exists := strings.Contains(hclString, "dummyAttributeName1 = \"$(not.var)\"") + c.Assert(exists, Equals, true) + exists = strings.Contains(hclString, "dummyAttributeName2 = \"abc$(not.var)abc\"") + c.Assert(exists, Equals, true) + exists = strings.Contains(hclString, "dummyAttributeName3 = \"abc $(not.var) abc\"") + c.Assert(exists, Equals, true) +} + // packerwriter.go func (s *MySuite) TestNumModules_PackerWriter(c *C) { testWriter := PackerWriter{} @@ -704,6 +753,51 @@ func (s *MySuite) TestWritePackerAutoVars(c *C) { } +// hcl_utils.go +func (s *MySuite) TestescapeLiteralVariables(c *C) { + // Setup + hclFile := hclwrite.NewEmptyFile() + hclBody := hclFile.Body() + + // Set escaped var value + hclBody.SetAttributeValue("dummyAttributeName1", cty.StringVal("\\((not.var))")) + hclBody.SetAttributeValue("dummyAttributeName2", cty.StringVal("abc\\((not.var))abc")) + hclBody.SetAttributeValue("dummyAttributeName3", cty.StringVal("abc \\((not.var)) abc")) + hclBody.AppendNewline() + hclBytes := escapeLiteralVariables(hclFile.Bytes()) + hclString := string(hclBytes) + + // Sucess + exists := strings.Contains(hclString, "dummyAttributeName1 = \"((not.var))\"") + c.Assert(exists, Equals, true) + exists = strings.Contains(hclString, "dummyAttributeName2 = \"abc((not.var))abc\"") + c.Assert(exists, Equals, true) + exists = strings.Contains(hclString, "dummyAttributeName3 = \"abc ((not.var)) abc\"") + c.Assert(exists, Equals, true) +} + +func (s *MySuite) TestescapeBlueprintVariables(c *C) { + // Setup + hclFile := hclwrite.NewEmptyFile() + hclBody := hclFile.Body() + + // Set escaped var value + hclBody.SetAttributeValue("dummyAttributeName1", cty.StringVal("\\$(not.var)")) + hclBody.SetAttributeValue("dummyAttributeName2", cty.StringVal("abc\\$(not.var)abc")) + hclBody.SetAttributeValue("dummyAttributeName3", cty.StringVal("abc \\$(not.var) abc")) + hclBody.AppendNewline() + hclBytes := escapeBlueprintVariables(hclFile.Bytes()) + hclString := string(hclBytes) + + // Sucess + exists := strings.Contains(hclString, "dummyAttributeName1 = \"$(not.var)\"") + c.Assert(exists, Equals, true) + exists = strings.Contains(hclString, "dummyAttributeName2 = \"abc$(not.var)abc\"") + c.Assert(exists, Equals, true) + exists = strings.Contains(hclString, "dummyAttributeName3 = \"abc $(not.var) abc\"") + c.Assert(exists, Equals, true) +} + func TestMain(m *testing.M) { setup() code := m.Run() From ab65ad301d5fa56a2c461458152a2f7b502bc6fc Mon Sep 17 00:00:00 2001 From: Nick Stroud Date: Thu, 13 Oct 2022 10:38:20 -0700 Subject: [PATCH 17/61] Refactor mount shell script to take args --- .../pre-existing-network-storage/outputs.tf | 20 +++++--------- .../scripts/mount.sh | 27 +++++++++++++++++++ 2 files changed, 34 insertions(+), 13 deletions(-) create mode 100644 modules/file-system/pre-existing-network-storage/scripts/mount.sh diff --git a/modules/file-system/pre-existing-network-storage/outputs.tf b/modules/file-system/pre-existing-network-storage/outputs.tf index 43f9e2b567..874cda011e 100644 --- a/modules/file-system/pre-existing-network-storage/outputs.tf +++ b/modules/file-system/pre-existing-network-storage/outputs.tf @@ -46,18 +46,7 @@ locals { mount_commands = { "lustre" = local.ddn_lustre_mount_cmd } - - mount_script = <<-EOT - #!/bin/bash - findmnt --source ${var.server_ip}:${local.remote_mount_with_slash} --target ${var.local_mount} &> /dev/null - if [[ $? != 0 ]]; then - echo "Mounting --source ${var.server_ip}:${local.remote_mount_with_slash} --target ${var.local_mount}" - mkdir -p ${var.local_mount} - ${lookup(local.mount_commands, var.fs_type, "exit 1")} - else - echo "Skipping mounting source: ${var.server_ip}:${local.remote_mount_with_slash}, already mounted to target:${var.local_mount}" - fi - EOT + mount_command = lookup(local.mount_commands, var.fs_type, "exit 1") } output "client_install_runner" { @@ -73,7 +62,12 @@ output "mount_runner" { description = "Runner that mounts the file system." value = { "type" = "shell" - "content" = (lookup(local.mount_commands, var.fs_type, null) == null ? "echo 'skipping: mount_runner not yet supported for ${var.fs_type}'" : local.mount_script) "destination" = "mount_filesystem${replace(var.local_mount, "/", "_")}.sh" + "args" = "\"${var.server_ip}\" \"${local.remote_mount_with_slash}\" \"${var.local_mount}\" \"${local.mount_command}\"" + "content" = ( + lookup(local.mount_commands, var.fs_type, null) == null ? + "echo 'skipping: mount_runner not yet supported for ${var.fs_type}'" : + file("${path.module}/scripts/mount.sh") + ) } } diff --git a/modules/file-system/pre-existing-network-storage/scripts/mount.sh b/modules/file-system/pre-existing-network-storage/scripts/mount.sh new file mode 100644 index 0000000000..3b3c5fff70 --- /dev/null +++ b/modules/file-system/pre-existing-network-storage/scripts/mount.sh @@ -0,0 +1,27 @@ +#!/bin/bash +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +SERVER_IP=$1 +REMOTE_MOUNT_WITH_SLASH=$2 +LOCAL_MOUNT=$3 +MOUNT_COMMAND=$4 + +if ! findmnt --source "${SERVER_IP}":"${REMOTE_MOUNT_WITH_SLASH}" --target "${LOCAL_MOUNT}" &>/dev/null; then + echo "Mounting --source ${SERVER_IP}:${REMOTE_MOUNT_WITH_SLASH} --target ${LOCAL_MOUNT}" + mkdir -p "${LOCAL_MOUNT}" + ${MOUNT_COMMAND} +else + echo "Skipping mounting source: ${SERVER_IP}:${REMOTE_MOUNT_WITH_SLASH}, already mounted to target:${LOCAL_MOUNT}" +fi From 4edd5d52e41b6e854a1c35d320e54a56697a40eb Mon Sep 17 00:00:00 2001 From: Ross Thomson Date: Thu, 13 Oct 2022 15:18:52 -0400 Subject: [PATCH 18/61] Added Simcenter StarCCM+ tutorial blueprint. --- community/examples/README.md | 4 ++ community/examples/starccm-tutorial.yaml | 71 ++++++++++++++++++++++++ examples/README.md | 8 +++ 3 files changed, 83 insertions(+) create mode 100644 community/examples/starccm-tutorial.yaml diff --git a/community/examples/README.md b/community/examples/README.md index 9be820a295..ebf4f980d3 100644 --- a/community/examples/README.md +++ b/community/examples/README.md @@ -54,3 +54,7 @@ Examples using Intel HPC technologies can be found in the ### quantum-circuit-simulator.yaml [See description in core](../../examples/README.md#quantum-circuit-simulatoryaml-) + +### starccm-tutorial.yaml + +[See description in core](../../examples/README.md#starccm-tutorialyaml--) \ No newline at end of file diff --git a/community/examples/starccm-tutorial.yaml b/community/examples/starccm-tutorial.yaml new file mode 100644 index 0000000000..5b5c2dbef0 --- /dev/null +++ b/community/examples/starccm-tutorial.yaml @@ -0,0 +1,71 @@ +blueprint_name: starccm + +vars: + project_id: ## Set GCP Project ID Here ## + deployment_name: starccm + region: us-east4 + zone: us-east4-c + +deployment_groups: +- group: primary + modules: + - source: modules/scripts/startup-script + kind: terraform + id: startup + settings: + runners: + - type: shell + content: | + #!/bin/bash + sudo google_mpi_tuning --hpcthroughput + sudo google_mpi_tuning --nomitigation + sudo yum -y install libExt libXext.x86_64 nmap + destination: /tmp/install-deps.sh + + - type: shell + source: modules/startup-script/examples/install_ansible.sh + destination: install_ansible.sh + + - type: shell + content: $(homefs.install_nfs_client) + destination: "/tmp/nfs_client.sh" + + - $(homefs.mount_runner) + + - source: modules/network/vpc + kind: terraform + id: network1 + + - source: modules/file-system/filestore + kind: terraform + id: homefs + use: [network1] + settings: + size_gb: 1024 + filestore_tier: "BASIC_HDD" + local_mount: /home + + - source: modules/compute/vm-instance + kind: terraform + id: compute_1 + use: + - network1 + - homefs + - startup + + settings: + threads_per_core: 1 + disable_public_ips: true + bandwidth_tier: "gvnic_enabled" + machine_type: c2-standard-60 + instance_count: 4 + placement_policy: + vm_count: 4 # Note: should match instance count + collocation: "COLLOCATED" + availability_domain_count: null + + - source: community/modules/scripts/wait-for-startup + kind: terraform + id: wait + settings: + instance_name: ((module.compute_1.name[0])) diff --git a/examples/README.md b/examples/README.md index eeece90304..bc7e8347bb 100644 --- a/examples/README.md +++ b/examples/README.md @@ -27,6 +27,7 @@ md_toc github examples/README.md | sed -e "s/\s-\s/ * /" * [hpc-cluster-localssd.yaml](#hpc-cluster-localssdyaml--) * [htcondor-pool.yaml](#htcondor-poolyaml--) * [quantum-circuit-simulator.yaml](#quantum-circuit-simulatoryaml-) + * [starccm-tutorial.yaml](#starccm-tutorialyaml--) * [Blueprint Schema](#blueprint-schema) * [Writing an HPC Blueprint](#writing-an-hpc-blueprint) * [Top Level Parameters](#top-level-parameters) @@ -564,6 +565,13 @@ python /var/tmp/qsim-example.py [cqsdk]: https://developer.nvidia.com/cuquantum-sdk [cudatk]: https://developer.nvidia.com/cuda-toolkit +### [starccm-tutorial.yaml] ![community-badge] ![experimental-badge] + +This blueprint provisions a simple cluster for use with a Simcenter StarCCM+ +tutorial. + +>> Not yet published. + ## Blueprint Schema Similar documentation can be found on From 0605bad51ceb1a3d5e8660727c5db375ed7119c9 Mon Sep 17 00:00:00 2001 From: Alex Heye Date: Thu, 13 Oct 2022 20:25:00 +0000 Subject: [PATCH 19/61] Formatting updates, add license to blueprint Co-authored-by: Ross Thomson --- community/examples/README.md | 4 ++-- community/examples/starccm-tutorial.yaml | 20 ++++++++++++++++++-- examples/README.md | 6 ++++-- 3 files changed, 24 insertions(+), 6 deletions(-) diff --git a/community/examples/README.md b/community/examples/README.md index ebf4f980d3..1309c4365f 100644 --- a/community/examples/README.md +++ b/community/examples/README.md @@ -55,6 +55,6 @@ Examples using Intel HPC technologies can be found in the [See description in core](../../examples/README.md#quantum-circuit-simulatoryaml-) -### starccm-tutorial.yaml +### starccm-tutorial.yaml -[See description in core](../../examples/README.md#starccm-tutorialyaml--) \ No newline at end of file +[See description in core](../../examples/README.md#starccm-tutorialyaml--) diff --git a/community/examples/starccm-tutorial.yaml b/community/examples/starccm-tutorial.yaml index 5b5c2dbef0..d50a9a8878 100644 --- a/community/examples/starccm-tutorial.yaml +++ b/community/examples/starccm-tutorial.yaml @@ -1,7 +1,23 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +--- + blueprint_name: starccm vars: - project_id: ## Set GCP Project ID Here ## + project_id: ## Set GCP Project ID Here ## deployment_name: starccm region: us-east4 zone: us-east4-c @@ -63,7 +79,7 @@ deployment_groups: vm_count: 4 # Note: should match instance count collocation: "COLLOCATED" availability_domain_count: null - + - source: community/modules/scripts/wait-for-startup kind: terraform id: wait diff --git a/examples/README.md b/examples/README.md index bc7e8347bb..cd07435abb 100644 --- a/examples/README.md +++ b/examples/README.md @@ -568,9 +568,11 @@ python /var/tmp/qsim-example.py ### [starccm-tutorial.yaml] ![community-badge] ![experimental-badge] This blueprint provisions a simple cluster for use with a Simcenter StarCCM+ -tutorial. +tutorial. ->> Not yet published. +> **_NOTE:_** The tutorial has not yet been published. + +[starccm-tutorial.yaml]: ../community/examples/starccm-tutorial.yaml ## Blueprint Schema From f56f6114ac1fc4b011587ac1d2db7b3c79589e8e Mon Sep 17 00:00:00 2001 From: Alex Heye Date: Thu, 13 Oct 2022 20:59:28 +0000 Subject: [PATCH 20/61] Add info on connecting VPC networks to vm-instance Adds documentation in the vm-instance module README on how the network variables interact. --- modules/compute/vm-instance/README.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/modules/compute/vm-instance/README.md b/modules/compute/vm-instance/README.md index 1368ce4703..5ac46c087c 100644 --- a/modules/compute/vm-instance/README.md +++ b/modules/compute/vm-instance/README.md @@ -27,6 +27,32 @@ This creates a cluster of 8 compute VMs that are: > physical cores visible. To change this, set `threads_per_core=2` under > settings. +### VPC Networks + +There are two methods for adding network connectivity to the `vm-instance` +module. The first is shown in the example above, where a `vpc` module or +`pre-existing-vpc` module is used by the `vm-instance` module. When this +happens, the `network_self_link` and `subnetwork_self_link` outputs from the +network are provided as input to the `vm-instance` and a network interface is +defined based on that. This can also be done updating the `network_self_link` and +`subnetwork_self_link` settings directly. + +The alternative option can be used when more than one network needs to be added +to the `vm-instance` or further customization is needed beyond what is provided +via other variables. For this option, the `network_interfaces` variable can be +used to set up one or more network interfaces on the VM instance. The format is +consistent with the terraform `google_compute_instance` `network_interface` +block, and more information can be found in the +[terraform docs][network-interface-tf]. + +> **_NOTE:_** When supplying the `network_interfaces` variable, networks +> associated with the `vm-instance` via use will be ignored in favor of the +> networks added in `network_interfaces`. In addition, `bandwidth_tier` and +> `disable_public_ips` will not apply to networks defined in +> `network_interfaces`. + +[network-interface-tf]: https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/compute_instance#nested_network_interface + ### SSH key metadata This module will ignore all changes to the `ssh-keys` metadata field that are From bd5307abd40fcb334a12c6852da7e575ec220368 Mon Sep 17 00:00:00 2001 From: Thiago Sgobe Date: Thu, 13 Oct 2022 19:52:35 -0300 Subject: [PATCH 21/61] consolidate functions into hcl_utils --- pkg/modulewriter/hcl_utils.go | 8 +++--- pkg/modulewriter/modulewriter_test.go | 39 +++++---------------------- pkg/modulewriter/tfwriter.go | 21 +++++---------- 3 files changed, 17 insertions(+), 51 deletions(-) diff --git a/pkg/modulewriter/hcl_utils.go b/pkg/modulewriter/hcl_utils.go index 2bf2398413..aa84501dd4 100644 --- a/pkg/modulewriter/hcl_utils.go +++ b/pkg/modulewriter/hcl_utils.go @@ -25,14 +25,14 @@ import ( func escapeBlueprintVariables(hclBytes []byte) []byte { // Convert \$(not.variable) to $(not.variable) - re := regexp.MustCompile(`\\\\\$\((.*?)\)`) - return re.ReplaceAll(hclBytes, []byte(`$(${1})`)) + re := regexp.MustCompile(`\\\\\$\(`) + return re.ReplaceAll(hclBytes, []byte(`$(`)) } func escapeLiteralVariables(hclBytes []byte) []byte { // Convert \((not.variable)) to ((not.variable)) - re := regexp.MustCompile(`\\\\\(\((.*?)\)\)`) - return re.ReplaceAll(hclBytes, []byte(`((${1}))`)) + re := regexp.MustCompile(`\\\\\(\(`) + return re.ReplaceAll(hclBytes, []byte(`((`)) } func writeHclAttributes(vars map[string]cty.Value, dst string) error { diff --git a/pkg/modulewriter/modulewriter_test.go b/pkg/modulewriter/modulewriter_test.go index 8f6d2fe0f7..6b6dae6f37 100644 --- a/pkg/modulewriter/modulewriter_test.go +++ b/pkg/modulewriter/modulewriter_test.go @@ -646,11 +646,6 @@ func (s *MySuite) TestHandleLiteralVariables(c *C) { // Set literal var value hclBody.SetAttributeValue("dummyAttributeName1", cty.StringVal("((var.literal))")) - - // Set escaped var value - hclBody.SetAttributeValue("dummyAttributeName2", cty.StringVal("\\((not.var))")) - hclBody.SetAttributeValue("dummyAttributeName3", cty.StringVal("abc\\((not.var))abc")) - hclBody.SetAttributeValue("dummyAttributeName4", cty.StringVal("abc \\((not.var)) abc")) hclBody.AppendNewline() hclBytes := handleLiteralVariables(hclFile.Bytes()) hclString := string(hclBytes) @@ -658,34 +653,6 @@ func (s *MySuite) TestHandleLiteralVariables(c *C) { // Sucess exists := strings.Contains(hclString, "dummyAttributeName1 = var.literal") c.Assert(exists, Equals, true) - exists = strings.Contains(hclString, "dummyAttributeName2 = \"((not.var))\"") - c.Assert(exists, Equals, true) - exists = strings.Contains(hclString, "dummyAttributeName3 = \"abc((not.var))abc\"") - c.Assert(exists, Equals, true) - exists = strings.Contains(hclString, "dummyAttributeName4 = \"abc ((not.var)) abc\"") - c.Assert(exists, Equals, true) -} - -func (s *MySuite) TestHandleBlueprintVariables(c *C) { - // Setup - hclFile := hclwrite.NewEmptyFile() - hclBody := hclFile.Body() - - // Set escaped var value - hclBody.SetAttributeValue("dummyAttributeName1", cty.StringVal("\\$(not.var)")) - hclBody.SetAttributeValue("dummyAttributeName2", cty.StringVal("abc\\$(not.var)abc")) - hclBody.SetAttributeValue("dummyAttributeName3", cty.StringVal("abc \\$(not.var) abc")) - hclBody.AppendNewline() - hclBytes := handleBlueprintVariables(hclFile.Bytes()) - hclString := string(hclBytes) - - // Sucess - exists := strings.Contains(hclString, "dummyAttributeName1 = \"$(not.var)\"") - c.Assert(exists, Equals, true) - exists = strings.Contains(hclString, "dummyAttributeName2 = \"abc$(not.var)abc\"") - c.Assert(exists, Equals, true) - exists = strings.Contains(hclString, "dummyAttributeName3 = \"abc $(not.var) abc\"") - c.Assert(exists, Equals, true) } // packerwriter.go @@ -763,6 +730,7 @@ func (s *MySuite) TestescapeLiteralVariables(c *C) { hclBody.SetAttributeValue("dummyAttributeName1", cty.StringVal("\\((not.var))")) hclBody.SetAttributeValue("dummyAttributeName2", cty.StringVal("abc\\((not.var))abc")) hclBody.SetAttributeValue("dummyAttributeName3", cty.StringVal("abc \\((not.var)) abc")) + hclBody.SetAttributeValue("dummyAttributeName4", cty.StringVal("abc \\((not.var1)) abc \\((not.var2)) abc")) hclBody.AppendNewline() hclBytes := escapeLiteralVariables(hclFile.Bytes()) hclString := string(hclBytes) @@ -774,6 +742,8 @@ func (s *MySuite) TestescapeLiteralVariables(c *C) { c.Assert(exists, Equals, true) exists = strings.Contains(hclString, "dummyAttributeName3 = \"abc ((not.var)) abc\"") c.Assert(exists, Equals, true) + exists = strings.Contains(hclString, "dummyAttributeName4 = \"abc ((not.var1)) abc ((not.var2)) abc\"") + c.Assert(exists, Equals, true) } func (s *MySuite) TestescapeBlueprintVariables(c *C) { @@ -785,6 +755,7 @@ func (s *MySuite) TestescapeBlueprintVariables(c *C) { hclBody.SetAttributeValue("dummyAttributeName1", cty.StringVal("\\$(not.var)")) hclBody.SetAttributeValue("dummyAttributeName2", cty.StringVal("abc\\$(not.var)abc")) hclBody.SetAttributeValue("dummyAttributeName3", cty.StringVal("abc \\$(not.var) abc")) + hclBody.SetAttributeValue("dummyAttributeName4", cty.StringVal("abc \\$(not.var1) abc \\$(not.var2) abc")) hclBody.AppendNewline() hclBytes := escapeBlueprintVariables(hclFile.Bytes()) hclString := string(hclBytes) @@ -796,6 +767,8 @@ func (s *MySuite) TestescapeBlueprintVariables(c *C) { c.Assert(exists, Equals, true) exists = strings.Contains(hclString, "dummyAttributeName3 = \"abc $(not.var) abc\"") c.Assert(exists, Equals, true) + exists = strings.Contains(hclString, "dummyAttributeName4 = \"abc $(not.var1) abc $(not.var2) abc\"") + c.Assert(exists, Equals, true) } func TestMain(m *testing.M) { diff --git a/pkg/modulewriter/tfwriter.go b/pkg/modulewriter/tfwriter.go index 0b4de88611..d6a5d3d5b0 100644 --- a/pkg/modulewriter/tfwriter.go +++ b/pkg/modulewriter/tfwriter.go @@ -64,19 +64,9 @@ func createBaseFile(path string) error { return err } -func handleBlueprintVariables(hclBytes []byte) []byte { - // Convert \$(not.variable) to $(not.variable) - re := regexp.MustCompile(`\\\\\$\((.*?)\)`) - return re.ReplaceAll(hclBytes, []byte(`$(${1})`)) -} - func handleLiteralVariables(hclBytes []byte) []byte { - // Convert ((var.variable)) to var.variable re := regexp.MustCompile(`"\(\((.*?)\)\)"`) - hclBytes = re.ReplaceAll(hclBytes, []byte(`${1}`)) - // Convert \((not.variable)) to ((not.variable)) - re = regexp.MustCompile(`\\\\\(\((.*?)\)\)`) - return re.ReplaceAll(hclBytes, []byte(`((${1}))`)) + return re.ReplaceAll(hclBytes, []byte(`${1}`)) } func appendHCLToFile(path string, hclBytes []byte) error { @@ -124,7 +114,8 @@ func writeOutputs( // Write file hclBytes := handleLiteralVariables(hclFile.Bytes()) - hclBytes = handleBlueprintVariables(hclBytes) + hclBytes = escapeLiteralVariables(hclBytes) + hclBytes = escapeBlueprintVariables(hclBytes) err := appendHCLToFile(outputsPath, hclBytes) if err != nil { return fmt.Errorf("error writing HCL to outputs.tf file: %v", err) @@ -298,7 +289,8 @@ func writeMain( } // Write file hclBytes := handleLiteralVariables(hclFile.Bytes()) - hclBytes = handleBlueprintVariables(hclBytes) + hclBytes = escapeLiteralVariables(hclBytes) + hclBytes = escapeBlueprintVariables(hclBytes) if err := appendHCLToFile(mainPath, hclBytes); err != nil { return fmt.Errorf("error writing HCL to main.tf file: %v", err) } @@ -353,7 +345,8 @@ func writeProviders(vars map[string]cty.Value, dst string) error { // Write file hclBytes := handleLiteralVariables(hclFile.Bytes()) - hclBytes = handleBlueprintVariables(hclBytes) + hclBytes = escapeLiteralVariables(hclBytes) + hclBytes = escapeBlueprintVariables(hclBytes) if err := appendHCLToFile(providersPath, hclBytes); err != nil { return fmt.Errorf("error writing HCL to providers.tf file: %v", err) } From cc6fb494df9e7c518c5c7e40eea72a372832afca Mon Sep 17 00:00:00 2001 From: Thiago Sgobe Date: Fri, 14 Oct 2022 09:47:47 -0300 Subject: [PATCH 22/61] Add escaped backslash tests --- pkg/modulewriter/modulewriter_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/modulewriter/modulewriter_test.go b/pkg/modulewriter/modulewriter_test.go index 6b6dae6f37..a95f9884d6 100644 --- a/pkg/modulewriter/modulewriter_test.go +++ b/pkg/modulewriter/modulewriter_test.go @@ -731,6 +731,7 @@ func (s *MySuite) TestescapeLiteralVariables(c *C) { hclBody.SetAttributeValue("dummyAttributeName2", cty.StringVal("abc\\((not.var))abc")) hclBody.SetAttributeValue("dummyAttributeName3", cty.StringVal("abc \\((not.var)) abc")) hclBody.SetAttributeValue("dummyAttributeName4", cty.StringVal("abc \\((not.var1)) abc \\((not.var2)) abc")) + hclBody.SetAttributeValue("dummyAttributeName5", cty.StringVal("abc \\\\((escape.backslash))")) hclBody.AppendNewline() hclBytes := escapeLiteralVariables(hclFile.Bytes()) hclString := string(hclBytes) @@ -744,6 +745,8 @@ func (s *MySuite) TestescapeLiteralVariables(c *C) { c.Assert(exists, Equals, true) exists = strings.Contains(hclString, "dummyAttributeName4 = \"abc ((not.var1)) abc ((not.var2)) abc\"") c.Assert(exists, Equals, true) + exists = strings.Contains(hclString, "dummyAttributeName5 = \"abc \\\\((escape.backslash))\"") + c.Assert(exists, Equals, true) } func (s *MySuite) TestescapeBlueprintVariables(c *C) { @@ -756,6 +759,7 @@ func (s *MySuite) TestescapeBlueprintVariables(c *C) { hclBody.SetAttributeValue("dummyAttributeName2", cty.StringVal("abc\\$(not.var)abc")) hclBody.SetAttributeValue("dummyAttributeName3", cty.StringVal("abc \\$(not.var) abc")) hclBody.SetAttributeValue("dummyAttributeName4", cty.StringVal("abc \\$(not.var1) abc \\$(not.var2) abc")) + hclBody.SetAttributeValue("dummyAttributeName5", cty.StringVal("abc \\\\$(escape.backslash)")) hclBody.AppendNewline() hclBytes := escapeBlueprintVariables(hclFile.Bytes()) hclString := string(hclBytes) @@ -769,6 +773,8 @@ func (s *MySuite) TestescapeBlueprintVariables(c *C) { c.Assert(exists, Equals, true) exists = strings.Contains(hclString, "dummyAttributeName4 = \"abc $(not.var1) abc $(not.var2) abc\"") c.Assert(exists, Equals, true) + exists = strings.Contains(hclString, "dummyAttributeName5 = \"abc \\\\$(escape.backslash)\"") + c.Assert(exists, Equals, true) } func TestMain(m *testing.M) { From ab91979f7c2714fecc1af1d9e5a9c4baad15880b Mon Sep 17 00:00:00 2001 From: Nick Stroud Date: Fri, 14 Oct 2022 11:02:51 -0700 Subject: [PATCH 23/61] Move mount command construction inside of shell script --- .../pre-existing-network-storage/outputs.tf | 16 +++++----------- .../scripts/mount.sh | 4 ++-- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/modules/file-system/pre-existing-network-storage/outputs.tf b/modules/file-system/pre-existing-network-storage/outputs.tf index 874cda011e..f4750cf498 100644 --- a/modules/file-system/pre-existing-network-storage/outputs.tf +++ b/modules/file-system/pre-existing-network-storage/outputs.tf @@ -40,13 +40,7 @@ locals { install_scripts = { "lustre" = local.ddn_lustre_client_install_script } - - # Mounting - ddn_lustre_mount_cmd = "mount -t ${var.fs_type} ${var.server_ip}:${local.remote_mount_with_slash} ${var.local_mount}" - mount_commands = { - "lustre" = local.ddn_lustre_mount_cmd - } - mount_command = lookup(local.mount_commands, var.fs_type, "exit 1") + mount_supported_fstype = ["lustre"] } output "client_install_runner" { @@ -63,11 +57,11 @@ output "mount_runner" { value = { "type" = "shell" "destination" = "mount_filesystem${replace(var.local_mount, "/", "_")}.sh" - "args" = "\"${var.server_ip}\" \"${local.remote_mount_with_slash}\" \"${var.local_mount}\" \"${local.mount_command}\"" + "args" = "\"${var.server_ip}\" \"${local.remote_mount_with_slash}\" \"${var.local_mount}\" \"${var.fs_type}\"" "content" = ( - lookup(local.mount_commands, var.fs_type, null) == null ? - "echo 'skipping: mount_runner not yet supported for ${var.fs_type}'" : - file("${path.module}/scripts/mount.sh") + contains(local.mount_supported_fstype, var.fs_type) ? + file("${path.module}/scripts/mount.sh") : + "echo 'skipping: mount_runner not yet supported for ${var.fs_type}'" ) } } diff --git a/modules/file-system/pre-existing-network-storage/scripts/mount.sh b/modules/file-system/pre-existing-network-storage/scripts/mount.sh index 3b3c5fff70..0f130d1276 100644 --- a/modules/file-system/pre-existing-network-storage/scripts/mount.sh +++ b/modules/file-system/pre-existing-network-storage/scripts/mount.sh @@ -16,12 +16,12 @@ SERVER_IP=$1 REMOTE_MOUNT_WITH_SLASH=$2 LOCAL_MOUNT=$3 -MOUNT_COMMAND=$4 +FS_TYPE=$4 if ! findmnt --source "${SERVER_IP}":"${REMOTE_MOUNT_WITH_SLASH}" --target "${LOCAL_MOUNT}" &>/dev/null; then echo "Mounting --source ${SERVER_IP}:${REMOTE_MOUNT_WITH_SLASH} --target ${LOCAL_MOUNT}" mkdir -p "${LOCAL_MOUNT}" - ${MOUNT_COMMAND} + mount -t "${FS_TYPE}" "${SERVER_IP}":"${REMOTE_MOUNT_WITH_SLASH}" "${LOCAL_MOUNT}" else echo "Skipping mounting source: ${SERVER_IP}:${REMOTE_MOUNT_WITH_SLASH}, already mounted to target:${LOCAL_MOUNT}" fi From 78f984918135d1bcb34b406d8692c8bd1f78653c Mon Sep 17 00:00:00 2001 From: Nick Stroud Date: Fri, 14 Oct 2022 12:12:56 -0700 Subject: [PATCH 24/61] Fix: logs were not being captured for invalid return status --- .../wait-for-startup/scripts/wait-for-startup-status.sh | 6 ++++-- .../ansible_playbooks/tasks/rescue_terraform_failure.yml | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/community/modules/scripts/wait-for-startup/scripts/wait-for-startup-status.sh b/community/modules/scripts/wait-for-startup/scripts/wait-for-startup-status.sh index 5a41fd987d..32a0bd2463 100755 --- a/community/modules/scripts/wait-for-startup/scripts/wait-for-startup-status.sh +++ b/community/modules/scripts/wait-for-startup/scripts/wait-for-startup-status.sh @@ -38,14 +38,16 @@ until [ $tries -ge "${RETRIES}" ]; do ((tries++)) done +# This specific text is monitored for in tests, do not change. +INSPECT_OUTPUT_TEXT="to inspect the startup script output, please run:" if [ "${STATUS}" == 0 ]; then echo "startup-script finished successfully" elif [ "${STATUS}" == 1 ]; then - echo "startup-script finished with errors, to inspect the startup script output, please run:" + echo "startup-script finished with errors, ${INSPECT_OUTPUT_TEXT}" echo "${GCLOUD}" else echo "invalid return status '${STATUS}'" - echo "to inspect the startup script output, please run:" + echo "${INSPECT_OUTPUT_TEXT}" echo "${GCLOUD}" exit 1 fi diff --git a/tools/cloud-build/daily-tests/ansible_playbooks/tasks/rescue_terraform_failure.yml b/tools/cloud-build/daily-tests/ansible_playbooks/tasks/rescue_terraform_failure.yml index ac20cb237c..d7c7b4f2aa 100644 --- a/tools/cloud-build/daily-tests/ansible_playbooks/tasks/rescue_terraform_failure.yml +++ b/tools/cloud-build/daily-tests/ansible_playbooks/tasks/rescue_terraform_failure.yml @@ -33,7 +33,7 @@ - name: Get Startup Script Logs ansible.builtin.command: "{{ terraform_apply_stderr | replace('\n',' ') | regex_search('please run: (.+)', '\\1') | first }}" register: serial_port_1_output - when: '"startup-script finished with errors" in terraform_apply_stderr' + when: '"to inspect the startup script output, please run:" in terraform_apply_stderr' failed_when: false - name: Log Startup Script Failure ansible.builtin.debug: From ad4908c6700b46ab9f11e75836ad73a0c35353f9 Mon Sep 17 00:00:00 2001 From: Tom Downes Date: Fri, 14 Oct 2022 14:10:41 -0500 Subject: [PATCH 25/61] Automatically prepend Ansible installation runner if other runners use Ansible --- modules/scripts/startup-script/README.md | 21 +++++++++------------ modules/scripts/startup-script/main.tf | 14 ++++++++++++-- modules/scripts/startup-script/variables.tf | 6 ++++++ 3 files changed, 27 insertions(+), 14 deletions(-) diff --git a/modules/scripts/startup-script/README.md b/modules/scripts/startup-script/README.md index d8ce771ce8..2c7046cd3b 100644 --- a/modules/scripts/startup-script/README.md +++ b/modules/scripts/startup-script/README.md @@ -55,16 +55,15 @@ Each runner receives the following attributes: ### Runner dependencies -The `ansible-local` runner requires ansible to be installed in the VM before -running. To support other playbook runners in the HPC Toolkit, we require -version 2.11 of ansible-core or higher. Note that this is distinct from the -package version used to install ansible with pip. The minimum pip package -of ansible is 4.10.0. +`ansible-local` runners requires Ansible to be installed in the VM before +running. To support other playbook runners in the HPC Toolkit, we install +version 2.11 of `ansible-core` as well as the larger package of collections +found in `ansible` version 4.10.0. -To install ansible, a runner supplied by this module can be added as a prior -runner. An example of this can be found in the [Example](#example) section below -as the first runner in the list of runners. This script will do the following in -your VM instance: +If an `ansible-local` runner is found in the list supplied to this module, +a script to install Ansible will be prepended to the list of runners. This +behavior can be disabled by setting `var.prepend_ansible_installer` to `false`. +This script will do the following at VM startup: - Install system-wide python3 if not already installed using system package managers (yum, apt-get, etc) @@ -143,9 +142,6 @@ sudo journalctl -u google-startup-scripts.service source: ./modules/scripts/startup-script settings: runners: - - type: shell - source: "modules/startup-script/examples/install_ansible.sh" - destination: "install_ansible.sh" # Some modules such as filestore have runners as outputs for convenience: - $(homefs.install_nfs_client_runner) # These runners can still be created manually: @@ -225,6 +221,7 @@ No modules. | [debug\_file](#input\_debug\_file) | Path to an optional local to be written with 'startup\_script'. | `string` | `null` | no | | [deployment\_name](#input\_deployment\_name) | Name of the HPC deployment, used to name GCS bucket for startup scripts. | `string` | n/a | yes | | [labels](#input\_labels) | Labels for the created GCS bucket. List key, value pairs. | `any` | n/a | yes | +| [prepend\_ansible\_installer](#input\_prepend\_ansible\_installer) | Prepend Ansible installation script if any of the specified runners are of type ansible-local | `bool` | `true` | no | | [project\_id](#input\_project\_id) | Project in which the HPC deployment will be created | `string` | n/a | yes | | [region](#input\_region) | The region to deploy to | `string` | n/a | yes | | [runners](#input\_runners) | List of runners to run on remote VM.
Runners can be of type ansible-local, shell or data.
A runner must specify one of 'source' or 'content'.
All runners must specify 'destination'. If 'destination' does not include a
path, it will be copied in a temporary folder and deleted after running.
Runners may also pass 'args', which will be passed as argument to shell runners only. | `list(map(string))` | `[]` | no | diff --git a/modules/scripts/startup-script/main.tf b/modules/scripts/startup-script/main.tf index dd184227f7..acba498456 100644 --- a/modules/scripts/startup-script/main.tf +++ b/modules/scripts/startup-script/main.tf @@ -15,12 +15,22 @@ */ locals { + ansible_installer = { + type = "shell" + source = "${path.module}/examples/install_ansible.sh" + destination = "install_ansible_automatic.sh" + } + + ansible_local_runners = [for r in var.runners : r if r.type == "ansible-local"] + prepend_ansible_installer = length(local.ansible_local_runners) > 0 && var.prepend_ansible_installer + runners = local.prepend_ansible_installer ? concat([local.ansible_installer], var.runners) : var.runners + load_runners = templatefile( "${path.module}/templates/startup-script-custom.tpl", { bucket = google_storage_bucket.configs_bucket.name, runners = [ - for runner in var.runners : { + for runner in local.runners : { object = google_storage_bucket_object.scripts[basename(runner["destination"])].output_name type = runner["type"] destination = runner["destination"] @@ -45,7 +55,7 @@ locals { # Final content output to the user stdlib = join("", local.stdlib_list) - runners_map = { for runner in var.runners : + runners_map = { for runner in local.runners : basename(runner["destination"]) => { content = lookup(runner, "content", null) diff --git a/modules/scripts/startup-script/variables.tf b/modules/scripts/startup-script/variables.tf index 4566aec3d4..0da697f4d4 100644 --- a/modules/scripts/startup-script/variables.tf +++ b/modules/scripts/startup-script/variables.tf @@ -79,3 +79,9 @@ EOT } default = [] } + +variable "prepend_ansible_installer" { + description = "Prepend Ansible installation script if any of the specified runners are of type ansible-local" + type = bool + default = true +} From fe883bd82cc4b4a7e3134abf2700b89f39a58e09 Mon Sep 17 00:00:00 2001 From: Tom Downes Date: Fri, 14 Oct 2022 14:13:07 -0500 Subject: [PATCH 26/61] Remove explicit Ansible installation runners --- community/examples/AMD/hpc-cluster-amd-slurmv5.yaml | 3 --- community/examples/cloud-batch.yaml | 3 --- community/examples/htcondor-pool.yaml | 9 --------- community/examples/omnia-cluster.yaml | 6 ------ community/examples/spack-gromacs.yaml | 3 --- community/modules/scheduler/htcondor-configure/README.md | 6 ------ community/modules/scripts/htcondor-install/README.md | 6 ------ docs/tutorials/gromacs/spack-gromacs.yaml | 3 --- docs/tutorials/openfoam/spack-openfoam.yaml | 3 --- docs/tutorials/wrfv3/spack-wrfv3.yaml | 3 --- tools/cloud-build/daily-tests/blueprints/monitoring.yaml | 3 --- .../test_configs/2filestore-4instances.yaml | 3 --- tools/validate_configs/test_configs/centos8-ss.yaml | 3 --- .../test_configs/cloud-batch-cft-instance-template.yaml | 3 --- tools/validate_configs/test_configs/complex-data.yaml | 3 --- tools/validate_configs/test_configs/debian-ss.yaml | 3 --- tools/validate_configs/test_configs/hpc-centos-ss.yaml | 3 --- .../test_configs/hpc-cluster-simple.yaml | 3 --- .../test_configs/instance-with-startup.yaml | 3 --- tools/validate_configs/test_configs/rocky-ss.yaml | 3 --- .../test_configs/slurm-two-partitions-workstation.yaml | 3 --- .../validate_configs/test_configs/spack-buildcache.yaml | 3 --- .../test_configs/spack-environments.yaml | 3 --- tools/validate_configs/test_configs/ubuntu-ss.yaml | 3 --- 24 files changed, 87 deletions(-) diff --git a/community/examples/AMD/hpc-cluster-amd-slurmv5.yaml b/community/examples/AMD/hpc-cluster-amd-slurmv5.yaml index 1dc317f597..a14934faeb 100644 --- a/community/examples/AMD/hpc-cluster-amd-slurmv5.yaml +++ b/community/examples/AMD/hpc-cluster-amd-slurmv5.yaml @@ -115,9 +115,6 @@ deployment_groups: source: modules/scripts/startup-script settings: runners: - - type: shell - source: modules/startup-script/examples/install_ansible.sh - destination: install_ansible.sh - $(swfs.install_nfs_client_runner) - $(swfs.mount_runner) - $(spack.install_spack_deps_runner) diff --git a/community/examples/cloud-batch.yaml b/community/examples/cloud-batch.yaml index a244781950..07fb1068fe 100644 --- a/community/examples/cloud-batch.yaml +++ b/community/examples/cloud-batch.yaml @@ -39,9 +39,6 @@ deployment_groups: source: modules/scripts/startup-script settings: runners: - - type: shell - source: modules/startup-script/examples/install_ansible.sh - destination: install_ansible.sh - $(appfs.install_nfs_client_runner) - $(appfs.mount_runner) - type: shell diff --git a/community/examples/htcondor-pool.yaml b/community/examples/htcondor-pool.yaml index fc3b557525..5a36a3dc66 100644 --- a/community/examples/htcondor-pool.yaml +++ b/community/examples/htcondor-pool.yaml @@ -50,9 +50,6 @@ deployment_groups: source: modules/scripts/startup-script settings: runners: - - type: shell - source: modules/startup-script/examples/install_ansible.sh - destination: install_ansible.sh - $(htcondor_install.install_htcondor_runner) - $(htcondor_configure.central_manager_runner) @@ -76,9 +73,6 @@ deployment_groups: source: modules/scripts/startup-script settings: runners: - - type: shell - source: modules/startup-script/examples/install_ansible.sh - destination: install_ansible.sh - $(htcondor_install.install_htcondor_runner) - $(htcondor_configure.execute_point_runner) @@ -100,9 +94,6 @@ deployment_groups: source: modules/scripts/startup-script settings: runners: - - type: shell - source: modules/startup-script/examples/install_ansible.sh - destination: install_ansible.sh - $(htcondor_install.install_htcondor_runner) - $(htcondor_install.install_autoscaler_deps_runner) - $(htcondor_install.install_autoscaler_runner) diff --git a/community/examples/omnia-cluster.yaml b/community/examples/omnia-cluster.yaml index 655eb1a1f8..8335bfa61a 100644 --- a/community/examples/omnia-cluster.yaml +++ b/community/examples/omnia-cluster.yaml @@ -55,9 +55,6 @@ deployment_groups: source: modules/scripts/startup-script settings: runners: - - type: shell - source: "modules/startup-script/examples/install_ansible.sh" - destination: "install_ansible.sh" - $(homefs.install_nfs_client_runner) - $(homefs.mount_runner) - $(omnia.setup_omnia_node_runner) @@ -68,9 +65,6 @@ deployment_groups: source: modules/scripts/startup-script settings: runners: - - type: shell - source: "modules/startup-script/examples/install_ansible.sh" - destination: "install_ansible.sh" - $(homefs.install_nfs_client_runner) - $(homefs.mount_runner) - $(omnia.setup_omnia_node_runner) diff --git a/community/examples/spack-gromacs.yaml b/community/examples/spack-gromacs.yaml index d5cd2c062a..f788ba80b7 100644 --- a/community/examples/spack-gromacs.yaml +++ b/community/examples/spack-gromacs.yaml @@ -83,9 +83,6 @@ deployment_groups: source: modules/scripts/startup-script settings: runners: - - type: shell - source: modules/startup-script/examples/install_ansible.sh - destination: install_ansible.sh - $(spack.install_spack_deps_runner) - $(spack.install_spack_runner) diff --git a/community/modules/scheduler/htcondor-configure/README.md b/community/modules/scheduler/htcondor-configure/README.md index 4ae216b3bc..c90a8971ff 100644 --- a/community/modules/scheduler/htcondor-configure/README.md +++ b/community/modules/scheduler/htcondor-configure/README.md @@ -31,9 +31,6 @@ install the HTCondor software and adds custom configurations using source: modules/scripts/startup-script settings: runners: - - type: shell - source: modules/startup-script/examples/install_ansible.sh - destination: install_ansible.sh - $(htcondor_install.install_htcondor_runner) - $(htcondor_configure.central_manager_runner) @@ -41,9 +38,6 @@ install the HTCondor software and adds custom configurations using source: modules/scripts/startup-script settings: runners: - - type: shell - source: modules/startup-script/examples/install_ansible.sh - destination: install_ansible.sh - $(htcondor_install.install_htcondor_runner) - $(htcondor_install.install_autoscaler_deps_runner) - $(htcondor_install.install_autoscaler_runner) diff --git a/community/modules/scripts/htcondor-install/README.md b/community/modules/scripts/htcondor-install/README.md index 8f37e411d1..d40614a010 100644 --- a/community/modules/scripts/htcondor-install/README.md +++ b/community/modules/scripts/htcondor-install/README.md @@ -28,9 +28,6 @@ install the HTCondor software and adds custom configurations using source: modules/scripts/startup-script settings: runners: - - type: shell - source: modules/startup-script/examples/install_ansible.sh - destination: install_ansible.sh - $(htcondor_install.install_htcondor_runner) - $(htcondor_configure.central_manager_runner) @@ -38,9 +35,6 @@ install the HTCondor software and adds custom configurations using source: modules/scripts/startup-script settings: runners: - - type: shell - source: modules/startup-script/examples/install_ansible.sh - destination: install_ansible.sh - $(htcondor_install.install_htcondor_runner) - $(htcondor_install.install_autoscaler_deps_runner) - $(htcondor_install.install_autoscaler_runner) diff --git a/docs/tutorials/gromacs/spack-gromacs.yaml b/docs/tutorials/gromacs/spack-gromacs.yaml index 27ec887d9f..bcfe0f6242 100644 --- a/docs/tutorials/gromacs/spack-gromacs.yaml +++ b/docs/tutorials/gromacs/spack-gromacs.yaml @@ -97,9 +97,6 @@ deployment_groups: source: modules/scripts/startup-script settings: runners: - - type: shell - source: modules/startup-script/examples/install_ansible.sh - destination: install_ansible.sh - $(spack.install_spack_deps_runner) - $(spack.install_spack_runner) - type: shell diff --git a/docs/tutorials/openfoam/spack-openfoam.yaml b/docs/tutorials/openfoam/spack-openfoam.yaml index fbf554f10d..8b7a17ac0d 100644 --- a/docs/tutorials/openfoam/spack-openfoam.yaml +++ b/docs/tutorials/openfoam/spack-openfoam.yaml @@ -104,9 +104,6 @@ deployment_groups: source: modules/scripts/startup-script settings: runners: - - type: shell - source: modules/startup-script/examples/install_ansible.sh - destination: install_ansible.sh - $(spack.install_spack_deps_runner) - $(spack.install_spack_runner) - type: shell diff --git a/docs/tutorials/wrfv3/spack-wrfv3.yaml b/docs/tutorials/wrfv3/spack-wrfv3.yaml index 996ac52798..6380e9ea8c 100644 --- a/docs/tutorials/wrfv3/spack-wrfv3.yaml +++ b/docs/tutorials/wrfv3/spack-wrfv3.yaml @@ -97,9 +97,6 @@ deployment_groups: source: modules/scripts/startup-script settings: runners: - - type: shell - source: modules/startup-script/examples/install_ansible.sh - destination: install_ansible.sh - $(spack.install_spack_deps_runner) - $(spack.install_spack_runner) - type: shell diff --git a/tools/cloud-build/daily-tests/blueprints/monitoring.yaml b/tools/cloud-build/daily-tests/blueprints/monitoring.yaml index 3e0d367dcb..0f667336c4 100644 --- a/tools/cloud-build/daily-tests/blueprints/monitoring.yaml +++ b/tools/cloud-build/daily-tests/blueprints/monitoring.yaml @@ -44,9 +44,6 @@ deployment_groups: - type: shell source: modules/startup-script/examples/install_cloud_ops_agent.sh destination: install_cloud_ops_agent.sh - - type: shell - source: modules/startup-script/examples/install_ansible.sh - destination: install_ansible.sh - $(homefs.install_nfs_client_runner) - $(homefs.mount_runner) diff --git a/tools/validate_configs/test_configs/2filestore-4instances.yaml b/tools/validate_configs/test_configs/2filestore-4instances.yaml index edaa6c48ae..2c461578a4 100644 --- a/tools/validate_configs/test_configs/2filestore-4instances.yaml +++ b/tools/validate_configs/test_configs/2filestore-4instances.yaml @@ -50,9 +50,6 @@ deployment_groups: source: ./modules/scripts/startup-script settings: runners: - - type: shell - source: "modules/startup-script/examples/install_ansible.sh" - destination: "install_ansible.sh" - type: shell content: $(homefs.install_nfs_client) destination: "install-nfs.sh" diff --git a/tools/validate_configs/test_configs/centos8-ss.yaml b/tools/validate_configs/test_configs/centos8-ss.yaml index 81aaf77acc..b47977ded3 100644 --- a/tools/validate_configs/test_configs/centos8-ss.yaml +++ b/tools/validate_configs/test_configs/centos8-ss.yaml @@ -69,9 +69,6 @@ deployment_groups: echo $2 tar zxvf /tmp/$1 -C / args: "foo.tgz 'Expanding the file'" - - type: shell - source: modules/startup-script/examples/install_ansible.sh - destination: install_ansible.sh - type: "ansible-local" source: modules/startup-script/examples/hello.yaml destination: hello.yaml diff --git a/tools/validate_configs/test_configs/cloud-batch-cft-instance-template.yaml b/tools/validate_configs/test_configs/cloud-batch-cft-instance-template.yaml index 782ad34854..8eb12b075d 100644 --- a/tools/validate_configs/test_configs/cloud-batch-cft-instance-template.yaml +++ b/tools/validate_configs/test_configs/cloud-batch-cft-instance-template.yaml @@ -35,9 +35,6 @@ deployment_groups: source: modules/scripts/startup-script settings: runners: - - type: shell - source: modules/startup-script/examples/install_ansible.sh - destination: install_ansible.sh - $(appfs.install_nfs_client_runner) - $(appfs.mount_runner) - type: shell diff --git a/tools/validate_configs/test_configs/complex-data.yaml b/tools/validate_configs/test_configs/complex-data.yaml index 3007047f80..5863c6080e 100644 --- a/tools/validate_configs/test_configs/complex-data.yaml +++ b/tools/validate_configs/test_configs/complex-data.yaml @@ -61,9 +61,6 @@ deployment_groups: source: modules/scripts/startup-script settings: runners: - - type: shell - source: "modules/startup-script/examples/install_ansible.sh" - destination: "install_ansible.sh" - type: shell content: $(homefs.install_nfs_client) destination: "install-nfs.sh" diff --git a/tools/validate_configs/test_configs/debian-ss.yaml b/tools/validate_configs/test_configs/debian-ss.yaml index 2a72fea52e..3027495861 100644 --- a/tools/validate_configs/test_configs/debian-ss.yaml +++ b/tools/validate_configs/test_configs/debian-ss.yaml @@ -69,9 +69,6 @@ deployment_groups: echo $2 tar zxvf /tmp/$1 -C / args: "foo.tgz 'Expanding the file'" - - type: shell - source: modules/startup-script/examples/install_ansible.sh - destination: install_ansible.sh - type: "ansible-local" source: modules/startup-script/examples/hello.yaml destination: hello.yaml diff --git a/tools/validate_configs/test_configs/hpc-centos-ss.yaml b/tools/validate_configs/test_configs/hpc-centos-ss.yaml index 8dabe6d805..a2e6a985aa 100644 --- a/tools/validate_configs/test_configs/hpc-centos-ss.yaml +++ b/tools/validate_configs/test_configs/hpc-centos-ss.yaml @@ -69,9 +69,6 @@ deployment_groups: echo $2 tar zxvf /tmp/$1 -C / args: "foo.tgz 'Expanding the file'" - - type: shell - source: modules/startup-script/examples/install_ansible.sh - destination: install_ansible.sh - type: "ansible-local" source: modules/startup-script/examples/hello.yaml destination: hello.yaml diff --git a/tools/validate_configs/test_configs/hpc-cluster-simple.yaml b/tools/validate_configs/test_configs/hpc-cluster-simple.yaml index e55ac954de..9da0dde50e 100644 --- a/tools/validate_configs/test_configs/hpc-cluster-simple.yaml +++ b/tools/validate_configs/test_configs/hpc-cluster-simple.yaml @@ -40,9 +40,6 @@ deployment_groups: source: modules/scripts/startup-script settings: runners: - - type: shell - source: "modules/startup-script/examples/install_ansible.sh" - destination: install_ansible.sh - type: shell content: $(homefs.install_nfs_client) destination: install-nfs.sh diff --git a/tools/validate_configs/test_configs/instance-with-startup.yaml b/tools/validate_configs/test_configs/instance-with-startup.yaml index b2c8d7732a..a3561d94f7 100644 --- a/tools/validate_configs/test_configs/instance-with-startup.yaml +++ b/tools/validate_configs/test_configs/instance-with-startup.yaml @@ -38,9 +38,6 @@ deployment_groups: source: modules/scripts/startup-script settings: runners: - - type: shell - source: "modules/startup-script/examples/install_ansible.sh" - destination: "tmp.sh" - type: shell content: $(homefs.install_nfs_client) destination: "tmp.sh" diff --git a/tools/validate_configs/test_configs/rocky-ss.yaml b/tools/validate_configs/test_configs/rocky-ss.yaml index 5b644dc3e6..692261c7bc 100644 --- a/tools/validate_configs/test_configs/rocky-ss.yaml +++ b/tools/validate_configs/test_configs/rocky-ss.yaml @@ -71,9 +71,6 @@ deployment_groups: echo $2 tar zxvf /tmp/$1 -C / args: "foo.tgz 'Expanding the file'" - - type: shell - source: modules/startup-script/examples/install_ansible.sh - destination: install_ansible.sh - type: "ansible-local" source: modules/startup-script/examples/hello.yaml destination: hello.yaml diff --git a/tools/validate_configs/test_configs/slurm-two-partitions-workstation.yaml b/tools/validate_configs/test_configs/slurm-two-partitions-workstation.yaml index 2aa484bef8..6a3fbaa2cb 100644 --- a/tools/validate_configs/test_configs/slurm-two-partitions-workstation.yaml +++ b/tools/validate_configs/test_configs/slurm-two-partitions-workstation.yaml @@ -38,9 +38,6 @@ deployment_groups: source: modules/scripts/startup-script settings: runners: - - type: shell - source: "modules/startup-script/examples/install_ansible.sh" - destination: "tmp.sh" - type: shell content: $(homefs.install_nfs_client) destination: "tmp.sh" diff --git a/tools/validate_configs/test_configs/spack-buildcache.yaml b/tools/validate_configs/test_configs/spack-buildcache.yaml index 572194a0d9..368b86ea80 100644 --- a/tools/validate_configs/test_configs/spack-buildcache.yaml +++ b/tools/validate_configs/test_configs/spack-buildcache.yaml @@ -64,9 +64,6 @@ deployment_groups: mkdir /apps chmod a+rwx /apps destination: apps_create.sh - - type: shell - source: modules/startup-script/examples/install_ansible.sh - destination: install_ansible.sh - type: ansible-local source: modules/spack-install/scripts/install_spack_deps.yml destination: install_spack_deps.yml diff --git a/tools/validate_configs/test_configs/spack-environments.yaml b/tools/validate_configs/test_configs/spack-environments.yaml index 2fd2f4ec41..eff97e3c42 100644 --- a/tools/validate_configs/test_configs/spack-environments.yaml +++ b/tools/validate_configs/test_configs/spack-environments.yaml @@ -92,9 +92,6 @@ deployment_groups: mkdir /apps chmod a+rwx /apps destination: apps_create.sh - - type: shell - source: modules/startup-script/examples/install_ansible.sh - destination: install_ansible.sh - type: ansible-local source: modules/spack-install/scripts/install_spack_deps.yml destination: install_spack_deps.yml diff --git a/tools/validate_configs/test_configs/ubuntu-ss.yaml b/tools/validate_configs/test_configs/ubuntu-ss.yaml index e167a25940..476abe6520 100644 --- a/tools/validate_configs/test_configs/ubuntu-ss.yaml +++ b/tools/validate_configs/test_configs/ubuntu-ss.yaml @@ -75,9 +75,6 @@ deployment_groups: echo $2 tar zxvf /tmp/$1 -C / args: "foo.tgz 'Expanding the file'" - - type: shell - source: modules/startup-script/examples/install_ansible.sh - destination: install_ansible.sh - type: shell source: modules/startup-script/examples/install_cloud_ops_agent.sh destination: install_cloud_ops_agent.sh From c508d666759b9b6eca7ae5d17f41c37d680f6a1c Mon Sep 17 00:00:00 2001 From: Tom Downes Date: Fri, 14 Oct 2022 16:27:35 -0500 Subject: [PATCH 27/61] Add end-of-file-fixer pre-commit hook to enforce trailing newlines --- .pre-commit-config.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2bf7f57328..e58afe1093 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -78,9 +78,13 @@ repos: # MD046 - Code block style args: [--disable-rules, "MD013,MD022,MD033,MD034,MD041,MD046", scan] - repo: https://github.com/jumanjihouse/pre-commit-hooks - rev: "3.0.0" # or specific git tag + rev: "3.0.0" hooks: - id: script-must-have-extension - id: shellcheck - id: shfmt exclude: ".*tpl" +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.3.0 + hooks: + - id: end-of-file-fixer From 0f2a10ee02849281e99dfe3eebef394b62fa388a Mon Sep 17 00:00:00 2001 From: Nick Stroud Date: Fri, 14 Oct 2022 14:55:22 -0700 Subject: [PATCH 28/61] Add support for mount options in mount.sh --- .../file-system/pre-existing-network-storage/outputs.tf | 2 +- .../pre-existing-network-storage/scripts/mount.sh | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/file-system/pre-existing-network-storage/outputs.tf b/modules/file-system/pre-existing-network-storage/outputs.tf index f4750cf498..700dcc36cd 100644 --- a/modules/file-system/pre-existing-network-storage/outputs.tf +++ b/modules/file-system/pre-existing-network-storage/outputs.tf @@ -57,7 +57,7 @@ output "mount_runner" { value = { "type" = "shell" "destination" = "mount_filesystem${replace(var.local_mount, "/", "_")}.sh" - "args" = "\"${var.server_ip}\" \"${local.remote_mount_with_slash}\" \"${var.local_mount}\" \"${var.fs_type}\"" + "args" = "\"${var.server_ip}\" \"${local.remote_mount_with_slash}\" \"${var.local_mount}\" \"${var.fs_type}\" \"${var.mount_options}\"" "content" = ( contains(local.mount_supported_fstype, var.fs_type) ? file("${path.module}/scripts/mount.sh") : diff --git a/modules/file-system/pre-existing-network-storage/scripts/mount.sh b/modules/file-system/pre-existing-network-storage/scripts/mount.sh index 0f130d1276..610dfb2b57 100644 --- a/modules/file-system/pre-existing-network-storage/scripts/mount.sh +++ b/modules/file-system/pre-existing-network-storage/scripts/mount.sh @@ -17,11 +17,16 @@ SERVER_IP=$1 REMOTE_MOUNT_WITH_SLASH=$2 LOCAL_MOUNT=$3 FS_TYPE=$4 +MOUNT_OPTIONS=$5 if ! findmnt --source "${SERVER_IP}":"${REMOTE_MOUNT_WITH_SLASH}" --target "${LOCAL_MOUNT}" &>/dev/null; then echo "Mounting --source ${SERVER_IP}:${REMOTE_MOUNT_WITH_SLASH} --target ${LOCAL_MOUNT}" mkdir -p "${LOCAL_MOUNT}" - mount -t "${FS_TYPE}" "${SERVER_IP}":"${REMOTE_MOUNT_WITH_SLASH}" "${LOCAL_MOUNT}" + if [ -z "${MOUNT_OPTIONS}" ]; then + mount -t "${FS_TYPE}" "${SERVER_IP}":"${REMOTE_MOUNT_WITH_SLASH}" "${LOCAL_MOUNT}" + else + mount -t "${FS_TYPE}" -o "${MOUNT_OPTIONS}" "${SERVER_IP}":"${REMOTE_MOUNT_WITH_SLASH}" "${LOCAL_MOUNT}" + fi else echo "Skipping mounting source: ${SERVER_IP}:${REMOTE_MOUNT_WITH_SLASH}, already mounted to target:${LOCAL_MOUNT}" fi From acbccf6bcb48752a958ab821e77975b1dcdfdfd8 Mon Sep 17 00:00:00 2001 From: Tom Downes Date: Fri, 14 Oct 2022 17:04:38 -0500 Subject: [PATCH 29/61] Fix EOF in all repo files --- LICENSE | 2 +- Makefile | 1 - .../modules/compute/schedmd-slurm-gcp-v5-partition/main.tf | 1 - community/modules/project/service-account/variables.tf | 1 - community/modules/project/service-account/versions.tf | 1 - .../modules/scheduler/schedmd-slurm-gcp-v5-controller/main.tf | 1 - .../scheduler/schedmd-slurm-gcp-v5-controller/versions.tf | 2 +- community/modules/scripts/wait-for-startup/outputs.tf | 1 - docs/hybrid-slurm-cluster/requirements.txt | 2 +- modules/network/pre-existing-vpc/outputs.tf | 1 - .../scripts/startup-script/templates/startup-script-custom.tpl | 1 - tools/cloud-build/dependency-checks/Dockerfile.precommit | 1 - tools/enforce_coverage.pl | 1 - 13 files changed, 3 insertions(+), 13 deletions(-) diff --git a/LICENSE b/LICENSE index 7a4a3ea242..d645695673 100644 --- a/LICENSE +++ b/LICENSE @@ -199,4 +199,4 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file + limitations under the License. diff --git a/Makefile b/Makefile index e7e675edad..3b540ad0cf 100644 --- a/Makefile +++ b/Makefile @@ -223,4 +223,3 @@ packer-format: endif endif # END OF PACKER SECTION - diff --git a/community/modules/compute/schedmd-slurm-gcp-v5-partition/main.tf b/community/modules/compute/schedmd-slurm-gcp-v5-partition/main.tf index e44081e99a..c8893851ca 100644 --- a/community/modules/compute/schedmd-slurm-gcp-v5-partition/main.tf +++ b/community/modules/compute/schedmd-slurm-gcp-v5-partition/main.tf @@ -85,4 +85,3 @@ module "slurm_partition" { subnetwork = var.subnetwork_self_link == null ? "" : var.subnetwork_self_link partition_conf = local.partition_conf } - diff --git a/community/modules/project/service-account/variables.tf b/community/modules/project/service-account/variables.tf index c9993be50e..b9492ebf08 100644 --- a/community/modules/project/service-account/variables.tf +++ b/community/modules/project/service-account/variables.tf @@ -83,4 +83,3 @@ variable "project_roles" { description = "list of roles to apply to created service accounts" type = list(string) } - diff --git a/community/modules/project/service-account/versions.tf b/community/modules/project/service-account/versions.tf index a9af2ee710..38e6e71945 100644 --- a/community/modules/project/service-account/versions.tf +++ b/community/modules/project/service-account/versions.tf @@ -20,4 +20,3 @@ terraform { required_version = ">= 0.14.0" } - diff --git a/community/modules/scheduler/schedmd-slurm-gcp-v5-controller/main.tf b/community/modules/scheduler/schedmd-slurm-gcp-v5-controller/main.tf index 5d5a08f9a2..03c7cb3652 100644 --- a/community/modules/scheduler/schedmd-slurm-gcp-v5-controller/main.tf +++ b/community/modules/scheduler/schedmd-slurm-gcp-v5-controller/main.tf @@ -101,4 +101,3 @@ module "slurm_controller_template" { subnetwork = var.subnetwork_self_link == null ? "" : var.subnetwork_self_link tags = concat([local.slurm_cluster_name], var.tags) } - diff --git a/community/modules/scheduler/schedmd-slurm-gcp-v5-controller/versions.tf b/community/modules/scheduler/schedmd-slurm-gcp-v5-controller/versions.tf index d51a50b0a8..d70527e5cf 100644 --- a/community/modules/scheduler/schedmd-slurm-gcp-v5-controller/versions.tf +++ b/community/modules/scheduler/schedmd-slurm-gcp-v5-controller/versions.tf @@ -16,4 +16,4 @@ terraform { required_version = ">= 0.14.0" -} \ No newline at end of file +} diff --git a/community/modules/scripts/wait-for-startup/outputs.tf b/community/modules/scripts/wait-for-startup/outputs.tf index 3ea74b550c..11a2ddf118 100644 --- a/community/modules/scripts/wait-for-startup/outputs.tf +++ b/community/modules/scripts/wait-for-startup/outputs.tf @@ -13,4 +13,3 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - diff --git a/docs/hybrid-slurm-cluster/requirements.txt b/docs/hybrid-slurm-cluster/requirements.txt index a99bcfa21e..2aa963d8e8 100644 --- a/docs/hybrid-slurm-cluster/requirements.txt +++ b/docs/hybrid-slurm-cluster/requirements.txt @@ -2,4 +2,4 @@ addict~=2.0 google-cloud-pubsub~=2.0 google-api-python-client==2.61.0 httplib2==0.20.4 -PyYAML==6.0 \ No newline at end of file +PyYAML==6.0 diff --git a/modules/network/pre-existing-vpc/outputs.tf b/modules/network/pre-existing-vpc/outputs.tf index 021255ba2b..115ee8832f 100644 --- a/modules/network/pre-existing-vpc/outputs.tf +++ b/modules/network/pre-existing-vpc/outputs.tf @@ -48,4 +48,3 @@ output "subnetwork_address" { description = "The subnetwork address in the specified primary region" value = data.google_compute_subnetwork.primary_subnetwork.ip_cidr_range } - diff --git a/modules/scripts/startup-script/templates/startup-script-custom.tpl b/modules/scripts/startup-script/templates/startup-script-custom.tpl index 63c5996a79..3d32c2c98a 100644 --- a/modules/scripts/startup-script/templates/startup-script-custom.tpl +++ b/modules/scripts/startup-script/templates/startup-script-custom.tpl @@ -61,4 +61,3 @@ stdlib::load_runners(){ stdlib::debug "=== END Running runners ===" } - diff --git a/tools/cloud-build/dependency-checks/Dockerfile.precommit b/tools/cloud-build/dependency-checks/Dockerfile.precommit index e737e801ba..4b47acc150 100644 --- a/tools/cloud-build/dependency-checks/Dockerfile.precommit +++ b/tools/cloud-build/dependency-checks/Dockerfile.precommit @@ -26,4 +26,3 @@ RUN go install github.com/terraform-docs/terraform-docs@latest && \ go install github.com/google/addlicense@latest && \ go install mvdan.cc/sh/v3/cmd/shfmt@latest && \ go install golang.org/x/tools/cmd/goimports@latest - diff --git a/tools/enforce_coverage.pl b/tools/enforce_coverage.pl index 9a87028dc9..925c305cff 100755 --- a/tools/enforce_coverage.pl +++ b/tools/enforce_coverage.pl @@ -37,4 +37,3 @@ print STDERR "Coverage must be above $min%, $failed_coverage packages were below that.\n"; exit 1 } - From ce833c11a63eeb31d02df472f1709abc86495fbf Mon Sep 17 00:00:00 2001 From: Nick Stroud Date: Thu, 13 Oct 2022 15:20:42 -0700 Subject: [PATCH 30/61] Mount script also makes entry in /etc/fstab --- .../pre-existing-network-storage/scripts/mount.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/file-system/pre-existing-network-storage/scripts/mount.sh b/modules/file-system/pre-existing-network-storage/scripts/mount.sh index 610dfb2b57..976561ffbe 100644 --- a/modules/file-system/pre-existing-network-storage/scripts/mount.sh +++ b/modules/file-system/pre-existing-network-storage/scripts/mount.sh @@ -30,3 +30,13 @@ if ! findmnt --source "${SERVER_IP}":"${REMOTE_MOUNT_WITH_SLASH}" --target "${LO else echo "Skipping mounting source: ${SERVER_IP}:${REMOTE_MOUNT_WITH_SLASH}, already mounted to target:${LOCAL_MOUNT}" fi + +MOUNT_IDENTIFIER="${SERVER_IP}:${REMOTE_MOUNT_WITH_SLASH}[[:space:]]${LOCAL_MOUNT}" +if ! grep -q "${MOUNT_IDENTIFIER}" /etc/fstab; then + echo "Adding ${SERVER_IP}:${REMOTE_MOUNT_WITH_SLASH} -> ${LOCAL_MOUNT} to /etc/fstab" + + [[ -z "${MOUNT_OPTIONS}" ]] && POPULATED_MOUNT_OPTIONS="defaults" || POPULATED_MOUNT_OPTIONS="${MOUNT_OPTIONS}" + echo "${SERVER_IP}:${REMOTE_MOUNT_WITH_SLASH} ${LOCAL_MOUNT} ${FS_TYPE} ${POPULATED_MOUNT_OPTIONS} 0 0" >>/etc/fstab +else + echo "Skipping editing /etc/fstab as entry already exists" +fi From 21866540b7dc264a03e2bf65d07448bf937e47a1 Mon Sep 17 00:00:00 2001 From: Tom Downes Date: Fri, 14 Oct 2022 17:18:34 -0500 Subject: [PATCH 31/61] Update output documentation to avoid explicit installation of Ansible --- .../modules/file-system/nfs-server/README.md | 2 +- .../modules/file-system/nfs-server/outputs.tf | 15 +++++++-------- community/modules/scripts/omnia-install/README.md | 2 +- .../modules/scripts/omnia-install/outputs.tf | 15 +++++++-------- community/modules/scripts/spack-install/README.md | 2 +- .../modules/scripts/spack-install/outputs.tf | 15 +++++++-------- modules/file-system/filestore/README.md | 2 +- modules/file-system/filestore/outputs.tf | 15 +++++++-------- 8 files changed, 32 insertions(+), 36 deletions(-) diff --git a/community/modules/file-system/nfs-server/README.md b/community/modules/file-system/nfs-server/README.md index 671e398f8e..435d6aeb45 100644 --- a/community/modules/file-system/nfs-server/README.md +++ b/community/modules/file-system/nfs-server/README.md @@ -106,6 +106,6 @@ No modules. |------|-------------| | [install\_nfs\_client](#output\_install\_nfs\_client) | Script for installing NFS client | | [install\_nfs\_client\_runner](#output\_install\_nfs\_client\_runner) | Runner to install NFS client using the startup-script module | -| [mount\_runner](#output\_mount\_runner) | Runner to mount the file-system using the startup-script module.
This runner requires ansible to be installed. This can be achieved using the
install\_ansible.sh script as a prior runner in the startup-script module:
runners:
- type: shell
source: modules/startup-script/examples/install\_ansible.sh
destination: install\_ansible.sh
- $(your-fs-id.mount\_runner)
... | +| [mount\_runner](#output\_mount\_runner) | Runner to mount the file-system using an ansible playbook. The startup-script
module will automatically handle installation of ansible.
- id: example-startup-script
source: modules/scripts/startup-script
settings:
runners:
- $(your-fs-id.mount\_runner)
... | | [network\_storage](#output\_network\_storage) | export of all desired folder directories | diff --git a/community/modules/file-system/nfs-server/outputs.tf b/community/modules/file-system/nfs-server/outputs.tf index c0f16179be..cedcdbe1d8 100644 --- a/community/modules/file-system/nfs-server/outputs.tf +++ b/community/modules/file-system/nfs-server/outputs.tf @@ -38,14 +38,13 @@ output "install_nfs_client_runner" { output "mount_runner" { description = <<-EOT - Runner to mount the file-system using the startup-script module. - This runner requires ansible to be installed. This can be achieved using the - install_ansible.sh script as a prior runner in the startup-script module: - runners: - - type: shell - source: modules/startup-script/examples/install_ansible.sh - destination: install_ansible.sh - - $(your-fs-id.mount_runner) + Runner to mount the file-system using an ansible playbook. The startup-script + module will automatically handle installation of ansible. + - id: example-startup-script + source: modules/scripts/startup-script + settings: + runners: + - $(your-fs-id.mount_runner) ... EOT value = local.mount_runner diff --git a/community/modules/scripts/omnia-install/README.md b/community/modules/scripts/omnia-install/README.md index e65514df21..c602555931 100644 --- a/community/modules/scripts/omnia-install/README.md +++ b/community/modules/scripts/omnia-install/README.md @@ -62,7 +62,7 @@ No resources. | Name | Description | |------|-------------| | [copy\_inventory\_runner](#output\_copy\_inventory\_runner) | Runner to copy the inventory to the omnia manager using the startup-script module | -| [install\_omnia\_runner](#output\_install\_omnia\_runner) | Runner to install Omnia using the startup-script module
This runner requires ansible to be installed. This can be achieved using the
install\_ansible.sh script as a prior runner in the startup-script module:
runners:
- type: shell
source: modules/startup-script/examples/install\_ansible.sh
destination: install\_ansible.sh
...
- $(omnia.install\_omnia\_runner) | +| [install\_omnia\_runner](#output\_install\_omnia\_runner) | Runner to install Omnia using an ansible playbook. The startup-script module
will automatically handle installation of ansible.
- id: example-startup-script
source: modules/scripts/startup-script
settings:
runners:
- $(your-omnia-id.install\_omnia\_runner)
... | | [inventory\_file](#output\_inventory\_file) | The inventory file for the omnia cluster | | [omnia\_user\_warning](#output\_omnia\_user\_warning) | Warn developers that the omnia user was created with sudo permissions | | [setup\_omnia\_node\_runner](#output\_setup\_omnia\_node\_runner) | Runner to create the omnia user using the startup-script module.
This runner requires ansible to be installed. This can be achieved using the
install\_ansible.sh script as a prior runner in the startup-script module:
runners:
- type: shell
source: modules/startup-script/examples/install\_ansible.sh
destination: install\_ansible.sh
- $(omnia.setup\_omnia\_node\_runner)
... | diff --git a/community/modules/scripts/omnia-install/outputs.tf b/community/modules/scripts/omnia-install/outputs.tf index 560b3b2d49..178a546c7b 100644 --- a/community/modules/scripts/omnia-install/outputs.tf +++ b/community/modules/scripts/omnia-install/outputs.tf @@ -46,15 +46,14 @@ output "setup_omnia_node_runner" { output "install_omnia_runner" { description = <<-EOT - Runner to install Omnia using the startup-script module - This runner requires ansible to be installed. This can be achieved using the - install_ansible.sh script as a prior runner in the startup-script module: - runners: - - type: shell - source: modules/startup-script/examples/install_ansible.sh - destination: install_ansible.sh + Runner to install Omnia using an ansible playbook. The startup-script module + will automatically handle installation of ansible. + - id: example-startup-script + source: modules/scripts/startup-script + settings: + runners: + - $(your-omnia-id.install_omnia_runner) ... - - $(omnia.install_omnia_runner) EOT value = local.install_omnia_runner } diff --git a/community/modules/scripts/spack-install/README.md b/community/modules/scripts/spack-install/README.md index 83da2189a7..d4c25d9eac 100644 --- a/community/modules/scripts/spack-install/README.md +++ b/community/modules/scripts/spack-install/README.md @@ -212,7 +212,7 @@ No resources. | Name | Description | |------|-------------| | [controller\_startup\_script](#output\_controller\_startup\_script) | Path to the Spack installation script, duplicate for SLURM controller. | -| [install\_spack\_deps\_runner](#output\_install\_spack\_deps\_runner) | Runner to install dependencies for spack using the startup-script module
This runner requires ansible to be installed. This can be achieved using the
install\_ansible.sh script as a prior runner in the startup-script module:
runners:
- type: shell
source: modules/startup-script/examples/install\_ansible.sh
destination: install\_ansible.sh
- $(spack.install\_spack\_deps\_runner)
... | +| [install\_spack\_deps\_runner](#output\_install\_spack\_deps\_runner) | Runner to install dependencies for spack using an ansible playbook. The
startup-script module will automatically handle installation of ansible.
- id: example-startup-script
source: modules/scripts/startup-script
settings:
runners:
- $(your-spack-id.install\_spack\_deps\_runner)
... | | [install\_spack\_runner](#output\_install\_spack\_runner) | Runner to install Spack using the startup-script module | | [setup\_spack\_runner](#output\_setup\_spack\_runner) | Adds Spack setup-env.sh script to /etc/profile.d so that it is called at shell startup. Among other things this adds Spack binary to user PATH. | | [startup\_script](#output\_startup\_script) | Path to the Spack installation script. | diff --git a/community/modules/scripts/spack-install/outputs.tf b/community/modules/scripts/spack-install/outputs.tf index ffa9043835..4c12930692 100644 --- a/community/modules/scripts/spack-install/outputs.tf +++ b/community/modules/scripts/spack-install/outputs.tf @@ -26,14 +26,13 @@ output "controller_startup_script" { output "install_spack_deps_runner" { description = <<-EOT - Runner to install dependencies for spack using the startup-script module - This runner requires ansible to be installed. This can be achieved using the - install_ansible.sh script as a prior runner in the startup-script module: - runners: - - type: shell - source: modules/startup-script/examples/install_ansible.sh - destination: install_ansible.sh - - $(spack.install_spack_deps_runner) + Runner to install dependencies for spack using an ansible playbook. The + startup-script module will automatically handle installation of ansible. + - id: example-startup-script + source: modules/scripts/startup-script + settings: + runners: + - $(your-spack-id.install_spack_deps_runner) ... EOT value = local.install_spack_deps_runner diff --git a/modules/file-system/filestore/README.md b/modules/file-system/filestore/README.md index e3359e2d0f..c3743e8031 100644 --- a/modules/file-system/filestore/README.md +++ b/modules/file-system/filestore/README.md @@ -139,6 +139,6 @@ No modules. |------|-------------| | [install\_nfs\_client](#output\_install\_nfs\_client) | Script for installing NFS client | | [install\_nfs\_client\_runner](#output\_install\_nfs\_client\_runner) | Runner to install NFS client using the startup-script module | -| [mount\_runner](#output\_mount\_runner) | Runner to mount the file-system using the startup-script module.
This runner requires ansible to be installed. This can be achieved using the
install\_ansible.sh script as a prior runner in the startup-script module:
runners:
- type: shell
source: modules/startup-script/examples/install\_ansible.sh
destination: install\_ansible.sh
- $(your-fs-id.mount\_runner)
... | +| [mount\_runner](#output\_mount\_runner) | Runner to mount the file-system using an ansible playbook. The startup-script
module will automatically handle installation of ansible.
- id: example-startup-script
source: modules/scripts/startup-script
settings:
runners:
- $(your-fs-id.mount\_runner)
... | | [network\_storage](#output\_network\_storage) | Describes a filestore instance. | diff --git a/modules/file-system/filestore/outputs.tf b/modules/file-system/filestore/outputs.tf index d3673318de..7e28e83166 100644 --- a/modules/file-system/filestore/outputs.tf +++ b/modules/file-system/filestore/outputs.tf @@ -37,14 +37,13 @@ output "install_nfs_client_runner" { output "mount_runner" { description = <<-EOT - Runner to mount the file-system using the startup-script module. - This runner requires ansible to be installed. This can be achieved using the - install_ansible.sh script as a prior runner in the startup-script module: - runners: - - type: shell - source: modules/startup-script/examples/install_ansible.sh - destination: install_ansible.sh - - $(your-fs-id.mount_runner) + Runner to mount the file-system using an ansible playbook. The startup-script + module will automatically handle installation of ansible. + - id: example-startup-script + source: modules/scripts/startup-script + settings: + runners: + - $(your-fs-id.mount_runner) ... EOT value = local.mount_runner From fb66770bea7d81740828f828db84c1c59eff5dbe Mon Sep 17 00:00:00 2001 From: Tom Downes Date: Fri, 14 Oct 2022 16:32:32 -0500 Subject: [PATCH 32/61] Update pre-commit hooks --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e58afe1093..8dc934110b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,7 +15,7 @@ --- repos: - repo: https://github.com/antonbabenko/pre-commit-terraform - rev: v1.75.0 + rev: v1.76.0 hooks: - id: terraform_fmt - id: terraform_tflint @@ -40,7 +40,7 @@ repos: pass_filenames: true require_serial: true - repo: https://github.com/dnephin/pre-commit-golang - rev: v0.5.0 + rev: v0.5.1 hooks: - id: go-fmt - id: go-vet @@ -66,7 +66,7 @@ repos: - id: yamllint args: [-c=.yamllint] - repo: https://github.com/jackdewinter/pymarkdown - rev: v0.9.7 + rev: v0.9.8 hooks: - id: pymarkdown # Rules at https://github.com/jackdewinter/pymarkdown/tree/main/docs/rules From 70190956e418231a6e278900ee6d1a6d320e95ae Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 14 Oct 2022 22:30:34 +0000 Subject: [PATCH 33/61] Bump github.com/googleapis/gax-go/v2 from 2.5.1 to 2.6.0 Bumps [github.com/googleapis/gax-go/v2](https://github.com/googleapis/gax-go) from 2.5.1 to 2.6.0. - [Release notes](https://github.com/googleapis/gax-go/releases) - [Commits](https://github.com/googleapis/gax-go/compare/v2.5.1...v2.6.0) --- updated-dependencies: - dependency-name: github.com/googleapis/gax-go/v2 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 8 ++++---- go.sum | 15 ++++++++------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/go.mod b/go.mod index 3a2c97821b..179de60b2d 100644 --- a/go.mod +++ b/go.mod @@ -15,14 +15,14 @@ require ( github.com/spf13/cobra v1.5.0 github.com/zclconf/go-cty v1.11.0 golang.org/x/exp v0.0.0-20220907003533-145caa8ea1d0 - google.golang.org/genproto v0.0.0-20220915135415-7fd63a7952de + google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f gopkg.in/yaml.v3 v3.0.1 ) require ( cloud.google.com/go/serviceusage v1.2.0 - github.com/googleapis/gax-go/v2 v2.5.1 + github.com/googleapis/gax-go/v2 v2.6.0 google.golang.org/api v0.98.0 ) @@ -35,7 +35,7 @@ require ( github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect github.com/golang/protobuf v1.5.2 // indirect - github.com/google/go-cmp v0.5.8 // indirect + github.com/google/go-cmp v0.5.9 // indirect github.com/google/uuid v1.3.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.1.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect @@ -59,6 +59,6 @@ require ( golang.org/x/text v0.3.7 // indirect golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/grpc v1.48.0 // indirect + google.golang.org/grpc v1.50.0 // indirect google.golang.org/protobuf v1.28.1 // indirect ) diff --git a/go.sum b/go.sum index 4f74ce2bcf..b3be46dc71 100644 --- a/go.sum +++ b/go.sum @@ -169,8 +169,9 @@ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE= -github.com/google/go-cmp v0.5.8 h1:e6P7q2lk1O+qJJb4BtCQXlK8vWEO8V1ZeuEdJNOqZyg= github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= +github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -206,8 +207,8 @@ github.com/googleapis/gax-go/v2 v2.1.1/go.mod h1:hddJymUZASv3XPyGkUpKj8pPO47Rmb0 github.com/googleapis/gax-go/v2 v2.2.0/go.mod h1:as02EH8zWkzwUoLbBaFeQ+arQaj/OthfcblKl4IGNaM= github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99EXz9pXxye9YM= github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c= -github.com/googleapis/gax-go/v2 v2.5.1 h1:kBRZU0PSuI7PspsSb/ChWoVResUcwNVIdpB049pKTiw= -github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqEF02fYlzkUCyo= +github.com/googleapis/gax-go/v2 v2.6.0 h1:SXk3ABtQYDT/OH8jAyvEOQ58mgawq5C4o/4/89qN2ZU= +github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY= github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8/go.mod h1:dvDLG8qkwmyD9a/MJJN3XJcT3xFxOKAvTZGvuZmac9g= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= @@ -714,8 +715,8 @@ google.golang.org/genproto v0.0.0-20220608133413-ed9918b62aac/go.mod h1:KEWEmljW google.golang.org/genproto v0.0.0-20220616135557-88e70c0c3a90/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= google.golang.org/genproto v0.0.0-20220617124728-180714bec0ad/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= -google.golang.org/genproto v0.0.0-20220915135415-7fd63a7952de h1:5ANeKFmGdtiputJJYeUVg8nTGA/1bEirx4CgzcnPSx8= -google.golang.org/genproto v0.0.0-20220915135415-7fd63a7952de/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo= +google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e h1:halCgTFuLWDRD61piiNSxPsARANGD3Xl16hPrLgLiIg= +google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqwhZAwq4wsRUaVG555sVgsNmIjRtO7t/JH29U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -747,8 +748,8 @@ google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11 google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.48.0 h1:rQOsyJ/8+ufEDJd/Gdsz7HG220Mh9HAhFHRGnIjda0w= -google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.50.0 h1:fPVVDxY9w++VjTZsYvXWqEf9Rqar/e+9zYfxKK+W+YU= +google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= From 8edc9764b61c7768d8375110a9d7968d46bc0945 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Oct 2022 14:31:53 +0000 Subject: [PATCH 34/61] Bump google.golang.org/api from 0.98.0 to 0.99.0 Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.98.0 to 0.99.0. - [Release notes](https://github.com/googleapis/google-api-go-client/releases) - [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md) - [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.98.0...v0.99.0) --- updated-dependencies: - dependency-name: google.golang.org/api dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 10 +++++----- go.sum | 30 ++++++++++-------------------- 2 files changed, 15 insertions(+), 25 deletions(-) diff --git a/go.mod b/go.mod index 179de60b2d..ff3bc0a531 100644 --- a/go.mod +++ b/go.mod @@ -23,7 +23,7 @@ require ( require ( cloud.google.com/go/serviceusage v1.2.0 github.com/googleapis/gax-go/v2 v2.6.0 - google.golang.org/api v0.98.0 + google.golang.org/api v0.99.0 ) require ( @@ -37,7 +37,7 @@ require ( github.com/golang/protobuf v1.5.2 // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/google/uuid v1.3.0 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.1.0 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.2.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-safetemp v1.0.0 // indirect github.com/hashicorp/go-version v1.1.0 // indirect @@ -53,11 +53,11 @@ require ( github.com/spf13/pflag v1.0.5 // indirect github.com/ulikunitz/xz v0.5.8 // indirect go.opencensus.io v0.23.0 // indirect - golang.org/x/net v0.0.0-20220909164309-bea034e7d591 // indirect - golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1 // indirect + golang.org/x/net v0.0.0-20221012135044-0b7e1fb9d458 // indirect + golang.org/x/oauth2 v0.0.0-20221006150949-b44042a4b9c1 // indirect golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect golang.org/x/text v0.3.7 // indirect - golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f // indirect + golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/grpc v1.50.0 // indirect google.golang.org/protobuf v1.28.1 // indirect diff --git a/go.sum b/go.sum index b3be46dc71..31273d0934 100644 --- a/go.sum +++ b/go.sum @@ -29,7 +29,6 @@ cloud.google.com/go v0.94.1/go.mod h1:qAlAugsXlC+JWO+Bke5vCtc9ONxjQT3drlTTnAplMW cloud.google.com/go v0.97.0/go.mod h1:GF7l59pYBVlXQIBLx3a761cZ41F9bBH3JUlihCt2Udc= cloud.google.com/go v0.99.0/go.mod h1:w0Xx2nLzqWJPuozYQX+hFfCSI8WioryfRDzkoI/Y2ZA= cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w99A= -cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc= cloud.google.com/go v0.102.1 h1:vpK6iQWv/2uUeFJth4/cBHsQAGjn1iIE6AAlxipRaA0= cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= @@ -43,7 +42,6 @@ cloud.google.com/go/compute v1.3.0/go.mod h1:cCZiE1NHEtai4wiufUhW8I8S1JKkAnhnQJW cloud.google.com/go/compute v1.5.0/go.mod h1:9SMHyhJlzhlkJqrPAc839t2BZFTSk6Jdj6mkzQJeu0M= cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz/FMzPu0s= cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= -cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U= cloud.google.com/go/compute v1.10.0 h1:aoLIYaA1fX3ywihqpBk2APQKOo20nXsp1GEZQbx5Jk4= cloud.google.com/go/compute v1.10.0/go.mod h1:ER5CLbMxl90o2jtNbGSbtfOpQKR0t15FOtRsugnLrlU= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= @@ -198,8 +196,8 @@ github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+ github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/enterprise-certificate-proxy v0.0.0-20220520183353-fd19c99a87aa/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= -github.com/googleapis/enterprise-certificate-proxy v0.1.0 h1:zO8WHNx/MYiAKJ3d5spxZXZE6KHmIQGQcAzwUzV7qQw= -github.com/googleapis/enterprise-certificate-proxy v0.1.0/go.mod h1:17drOmN3MwGY7t0e+Ei9b45FFGA3fBs3x36SsCg1hq8= +github.com/googleapis/enterprise-certificate-proxy v0.2.0 h1:y8Yozv7SZtlU//QXbezB6QkpuE6jMD2/gfzk4AftXjs= +github.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gax-go/v2 v2.1.0/go.mod h1:Q3nei7sK6ybPYH7twZdmQpAd1MKb7pfu6SK+H1/DsU0= @@ -407,9 +405,8 @@ golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.0.0-20220909164309-bea034e7d591 h1:D0B/7al0LLrVC8aWF4+oxpv/m8bc7ViFfVS8/gXGdqI= -golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= +golang.org/x/net v0.0.0-20221012135044-0b7e1fb9d458 h1:MgJ6t2zo8v0tbmLCueaCbF1RM+TtB0rs3Lv8DGtOIpY= +golang.org/x/net v0.0.0-20221012135044-0b7e1fb9d458/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -430,9 +427,8 @@ golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/oauth2 v0.0.0-20220608161450-d0670ef3b1eb/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE= -golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= -golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1 h1:lxqLZaMad/dJHMFZH0NiNpiEZI/nhgWhe4wgzpE+MuA= -golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= +golang.org/x/oauth2 v0.0.0-20221006150949-b44042a4b9c1 h1:3VPzK7eqH25j7GYw5w6g/GzNRc0/fYtrxz27z1gD4W0= +golang.org/x/oauth2 v0.0.0-20221006150949-b44042a4b9c1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -503,7 +499,6 @@ golang.org/x/sys v0.0.0-20220227234510-4e6760a101f9/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220328115105-d36c6a25d886/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220502124256-b6088ccd6cba/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220517195934-5e4e11fc645e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220610221304-9f5ed59c137d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -581,9 +576,9 @@ golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f h1:uF6paiQQebLeSXkrTqHqz0MXhXXS1KgF41eUdBNvxK0= golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= +golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= +golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -621,10 +616,9 @@ google.golang.org/api v0.71.0/go.mod h1:4PyU6e6JogV1f9eA4voyrTY2batOLdgZ5qZ5HOCc google.golang.org/api v0.74.0/go.mod h1:ZpfMZOVRMywNyvJFeqL9HRWBgAuRfSjJFpe9QtRRyDs= google.golang.org/api v0.75.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA= google.golang.org/api v0.78.0/go.mod h1:1Sg78yoMLOhlQTeF+ARBoytAcH1NNyyl390YMy6rKmw= -google.golang.org/api v0.80.0/go.mod h1:xY3nI94gbvBrE0J6NHXhxOmW97HG7Khjkku6AFB3Hyg= google.golang.org/api v0.84.0/go.mod h1:NTsGnUFJMYROtiquksZHBWtHfeMC7iYthki7Eq3pa8o= -google.golang.org/api v0.98.0 h1:yxZrcxXESimy6r6mdL5Q6EnZwmewDJK2dVg3g75s5Dg= -google.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= +google.golang.org/api v0.99.0 h1:tsBtOIklCE2OFxhmcYSVqGwSAN/Y897srxmcvAQnwK8= +google.golang.org/api v0.99.0/go.mod h1:1YOf74vkVndF7pG6hIHuINsM7eWwpVTAfNMNiL91A08= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -710,11 +704,8 @@ google.golang.org/genproto v0.0.0-20220421151946-72621c1f0bd3/go.mod h1:8w6bsBMX google.golang.org/genproto v0.0.0-20220429170224-98d788798c3e/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= google.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= google.golang.org/genproto v0.0.0-20220518221133-4f43b3371335/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= -google.golang.org/genproto v0.0.0-20220523171625-347a074981d8/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= google.golang.org/genproto v0.0.0-20220608133413-ed9918b62aac/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= -google.golang.org/genproto v0.0.0-20220616135557-88e70c0c3a90/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= google.golang.org/genproto v0.0.0-20220617124728-180714bec0ad/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= -google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e h1:halCgTFuLWDRD61piiNSxPsARANGD3Xl16hPrLgLiIg= google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqwhZAwq4wsRUaVG555sVgsNmIjRtO7t/JH29U= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= @@ -746,7 +737,6 @@ google.golang.org/grpc v1.40.1/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9K google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/grpc v1.50.0 h1:fPVVDxY9w++VjTZsYvXWqEf9Rqar/e+9zYfxKK+W+YU= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= From 3ceebc4d641aa8e3be08da6c81470ae74e6ae108 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Oct 2022 14:41:16 +0000 Subject: [PATCH 35/61] Bump github.com/spf13/cobra from 1.5.0 to 1.6.0 Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.5.0 to 1.6.0. - [Release notes](https://github.com/spf13/cobra/releases) - [Commits](https://github.com/spf13/cobra/compare/v1.5.0...v1.6.0) --- updated-dependencies: - dependency-name: github.com/spf13/cobra dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 4 ++-- go.sum | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index ff3bc0a531..514d9c48fd 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/otiai10/copy v1.7.0 github.com/pkg/errors v0.9.1 github.com/spf13/afero v1.9.2 - github.com/spf13/cobra v1.5.0 + github.com/spf13/cobra v1.6.0 github.com/zclconf/go-cty v1.11.0 golang.org/x/exp v0.0.0-20220907003533-145caa8ea1d0 google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e @@ -41,7 +41,7 @@ require ( github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-safetemp v1.0.0 // indirect github.com/hashicorp/go-version v1.1.0 // indirect - github.com/inconshreveable/mousetrap v1.0.0 // indirect + github.com/inconshreveable/mousetrap v1.0.1 // indirect github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8 // indirect github.com/klauspost/compress v1.11.2 // indirect github.com/kr/pretty v0.2.1 // indirect diff --git a/go.sum b/go.sum index 31273d0934..7a570faebe 100644 --- a/go.sum +++ b/go.sum @@ -230,8 +230,8 @@ github.com/hashicorp/terraform-config-inspect v0.0.0-20210625153042-09f34846faab github.com/hashicorp/terraform-config-inspect v0.0.0-20210625153042-09f34846faab/go.mod h1:Z0Nnk4+3Cy89smEbrq+sl1bxc9198gIP4I7wcQF6Kqs= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc= +github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8 h1:12VvqtR6Aowv3l/EQUlocDHW2Cp4G9WJVH7uyH8QFJE= github.com/jmespath/go-jmespath v0.0.0-20160202185014-0b12d6b521d8/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= @@ -283,8 +283,8 @@ github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAm github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spf13/afero v1.9.2 h1:j49Hj62F0n+DaZ1dDCvhABaPNSGNkt32oRFxI33IEMw= github.com/spf13/afero v1.9.2/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y= -github.com/spf13/cobra v1.5.0 h1:X+jTBEBqF0bHN+9cSMgmfuvv2VHJ9ezmFNf9Y/XstYU= -github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM= +github.com/spf13/cobra v1.6.0 h1:42a0n6jwCot1pUmomAp4T7DeMD+20LFv4Q54pxLf2LI= +github.com/spf13/cobra v1.6.0/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY= github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= @@ -765,7 +765,6 @@ gopkg.in/cheggaaa/pb.v1 v1.0.27/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qS gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From ebb1daf3ffb5cdeee6fa106d59ffc79841970fb1 Mon Sep 17 00:00:00 2001 From: Tom Downes Date: Mon, 17 Oct 2022 10:33:38 -0500 Subject: [PATCH 36/61] Update ansible-lint pre-commit hook The ansible-lint hook will run on every commit by default. This is due to its not unreasonable assumption that the repo is structured primarily for storing Ansible playbooks (roles, tasks, vars, etc.). In practice, The Toolkit stores YAML files for blueprints and for Ansible in separate directories and the Ansible is not structured the way one would expect for a single playbook. This commit updates pre-commit to trigger ansible linting only on changes to YAML files in directories that do not contain blueprints. Additionally, because ansible-lint will run on the entire repo when triggered (regardless of the file that triggered it), we configure ansible-lint itself to exclude paths that do not contain ansible. --- .ansible-lint | 10 ++++++++++ .pre-commit-config.yaml | 7 ++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.ansible-lint b/.ansible-lint index 082bbbe6cb..1c350a7b71 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -1,5 +1,15 @@ skip_list: - yaml +- jinja[invalid] + +exclude_paths: + - .cache/ # implicit unless exclude_paths is defined in config + - .github/ + - cmd/ + - docs/ + - examples/ + - community/examples/ + - pkg/ mock_roles: - googlecloudplatform.google_cloud_ops_agents diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e58afe1093..aad8935de7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -57,9 +57,14 @@ repos: - id: go-critic args: [-disable, "#experimental,sloppyTypeAssert"] - repo: https://github.com/ansible/ansible-lint.git - rev: v5.4.0 + rev: v6.8.2 hooks: - id: ansible-lint + always_run: false + exclude: '^(docs/|examples/|community/examples/)' + types: [yaml] + additional_dependencies: + - ansible==6.* - repo: https://github.com/adrienverge/yamllint.git rev: v1.28.0 hooks: From 8777d1c04a2097c4cc3af0f0a318462ac3754bcd Mon Sep 17 00:00:00 2001 From: Tom Downes Date: Mon, 17 Oct 2022 10:35:05 -0500 Subject: [PATCH 37/61] Remove unnecessary quotation marks from YAML --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index aad8935de7..36ac020777 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,7 +28,7 @@ repos: name: terraform-readme entry: tools/autodoc/terraform_docs.sh language: script - types: ['terraform'] + types: [terraform] exclude: \.terraform\/.*$ pass_filenames: true require_serial: true From b1b78902cdaab55604ca72cf01a6f2ee2178ebec Mon Sep 17 00:00:00 2001 From: Tom Downes Date: Mon, 17 Oct 2022 10:50:07 -0500 Subject: [PATCH 38/61] Address ansible linting errors in integration tests --- .../base-integration-test.yml | 30 +++++++++---------- .../hello-world-integration-test.yml | 6 ++-- .../htcondor-integration-test.yml | 4 +-- .../packer-integration-test.yml | 6 ++-- .../slurm-integration-test.yml | 28 ++++++++--------- .../tasks/rescue_terraform_failure.yml | 2 +- .../tasks/wait-for-startup-script.yml | 2 +- .../test-batch-submission.yml | 2 +- .../ansible_playbooks/test-hello-world.yml | 4 +-- .../ansible_playbooks/test-spack.yml | 4 +-- 10 files changed, 44 insertions(+), 44 deletions(-) diff --git a/tools/cloud-build/daily-tests/ansible_playbooks/base-integration-test.yml b/tools/cloud-build/daily-tests/ansible_playbooks/base-integration-test.yml index 34b12a607b..e92c8a5170 100644 --- a/tools/cloud-build/daily-tests/ansible_playbooks/base-integration-test.yml +++ b/tools/cloud-build/daily-tests/ansible_playbooks/base-integration-test.yml @@ -21,17 +21,17 @@ tasks: ## Create SSH Keys - name: "Create .ssh folder" - file: + ansible.builtin.file: path: "/builder/home/.ssh" state: directory mode: 0700 - name: Create SSH Key - openssh_keypair: + community.crypto.openssh_keypair: path: "/builder/home/.ssh/id_rsa" ## Create cluster - name: Create Deployment Directory - command: "{{ scripts_dir }}/create_deployment.sh" + ansible.builtin.command: "{{ scripts_dir }}/create_deployment.sh" environment: ALWAYS_RECOMPILE: "no" EXAMPLE_YAML: "{{ blueprint_yaml }}" @@ -49,7 +49,7 @@ - name: Create Infrastructure and test block: - name: Create Cluster with Terraform - command: + ansible.builtin.command: cmd: "{{ item }}" chdir: "{{ workspace }}/{{ deployment_name }}/primary" args: @@ -67,7 +67,7 @@ retries: 2 delay: 60 until: instances_list.rc == 0 - command: >- + ansible.builtin.command: >- gcloud compute instances list --filter="labels.ghpc_deployment={{ deployment_name }}" --format='table(name,zone,id,status)' @@ -77,21 +77,21 @@ - name: Get remote IP changed_when: false register: remote_ip - command: >- + ansible.builtin.command: >- gcloud compute instances describe --zone={{ zone }} {{ remote_node }} --format='get(networkInterfaces[0].accessConfigs[0].natIP)' ## Setup firewall for cloud build - name: Get Builder IP changed_when: false - shell: >- + ansible.builtin.shell: >- dig TXT +short o-o.myaddr.l.google.com @ns1.google.com | awk -F'"' '{print $2}' register: build_ip - name: Create firewall rule register: fw_result changed_when: fw_result.rc == 0 - command: + ansible.builtin.command: argv: - gcloud - compute @@ -108,7 +108,7 @@ - name: 'Add SSH Keys to OS-Login' register: key_result changed_when: key_result.rc == 0 - command: + ansible.builtin.command: argv: - gcloud - compute @@ -119,11 +119,11 @@ - 2h - "--key-file=/builder/home/.ssh/id_rsa.pub" - name: Add Remote node as host - add_host: + ansible.builtin.add_host: hostname: "{{ remote_ip.stdout }}" groups: [remote_host] - name: Wait for cluster - wait_for_connection: + ansible.builtin.wait_for_connection: ## Cleanup and fail gracefully rescue: @@ -143,10 +143,10 @@ ansible_ssh_private_key_file: "/builder/home/.ssh/id_rsa" block: - name: Pause for 2 minutes to allow cluster setup - pause: + ansible.builtin.pause: minutes: 2 - name: Run Integration tests for HPC toolkit - include_tasks: "{{ test }}" + ansible.builtin.include_tasks: "{{ test }}" run_once: true vars: remote_node: "{{ remote_node }}" @@ -164,7 +164,7 @@ failed_when: false run_once: true delegate_to: localhost - command: + ansible.builtin.command: argv: - gcloud - compute @@ -177,6 +177,6 @@ delegate_to: localhost environment: TF_IN_AUTOMATION: "TRUE" - command: + ansible.builtin.command: cmd: terraform destroy -auto-approve chdir: "{{ workspace }}/{{ deployment_name }}/primary" diff --git a/tools/cloud-build/daily-tests/ansible_playbooks/hello-world-integration-test.yml b/tools/cloud-build/daily-tests/ansible_playbooks/hello-world-integration-test.yml index 5e91ad496c..8502550b63 100644 --- a/tools/cloud-build/daily-tests/ansible_playbooks/hello-world-integration-test.yml +++ b/tools/cloud-build/daily-tests/ansible_playbooks/hello-world-integration-test.yml @@ -16,16 +16,16 @@ # Run this locally with the following command: # ansible-playbook tools/cloud-build/daily-tests/ansible_playbooks/hello-world-integration-test.yml --extra-vars="@tools/cloud-build/daily-tests/tests/hello-world-vars.yml" --- -- name: hello world integration tests +- name: Hello world integration tests hosts: 127.0.0.1 connection: local tasks: - name: Print Hello World - debug: + ansible.builtin.debug: msg: Hello world from the base integration test. - name: Run post_deploy_tests - include_tasks: "{{ test }}" + ansible.builtin.include_tasks: "{{ test }}" run_once: true vars: top_level_var: "{{ top_level_var }}" diff --git a/tools/cloud-build/daily-tests/ansible_playbooks/htcondor-integration-test.yml b/tools/cloud-build/daily-tests/ansible_playbooks/htcondor-integration-test.yml index e4989a11eb..a3d547a6e3 100644 --- a/tools/cloud-build/daily-tests/ansible_playbooks/htcondor-integration-test.yml +++ b/tools/cloud-build/daily-tests/ansible_playbooks/htcondor-integration-test.yml @@ -26,7 +26,7 @@ state: directory mode: 0700 - name: Create SSH Key - openssh_keypair: + community.crypto.openssh_keypair: path: "/builder/home/.ssh/id_rsa" ## Create cluster @@ -157,7 +157,7 @@ delay: 10 timeout: 300 - name: Run Integration tests for HPC toolkit - include_tasks: "{{ test }}" + ansible.builtin.include_tasks: "{{ test }}" run_once: true vars: access_point: "{{ access_point }}" diff --git a/tools/cloud-build/daily-tests/ansible_playbooks/packer-integration-test.yml b/tools/cloud-build/daily-tests/ansible_playbooks/packer-integration-test.yml index 403ae50de7..6287ba2749 100644 --- a/tools/cloud-build/daily-tests/ansible_playbooks/packer-integration-test.yml +++ b/tools/cloud-build/daily-tests/ansible_playbooks/packer-integration-test.yml @@ -21,7 +21,7 @@ tasks: ## Create Deployment - name: Create Deployment Directory - command: "{{ scripts_dir }}/create_deployment.sh" + ansible.builtin.command: "{{ scripts_dir }}/create_deployment.sh" environment: ALWAYS_RECOMPILE: "no" EXAMPLE_YAML: "{{ blueprint_yaml }}" @@ -39,7 +39,7 @@ - name: Create Infrastructure and test block: - name: Create Network with Terraform - command: + ansible.builtin.command: cmd: "{{ item }}" chdir: "{{ workspace }}/{{ deployment_name }}/builder-env" args: @@ -77,6 +77,6 @@ delegate_to: localhost environment: TF_IN_AUTOMATION: "TRUE" - command: + ansible.builtin.command: cmd: terraform destroy -auto-approve -no-color chdir: "{{ workspace }}/{{ deployment_name }}/builder-env" diff --git a/tools/cloud-build/daily-tests/ansible_playbooks/slurm-integration-test.yml b/tools/cloud-build/daily-tests/ansible_playbooks/slurm-integration-test.yml index df33b23898..16d7cfb1fa 100644 --- a/tools/cloud-build/daily-tests/ansible_playbooks/slurm-integration-test.yml +++ b/tools/cloud-build/daily-tests/ansible_playbooks/slurm-integration-test.yml @@ -21,17 +21,17 @@ tasks: ## Create SSH Keys - name: "Create .ssh folder" - file: + ansible.builtin.file: path: "/builder/home/.ssh" state: directory mode: 0700 - name: Create SSH Key - openssh_keypair: + community.crypto.openssh_keypair: path: "/builder/home/.ssh/id_rsa" ## Create cluster - name: Create Deployment Directory - command: "{{ scripts_dir }}/create_deployment.sh" + ansible.builtin.command: "{{ scripts_dir }}/create_deployment.sh" environment: ALWAYS_RECOMPILE: "no" MAX_NODES: "{{ max_nodes }}" @@ -50,7 +50,7 @@ - name: Create Infrastructure and test block: - name: Create Cluster with Terraform - command: + ansible.builtin.command: cmd: "{{ item }}" chdir: "{{ workspace }}/{{ deployment_name }}/primary" args: @@ -68,7 +68,7 @@ retries: 2 delay: 60 until: instances_list.rc == 0 - command: >- + ansible.builtin.command: >- gcloud compute instances list --filter="labels.ghpc_deployment={{ deployment_name }}" --format='table(name,zone,id,status)' @@ -114,14 +114,14 @@ ## Setup firewall for cloud build - name: Get Builder IP changed_when: false - shell: >- + ansible.builtin.shell: >- dig TXT +short o-o.myaddr.l.google.com @ns1.google.com | awk -F'"' '{print $2}' register: build_ip - name: Create firewall rule register: fw_created changed_when: fw_created.rc == 0 - command: + ansible.builtin.command: argv: - gcloud - compute @@ -138,7 +138,7 @@ - name: 'Add SSH Keys to OS-Login' register: key_created changed_when: key_created.rc == 0 - command: + ansible.builtin.command: argv: - gcloud - compute @@ -149,7 +149,7 @@ - 2h - "--key-file=/builder/home/.ssh/id_rsa.pub" - name: Add Login node as host - add_host: + ansible.builtin.add_host: hostname: "{{ login_ip }}" groups: [remote_host] @@ -183,7 +183,7 @@ path: /var/run/munge/munge.socket.2 timeout: 600 - name: Run Integration tests for HPC toolkit - include_tasks: "{{ test }}" + ansible.builtin.include_tasks: "{{ test }}" run_once: true vars: login_node: "{{ login_node }}" @@ -198,7 +198,7 @@ changed_when: false failed_when: false delegate_to: "{{ hostvars['localhost']['controller_ip']['stdout'] }}" - command: cat /var/log/slurm/resume.log + ansible.builtin.command: cat /var/log/slurm/resume.log register: resume_output - name: Print Slurm resume.log ansible.builtin.debug: @@ -207,7 +207,7 @@ changed_when: false failed_when: false delegate_to: "{{ hostvars['localhost']['controller_ip']['stdout'] }}" - command: cat /var/log/slurm/suspend.log + ansible.builtin.command: cat /var/log/slurm/suspend.log register: suspend_output - name: Print Slurm suspend.log ansible.builtin.debug: @@ -218,7 +218,7 @@ failed_when: false # keep cleaning up run_once: true delegate_to: localhost - command: + ansible.builtin.command: argv: - gcloud - compute @@ -231,6 +231,6 @@ delegate_to: localhost environment: TF_IN_AUTOMATION: "TRUE" - command: + ansible.builtin.command: cmd: terraform destroy -auto-approve chdir: "{{ workspace }}/{{ deployment_name }}/primary" diff --git a/tools/cloud-build/daily-tests/ansible_playbooks/tasks/rescue_terraform_failure.yml b/tools/cloud-build/daily-tests/ansible_playbooks/tasks/rescue_terraform_failure.yml index d7c7b4f2aa..731e45b4da 100644 --- a/tools/cloud-build/daily-tests/ansible_playbooks/tasks/rescue_terraform_failure.yml +++ b/tools/cloud-build/daily-tests/ansible_playbooks/tasks/rescue_terraform_failure.yml @@ -49,6 +49,6 @@ cmd: terraform destroy -auto-approve chdir: "{{ workspace }}/{{ deployment_name }}/primary" - name: Fail Out - fail: + ansible.builtin.fail: msg: "Failed while setting up test infrastructure" when: true diff --git a/tools/cloud-build/daily-tests/ansible_playbooks/tasks/wait-for-startup-script.yml b/tools/cloud-build/daily-tests/ansible_playbooks/tasks/wait-for-startup-script.yml index b83360baa4..f74035fb49 100644 --- a/tools/cloud-build/daily-tests/ansible_playbooks/tasks/wait-for-startup-script.yml +++ b/tools/cloud-build/daily-tests/ansible_playbooks/tasks/wait-for-startup-script.yml @@ -26,6 +26,6 @@ timeout: "{{ timeout_seconds }}" register: startup_status - name: Fail if startup script exited with a non-zero return code - fail: + ansible.builtin.fail: msg: There was a failure in the startup script when: startup_status['match_groups'][0] != "0" diff --git a/tools/cloud-build/daily-tests/ansible_playbooks/test-batch-submission.yml b/tools/cloud-build/daily-tests/ansible_playbooks/test-batch-submission.yml index 2e46579485..6bbf292daf 100644 --- a/tools/cloud-build/daily-tests/ansible_playbooks/test-batch-submission.yml +++ b/tools/cloud-build/daily-tests/ansible_playbooks/test-batch-submission.yml @@ -36,7 +36,7 @@ ansible.builtin.command: gcloud alpha batch jobs list --project={{ custom_vars.project }} always: - - name: delete job + - name: Delete job register: batch_deletion changed_when: batch_deletion.rc == 0 ansible.builtin.command: gcloud alpha batch jobs delete {{ deployment_name }} --location=us-central1 --project={{ custom_vars.project }} diff --git a/tools/cloud-build/daily-tests/ansible_playbooks/test-hello-world.yml b/tools/cloud-build/daily-tests/ansible_playbooks/test-hello-world.yml index 61fdeaffe1..ae5d264223 100644 --- a/tools/cloud-build/daily-tests/ansible_playbooks/test-hello-world.yml +++ b/tools/cloud-build/daily-tests/ansible_playbooks/test-hello-world.yml @@ -21,8 +21,8 @@ - custom_vars.bar is defined - name: Print top_level_var - debug: + ansible.builtin.debug: msg: "{{ top_level_var }}" - name: Print item from custom_vars - debug: + ansible.builtin.debug: msg: "{{ custom_vars.bar }}" diff --git a/tools/cloud-build/daily-tests/ansible_playbooks/test-spack.yml b/tools/cloud-build/daily-tests/ansible_playbooks/test-spack.yml index e2a527ac6c..b09d1a49a1 100644 --- a/tools/cloud-build/daily-tests/ansible_playbooks/test-spack.yml +++ b/tools/cloud-build/daily-tests/ansible_playbooks/test-spack.yml @@ -20,10 +20,10 @@ vm_name: "{{ login_node }}" timeout_seconds: 7200 - name: Ensure spack is installed - command: spack --version + ansible.builtin.command: spack --version changed_when: False - name: Test gromacs is available on compute nodes - shell: | + ansible.builtin.shell: | spack load gromacs srun -N 1 gmx_mpi -version sleep 120 From 281e5d2763d34b045a7a6e6bd0da761953814d4a Mon Sep 17 00:00:00 2001 From: Tom Downes Date: Mon, 17 Oct 2022 10:52:53 -0500 Subject: [PATCH 39/61] Address ansible linting errors in HTCondor modules --- .../htcondor-configure/files/htcondor_configure.yml | 10 +++++----- .../htcondor-install/files/install-htcondor.yaml | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/community/modules/scheduler/htcondor-configure/files/htcondor_configure.yml b/community/modules/scheduler/htcondor-configure/files/htcondor_configure.yml index 8a82413375..ef6d4d5d34 100644 --- a/community/modules/scheduler/htcondor-configure/files/htcondor_configure.yml +++ b/community/modules/scheduler/htcondor-configure/files/htcondor_configure.yml @@ -27,7 +27,7 @@ ansible.builtin.file: name: /etc/condor/config.d/00-htcondor-9.0.config state: absent - - name: set HTCondor role + - name: Set HTCondor role ansible.builtin.copy: dest: /etc/condor/config.d/01-role mode: 0644 @@ -36,7 +36,7 @@ - name: Configure VM to be HTCondor Central Manager when: htcondor_role == 'get_htcondor_central_manager' block: - - name: set HTCondor Central Manager + - name: Set HTCondor Central Manager ansible.builtin.copy: dest: /etc/condor/config.d/00-central-manager mode: 0644 @@ -52,7 +52,7 @@ headers: Metadata-Flavor: "Google" register: cm - - name: set HTCondor Central Manager + - name: Set HTCondor Central Manager ansible.builtin.copy: dest: /etc/condor/config.d/00-central-manager mode: 0644 @@ -95,12 +95,12 @@ condor_token_create -identity condor@$TRUST_DOMAIN > /etc/condor/tokens.d/condor@$TRUST_DOMAIN args: creates: /etc/condor/passwords.d/POOL - - name: start HTCondor + - name: Start HTCondor ansible.builtin.service: name: condor state: started enabled: true - - name: inform users + - name: Inform users changed_when: false ansible.builtin.shell: | set -e -o pipefail diff --git a/community/modules/scripts/htcondor-install/files/install-htcondor.yaml b/community/modules/scripts/htcondor-install/files/install-htcondor.yaml index 1c591fd97f..1f7a2805cb 100644 --- a/community/modules/scripts/htcondor-install/files/install-htcondor.yaml +++ b/community/modules/scripts/htcondor-install/files/install-htcondor.yaml @@ -13,23 +13,23 @@ # limitations under the License. --- -- name: ensure HTCondor is installed +- name: Ensure HTCondor is installed hosts: all vars: block_metadata_server: true enable_docker: true become: true tasks: - - name: setup HTCondor yum repository + - name: Setup HTCondor yum repository ansible.builtin.yum: name: - epel-release - https://research.cs.wisc.edu/htcondor/repo/9.x/htcondor-release-current.el7.noarch.rpm - - name: install HTCondor + - name: Install HTCondor ansible.builtin.yum: name: condor state: present - - name: ensure token directory + - name: Ensure token directory ansible.builtin.file: path: /etc/condor/tokens.d mode: 0700 From 64b772df02d8d31de87afbcb206e4ce55bae12a1 Mon Sep 17 00:00:00 2001 From: Nick Stroud Date: Wed, 12 Oct 2022 18:42:47 -0700 Subject: [PATCH 40/61] Add empty fields to network_storage for client install and mount runners --- .../modules/file-system/DDN-EXAScaler/outputs.tf | 12 +++++++----- community/modules/file-system/nfs-server/outputs.tf | 12 +++++++----- modules/file-system/filestore/outputs.tf | 12 +++++++----- .../pre-existing-network-storage/outputs.tf | 12 +++++++----- 4 files changed, 28 insertions(+), 20 deletions(-) diff --git a/community/modules/file-system/DDN-EXAScaler/outputs.tf b/community/modules/file-system/DDN-EXAScaler/outputs.tf index 3b99ad8702..ba041c2491 100644 --- a/community/modules/file-system/DDN-EXAScaler/outputs.tf +++ b/community/modules/file-system/DDN-EXAScaler/outputs.tf @@ -67,10 +67,12 @@ output "http_console" { output "network_storage" { description = "Describes a EXAScaler system to be mounted by other systems." value = { - server_ip = split(":", split(" ", module.ddn_exascaler.mount_command)[3])[0] - remote_mount = length(regexall("^/.*", var.fsname)) > 0 ? var.fsname : format("/%s", var.fsname) - local_mount = var.local_mount != null ? var.local_mount : format("/mnt/%s", var.fsname) - fs_type = "lustre" - mount_options = "" + server_ip = split(":", split(" ", module.ddn_exascaler.mount_command)[3])[0] + remote_mount = length(regexall("^/.*", var.fsname)) > 0 ? var.fsname : format("/%s", var.fsname) + local_mount = var.local_mount != null ? var.local_mount : format("/mnt/%s", var.fsname) + fs_type = "lustre" + mount_options = "" + client_install_runner = null + mount_runner = null } } diff --git a/community/modules/file-system/nfs-server/outputs.tf b/community/modules/file-system/nfs-server/outputs.tf index cedcdbe1d8..9318669454 100644 --- a/community/modules/file-system/nfs-server/outputs.tf +++ b/community/modules/file-system/nfs-server/outputs.tf @@ -17,11 +17,13 @@ output "network_storage" { description = "export of all desired folder directories" value = [for mount in var.local_mounts : { - remote_mount = "/exports${mount}" - local_mount = mount - fs_type = "nfs" - mount_options = "defaults,hard,intr" - server_ip = google_compute_instance.compute_instance.network_interface[0].network_ip + remote_mount = "/exports${mount}" + local_mount = mount + fs_type = "nfs" + mount_options = "defaults,hard,intr" + server_ip = google_compute_instance.compute_instance.network_interface[0].network_ip + client_install_runner = null + mount_runner = null } ] } diff --git a/modules/file-system/filestore/outputs.tf b/modules/file-system/filestore/outputs.tf index 7e28e83166..cc60b82639 100644 --- a/modules/file-system/filestore/outputs.tf +++ b/modules/file-system/filestore/outputs.tf @@ -17,11 +17,13 @@ output "network_storage" { description = "Describes a filestore instance." value = { - server_ip = google_filestore_instance.filestore_instance.networks[0].ip_addresses[0] - remote_mount = format("/%s", google_filestore_instance.filestore_instance.file_shares[0].name) - local_mount = var.local_mount - fs_type = "nfs" - mount_options = "defaults,_netdev" + server_ip = google_filestore_instance.filestore_instance.networks[0].ip_addresses[0] + remote_mount = format("/%s", google_filestore_instance.filestore_instance.file_shares[0].name) + local_mount = var.local_mount + fs_type = "nfs" + mount_options = "defaults,_netdev" + client_install_runner = null + mount_runner = null } } diff --git a/modules/file-system/pre-existing-network-storage/outputs.tf b/modules/file-system/pre-existing-network-storage/outputs.tf index 700dcc36cd..27b45e9c0a 100644 --- a/modules/file-system/pre-existing-network-storage/outputs.tf +++ b/modules/file-system/pre-existing-network-storage/outputs.tf @@ -17,11 +17,13 @@ output "network_storage" { description = "Describes a remote network storage to be mounted by fs-tab." value = { - server_ip = var.server_ip - remote_mount = var.remote_mount - local_mount = var.local_mount - fs_type = var.fs_type - mount_options = var.mount_options + server_ip = var.server_ip + remote_mount = var.remote_mount + local_mount = var.local_mount + fs_type = var.fs_type + mount_options = var.mount_options + client_install_runner = null + mount_runner = null } } From 703fcdc3060b962c45391fc8cbdd70c2bb2cbc5e Mon Sep 17 00:00:00 2001 From: Nick Stroud Date: Fri, 14 Oct 2022 11:55:13 -0700 Subject: [PATCH 41/61] Add mount and install runners to DDN network_storage --- .../file-system/DDN-EXAScaler/outputs.tf | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/community/modules/file-system/DDN-EXAScaler/outputs.tf b/community/modules/file-system/DDN-EXAScaler/outputs.tf index ba041c2491..904b2f82f1 100644 --- a/community/modules/file-system/DDN-EXAScaler/outputs.tf +++ b/community/modules/file-system/DDN-EXAScaler/outputs.tf @@ -31,18 +31,26 @@ output "client_config_script" { output "install_ddn_lustre_client_runner" { description = "Runner that encapsulates the `client_config_script` output on this module." - value = { + value = local.client_install_runner +} + +locals { + client_install_runner = { "type" = "shell" "content" = module.ddn_exascaler.client_config "destination" = "install_ddn_lustre_client.sh" } -} -locals { + # DDN mount command does not support custom local mount split_mount_cmd = split(" ", module.ddn_exascaler.mount_command) split_mount_cmd_wo_mountpoint = slice(local.split_mount_cmd, 0, length(local.split_mount_cmd) - 1) mount_cmd = "${join(" ", local.split_mount_cmd_wo_mountpoint)} ${var.local_mount}" mount_cmd_w_mkdir = "mkdir -p ${var.local_mount} && ${local.mount_cmd}" + mount_runner = { + "type" = "shell" + "content" = local.mount_cmd_w_mkdir + "destination" = "mount-ddn-lustre.sh" + } } output "mount_command" { @@ -52,11 +60,7 @@ output "mount_command" { output "mount_runner" { description = "Runner to mount the DDN EXAScaler Lustre file system" - value = { - "type" = "shell" - "content" = local.mount_cmd_w_mkdir - "destination" = "mount-ddn-lustre.sh" - } + value = local.mount_runner } output "http_console" { @@ -72,7 +76,7 @@ output "network_storage" { local_mount = var.local_mount != null ? var.local_mount : format("/mnt/%s", var.fsname) fs_type = "lustre" mount_options = "" - client_install_runner = null - mount_runner = null + client_install_runner = local.client_install_runner + mount_runner = local.mount_runner } } From 71f2e6a7d8d989830288d3c1cf08056557c4057d Mon Sep 17 00:00:00 2001 From: Nick Stroud Date: Fri, 14 Oct 2022 11:59:22 -0700 Subject: [PATCH 42/61] Add mount and install runners to nfs & filestore network_storage --- community/modules/file-system/nfs-server/outputs.tf | 4 ++-- modules/file-system/filestore/outputs.tf | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/community/modules/file-system/nfs-server/outputs.tf b/community/modules/file-system/nfs-server/outputs.tf index 9318669454..08670bce25 100644 --- a/community/modules/file-system/nfs-server/outputs.tf +++ b/community/modules/file-system/nfs-server/outputs.tf @@ -22,8 +22,8 @@ output "network_storage" { fs_type = "nfs" mount_options = "defaults,hard,intr" server_ip = google_compute_instance.compute_instance.network_interface[0].network_ip - client_install_runner = null - mount_runner = null + client_install_runner = local.install_nfs_client_runner + mount_runner = local.mount_runner } ] } diff --git a/modules/file-system/filestore/outputs.tf b/modules/file-system/filestore/outputs.tf index cc60b82639..1126828e43 100644 --- a/modules/file-system/filestore/outputs.tf +++ b/modules/file-system/filestore/outputs.tf @@ -22,8 +22,8 @@ output "network_storage" { local_mount = var.local_mount fs_type = "nfs" mount_options = "defaults,_netdev" - client_install_runner = null - mount_runner = null + client_install_runner = local.install_nfs_client_runner + mount_runner = local.mount_runner } } From 9a035b486c654d7e94489eb9598dd37c996f9b79 Mon Sep 17 00:00:00 2001 From: Nick Stroud Date: Fri, 14 Oct 2022 12:19:31 -0700 Subject: [PATCH 43/61] Add mount and install runners to pre-existing-network-storage --- .../file-system/DDN-EXAScaler/outputs.tf | 2 +- .../pre-existing-network-storage/outputs.tf | 27 ++++++++++--------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/community/modules/file-system/DDN-EXAScaler/outputs.tf b/community/modules/file-system/DDN-EXAScaler/outputs.tf index 904b2f82f1..5eeae9d005 100644 --- a/community/modules/file-system/DDN-EXAScaler/outputs.tf +++ b/community/modules/file-system/DDN-EXAScaler/outputs.tf @@ -41,7 +41,7 @@ locals { "destination" = "install_ddn_lustre_client.sh" } - # DDN mount command does not support custom local mount + # Mount command provided by DDN does not support custom local mount split_mount_cmd = split(" ", module.ddn_exascaler.mount_command) split_mount_cmd_wo_mountpoint = slice(local.split_mount_cmd, 0, length(local.split_mount_cmd) - 1) mount_cmd = "${join(" ", local.split_mount_cmd_wo_mountpoint)} ${var.local_mount}" diff --git a/modules/file-system/pre-existing-network-storage/outputs.tf b/modules/file-system/pre-existing-network-storage/outputs.tf index 27b45e9c0a..e8e92c88a3 100644 --- a/modules/file-system/pre-existing-network-storage/outputs.tf +++ b/modules/file-system/pre-existing-network-storage/outputs.tf @@ -22,8 +22,8 @@ output "network_storage" { local_mount = var.local_mount fs_type = var.fs_type mount_options = var.mount_options - client_install_runner = null - mount_runner = null + client_install_runner = local.client_install_runner + mount_runner = local.mount_runner } } @@ -42,21 +42,14 @@ locals { install_scripts = { "lustre" = local.ddn_lustre_client_install_script } - mount_supported_fstype = ["lustre"] -} - -output "client_install_runner" { - description = "Runner that performs client installation needed to use file system." - value = { + client_install_runner = { "type" = "shell" "content" = lookup(local.install_scripts, var.fs_type, "echo 'skipping: client_install_runner not yet supported for ${var.fs_type}'") "destination" = "install_filesystem_client${replace(var.local_mount, "/", "_")}.sh" } -} -output "mount_runner" { - description = "Runner that mounts the file system." - value = { + mount_supported_fstype = ["lustre"] + mount_runner = { "type" = "shell" "destination" = "mount_filesystem${replace(var.local_mount, "/", "_")}.sh" "args" = "\"${var.server_ip}\" \"${local.remote_mount_with_slash}\" \"${var.local_mount}\" \"${var.fs_type}\" \"${var.mount_options}\"" @@ -67,3 +60,13 @@ output "mount_runner" { ) } } + +output "client_install_runner" { + description = "Runner that performs client installation needed to use file system." + value = local.client_install_runner +} + +output "mount_runner" { + description = "Runner that mounts the file system." + value = local.mount_runner +} From 61073c47fb78c642f5ea5103657659efaf233d58 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Oct 2022 22:39:18 +0000 Subject: [PATCH 44/61] Bump github.com/zclconf/go-cty from 1.11.0 to 1.11.1 Bumps [github.com/zclconf/go-cty](https://github.com/zclconf/go-cty) from 1.11.0 to 1.11.1. - [Release notes](https://github.com/zclconf/go-cty/releases) - [Changelog](https://github.com/zclconf/go-cty/blob/main/CHANGELOG.md) - [Commits](https://github.com/zclconf/go-cty/compare/v1.11.0...v1.11.1) --- updated-dependencies: - dependency-name: github.com/zclconf/go-cty dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 514d9c48fd..f471d4cb69 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/pkg/errors v0.9.1 github.com/spf13/afero v1.9.2 github.com/spf13/cobra v1.6.0 - github.com/zclconf/go-cty v1.11.0 + github.com/zclconf/go-cty v1.11.1 golang.org/x/exp v0.0.0-20220907003533-145caa8ea1d0 google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f diff --git a/go.sum b/go.sum index 7a570faebe..05f689bdef 100644 --- a/go.sum +++ b/go.sum @@ -306,8 +306,8 @@ github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/zclconf/go-cty v1.1.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= -github.com/zclconf/go-cty v1.11.0 h1:726SxLdi2SDnjY+BStqB9J1hNp4+2WlzyXLuimibIe0= -github.com/zclconf/go-cty v1.11.0/go.mod h1:s9IfD1LK5ccNMSWCVFCE2rJfHiZgi7JijgeWIMfhLvA= +github.com/zclconf/go-cty v1.11.1 h1:UMMYDL4riBFaPdzjEWcDdWG7x/Adz8E8f9OX/MGR7V4= +github.com/zclconf/go-cty v1.11.1/go.mod h1:s9IfD1LK5ccNMSWCVFCE2rJfHiZgi7JijgeWIMfhLvA= go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= From ad4b01c9f0087901ff94018e1387f81dcfd2a3cb Mon Sep 17 00:00:00 2001 From: Nick Stroud Date: Mon, 17 Oct 2022 20:31:29 -0700 Subject: [PATCH 45/61] Improve and document mount.sh by adding to fstab first and mounting from fstab --- .../pre-existing-network-storage/README.md | 16 +++++++++++++++ .../scripts/mount.sh | 20 ++++++++----------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/modules/file-system/pre-existing-network-storage/README.md b/modules/file-system/pre-existing-network-storage/README.md index c68ba5590d..5041e0d29c 100644 --- a/modules/file-system/pre-existing-network-storage/README.md +++ b/modules/file-system/pre-existing-network-storage/README.md @@ -24,6 +24,22 @@ This creates a pre-existing-network-storage module in terraform at the provided IP in `server_ip` of type nfs that will be mounted at `/home`. Note that the `server_ip` must be known before deployment. +### Mounting + +For some `fs_type`, this module will provide `client_install_runner` and +`mount_runner` outputs. These can be used to create a startup script to mount +the network storage system. + +Supported `fs_type`: + +- lustre (DDN) + +[scripts/mount.sh](./scripts/mount.sh) is used as the contents of +`mount_runner`. This script will update `/etc/fstab` and mount the +network storage. Behavior is undefined if: + +- System already has an entry in `/etc/fstab` for `local_mount`. + ## License diff --git a/modules/file-system/pre-existing-network-storage/scripts/mount.sh b/modules/file-system/pre-existing-network-storage/scripts/mount.sh index 976561ffbe..ec080fbd2d 100644 --- a/modules/file-system/pre-existing-network-storage/scripts/mount.sh +++ b/modules/file-system/pre-existing-network-storage/scripts/mount.sh @@ -19,18 +19,6 @@ LOCAL_MOUNT=$3 FS_TYPE=$4 MOUNT_OPTIONS=$5 -if ! findmnt --source "${SERVER_IP}":"${REMOTE_MOUNT_WITH_SLASH}" --target "${LOCAL_MOUNT}" &>/dev/null; then - echo "Mounting --source ${SERVER_IP}:${REMOTE_MOUNT_WITH_SLASH} --target ${LOCAL_MOUNT}" - mkdir -p "${LOCAL_MOUNT}" - if [ -z "${MOUNT_OPTIONS}" ]; then - mount -t "${FS_TYPE}" "${SERVER_IP}":"${REMOTE_MOUNT_WITH_SLASH}" "${LOCAL_MOUNT}" - else - mount -t "${FS_TYPE}" -o "${MOUNT_OPTIONS}" "${SERVER_IP}":"${REMOTE_MOUNT_WITH_SLASH}" "${LOCAL_MOUNT}" - fi -else - echo "Skipping mounting source: ${SERVER_IP}:${REMOTE_MOUNT_WITH_SLASH}, already mounted to target:${LOCAL_MOUNT}" -fi - MOUNT_IDENTIFIER="${SERVER_IP}:${REMOTE_MOUNT_WITH_SLASH}[[:space:]]${LOCAL_MOUNT}" if ! grep -q "${MOUNT_IDENTIFIER}" /etc/fstab; then echo "Adding ${SERVER_IP}:${REMOTE_MOUNT_WITH_SLASH} -> ${LOCAL_MOUNT} to /etc/fstab" @@ -40,3 +28,11 @@ if ! grep -q "${MOUNT_IDENTIFIER}" /etc/fstab; then else echo "Skipping editing /etc/fstab as entry already exists" fi + +if ! findmnt --source "${SERVER_IP}":"${REMOTE_MOUNT_WITH_SLASH}" --target "${LOCAL_MOUNT}" &>/dev/null; then + echo "Mounting --target ${LOCAL_MOUNT} from fstab" + mkdir -p "${LOCAL_MOUNT}" + mount --target "${LOCAL_MOUNT}" +else + echo "Skipping mounting source: ${SERVER_IP}:${REMOTE_MOUNT_WITH_SLASH}, already mounted to target:${LOCAL_MOUNT}" +fi From b2ea061b02fb67598d0b116da76868e20dbbdf3f Mon Sep 17 00:00:00 2001 From: Nick Stroud Date: Mon, 17 Oct 2022 20:33:26 -0700 Subject: [PATCH 46/61] Update DDN Lustre client install to undo mounting and fstab edit --- .../templates/ddn_exascaler_luster_client_install.tftpl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/file-system/pre-existing-network-storage/templates/ddn_exascaler_luster_client_install.tftpl b/modules/file-system/pre-existing-network-storage/templates/ddn_exascaler_luster_client_install.tftpl index f4ae0a9848..59a14d077c 100644 --- a/modules/file-system/pre-existing-network-storage/templates/ddn_exascaler_luster_client_install.tftpl +++ b/modules/file-system/pre-existing-network-storage/templates/ddn_exascaler_luster_client_install.tftpl @@ -46,3 +46,5 @@ do done chmod +x /usr/sbin/esc-client esc-client auto setup --config /etc/esc-client.conf +esc-client unmount -m "${local_mount}" +mv /etc/fstab.last /etc/fstab From a726cbbcea840c53b6d607933fa1083d2bdfde87 Mon Sep 17 00:00:00 2001 From: Alex Heye Date: Tue, 18 Oct 2022 19:36:22 +0000 Subject: [PATCH 47/61] Add default compute SA for controller --- .../examples/slurm-gcp-v5-hpc-centos7.yaml | 1 + .../schedmd-slurm-gcp-v5-controller/README.md | 11 ++-- .../schedmd-slurm-gcp-v5-controller/main.tf | 51 +++++++++++-------- .../variables.tf | 9 ++-- .../versions.tf | 9 ++++ 5 files changed, 52 insertions(+), 29 deletions(-) diff --git a/community/examples/slurm-gcp-v5-hpc-centos7.yaml b/community/examples/slurm-gcp-v5-hpc-centos7.yaml index 512c2f331c..db16bbdbcc 100644 --- a/community/examples/slurm-gcp-v5-hpc-centos7.yaml +++ b/community/examples/slurm-gcp-v5-hpc-centos7.yaml @@ -70,6 +70,7 @@ deployment_groups: - homefs settings: disable_controller_public_ips: false + enable_reconfigure: true - id: slurm_login source: community/modules/scheduler/schedmd-slurm-gcp-v5-login diff --git a/community/modules/scheduler/schedmd-slurm-gcp-v5-controller/README.md b/community/modules/scheduler/schedmd-slurm-gcp-v5-controller/README.md index 419fa3186c..1eb135fa08 100644 --- a/community/modules/scheduler/schedmd-slurm-gcp-v5-controller/README.md +++ b/community/modules/scheduler/schedmd-slurm-gcp-v5-controller/README.md @@ -80,10 +80,13 @@ limitations under the License. | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 0.14.0 | +| [google](#requirement\_google) | >= 3.83 | ## Providers -No providers. +| Name | Version | +|------|---------| +| [google](#provider\_google) | >= 3.83 | ## Modules @@ -94,7 +97,9 @@ No providers. ## Resources -No resources. +| Name | Type | +|------|------| +| [google_compute_default_service_account.default](https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/compute_default_service_account) | data source | ## Inputs @@ -138,7 +143,7 @@ No resources. | [project\_id](#input\_project\_id) | Project ID to create resources in. | `string` | n/a | yes | | [prolog\_scripts](#input\_prolog\_scripts) | List of scripts to be used for Prolog. Programs for the slurmd to execute
whenever it is asked to run a job step from a new job allocation.
See https://slurm.schedmd.com/slurm.conf.html#OPT_Prolog. |
list(object({
filename = string
content = string
}))
| `[]` | no | | [region](#input\_region) | Region where the instances should be created. | `string` | `null` | no | -| [service\_account](#input\_service\_account) | Service account to attach to the instances. See
'main.tf:local.service\_account' for the default. |
object({
email = string
scopes = set(string)
})
| `null` | no | +| [service\_account](#input\_service\_account) | Service account to attach to the controller instance. If not set, the
default compute service account for the given project will be used with the
"https://www.googleapis.com/auth/cloud-platform" scope. |
object({
email = string
scopes = set(string)
})
| `null` | no | | [shielded\_instance\_config](#input\_shielded\_instance\_config) | Shielded VM configuration for the instance. Note: not used unless
enable\_shielded\_vm is 'true'.
enable\_integrity\_monitoring : Compare the most recent boot measurements to the
integrity policy baseline and return a pair of pass/fail results depending on
whether they match or not.
enable\_secure\_boot : Verify the digital signature of all boot components, and
halt the boot process if signature verification fails.
enable\_vtpm : Use a virtualized trusted platform module, which is a
specialized computer chip you can use to encrypt objects like keys and
certificates. |
object({
enable_integrity_monitoring = bool
enable_secure_boot = bool
enable_vtpm = bool
})
|
{
"enable_integrity_monitoring": true,
"enable_secure_boot": true,
"enable_vtpm": true
}
| no | | [slurm\_cluster\_name](#input\_slurm\_cluster\_name) | Cluster name, used for resource naming and slurm accounting. If not provided it will default to the first 8 characters of the deployment name (removing any invalid characters). | `string` | `null` | no | | [slurm\_conf\_tpl](#input\_slurm\_conf\_tpl) | Slurm slurm.conf template file path. | `string` | `null` | no | diff --git a/community/modules/scheduler/schedmd-slurm-gcp-v5-controller/main.tf b/community/modules/scheduler/schedmd-slurm-gcp-v5-controller/main.tf index 03c7cb3652..756e3929d9 100644 --- a/community/modules/scheduler/schedmd-slurm-gcp-v5-controller/main.tf +++ b/community/modules/scheduler/schedmd-slurm-gcp-v5-controller/main.tf @@ -33,6 +33,10 @@ locals { } +data "google_compute_default_service_account" "default" { + project = var.project_id +} + module "slurm_controller_instance" { source = "github.com/SchedMD/slurm-gcp.git//terraform/slurm_cluster/modules/slurm_controller_instance?ref=v5.1.0" @@ -69,28 +73,31 @@ module "slurm_controller_instance" { module "slurm_controller_template" { source = "github.com/SchedMD/slurm-gcp.git//terraform/slurm_cluster/modules/slurm_instance_template?ref=v5.1.0" - additional_disks = var.additional_disks - can_ip_forward = var.can_ip_forward - slurm_cluster_name = local.slurm_cluster_name - disable_smt = var.disable_smt - disk_auto_delete = var.disk_auto_delete - disk_labels = var.labels - disk_size_gb = var.disk_size_gb - disk_type = var.disk_type - enable_confidential_vm = var.enable_confidential_vm - enable_oslogin = var.enable_oslogin - enable_shielded_vm = var.enable_shielded_vm - gpu = var.gpu - labels = var.labels - machine_type = var.machine_type - metadata = var.metadata - min_cpu_platform = var.min_cpu_platform - network_ip = var.network_ip != null ? var.network_ip : "" - on_host_maintenance = var.on_host_maintenance - preemptible = var.preemptible - project_id = var.project_id - region = var.region - service_account = var.service_account + additional_disks = var.additional_disks + can_ip_forward = var.can_ip_forward + slurm_cluster_name = local.slurm_cluster_name + disable_smt = var.disable_smt + disk_auto_delete = var.disk_auto_delete + disk_labels = var.labels + disk_size_gb = var.disk_size_gb + disk_type = var.disk_type + enable_confidential_vm = var.enable_confidential_vm + enable_oslogin = var.enable_oslogin + enable_shielded_vm = var.enable_shielded_vm + gpu = var.gpu + labels = var.labels + machine_type = var.machine_type + metadata = var.metadata + min_cpu_platform = var.min_cpu_platform + network_ip = var.network_ip != null ? var.network_ip : "" + on_host_maintenance = var.on_host_maintenance + preemptible = var.preemptible + project_id = var.project_id + region = var.region + service_account = var.service_account != null ? var.service_account : { + email = data.google_compute_default_service_account.default.email + scopes = ["https://www.googleapis.com/auth/cloud-platform"] + } shielded_instance_config = var.shielded_instance_config slurm_instance_role = "controller" source_image_family = var.source_image_family diff --git a/community/modules/scheduler/schedmd-slurm-gcp-v5-controller/variables.tf b/community/modules/scheduler/schedmd-slurm-gcp-v5-controller/variables.tf index 793a1c3573..adfff1f5a9 100644 --- a/community/modules/scheduler/schedmd-slurm-gcp-v5-controller/variables.tf +++ b/community/modules/scheduler/schedmd-slurm-gcp-v5-controller/variables.tf @@ -392,10 +392,11 @@ variable "service_account" { email = string scopes = set(string) }) - description = < Date: Tue, 18 Oct 2022 19:45:43 +0000 Subject: [PATCH 48/61] Add default compute SA for login and partition --- .../schedmd-slurm-gcp-v5-partition/README.md | 11 ++-- .../schedmd-slurm-gcp-v5-partition/main.tf | 44 ++++++++------- .../variables.tf | 12 ++--- .../versions.tf | 9 ++++ .../schedmd-slurm-gcp-v5-login/README.md | 11 ++-- .../schedmd-slurm-gcp-v5-login/main.tf | 53 +++++++++++-------- .../schedmd-slurm-gcp-v5-login/variables.tf | 5 +- .../schedmd-slurm-gcp-v5-login/versions.tf | 9 ++++ 8 files changed, 96 insertions(+), 58 deletions(-) diff --git a/community/modules/compute/schedmd-slurm-gcp-v5-partition/README.md b/community/modules/compute/schedmd-slurm-gcp-v5-partition/README.md index cc62509377..a2580083c0 100644 --- a/community/modules/compute/schedmd-slurm-gcp-v5-partition/README.md +++ b/community/modules/compute/schedmd-slurm-gcp-v5-partition/README.md @@ -61,10 +61,13 @@ limitations under the License. | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 0.13.0 | +| [google](#requirement\_google) | >= 3.83 | ## Providers -No providers. +| Name | Version | +|------|---------| +| [google](#provider\_google) | >= 3.83 | ## Modules @@ -74,7 +77,9 @@ No providers. ## Resources -No resources. +| Name | Type | +|------|------| +| [google_compute_default_service_account.default](https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/compute_default_service_account) | data source | ## Inputs @@ -110,7 +115,7 @@ No resources. | [preemptible](#input\_preemptible) | Should use preemptibles to burst. | `string` | `false` | no | | [project\_id](#input\_project\_id) | Project in which the HPC deployment will be created. | `string` | n/a | yes | | [region](#input\_region) | The default region for Cloud resources. | `string` | n/a | yes | -| [service\_account](#input\_service\_account) | Service account to attach to the instances. See
'main.tf:local.service\_account' for the default. |
object({
email = string
scopes = set(string)
})
|
{
"email": "default",
"scopes": [
"https://www.googleapis.com/auth/cloud-platform"
]
}
| no | +| [service\_account](#input\_service\_account) | Service account to attach to the compute instances. If not set, the
default compute service account for the given project will be used with the
"https://www.googleapis.com/auth/cloud-platform" scope. |
object({
email = string
scopes = set(string)
})
| `null` | no | | [shielded\_instance\_config](#input\_shielded\_instance\_config) | Shielded VM configuration for the instance. Note: not used unless
enable\_shielded\_vm is 'true'.
* enable\_integrity\_monitoring : Compare the most recent boot measurements to the
integrity policy baseline and return a pair of pass/fail results depending on
whether they match or not.
* enable\_secure\_boot : Verify the digital signature of all boot components, and
halt the boot process if signature verification fails.
* enable\_vtpm : Use a virtualized trusted platform module, which is a
specialized computer chip you can use to encrypt objects like keys and
certificates. |
object({
enable_integrity_monitoring = bool
enable_secure_boot = bool
enable_vtpm = bool
})
|
{
"enable_integrity_monitoring": true,
"enable_secure_boot": true,
"enable_vtpm": true
}
| no | | [slurm\_cluster\_name](#input\_slurm\_cluster\_name) | Cluster name, used for resource naming and slurm accounting. If not provided it will default to the first 8 characters of the deployment name (removing any invalid characters). | `string` | `null` | no | | [source\_image](#input\_source\_image) | Source disk image. By default, the image used will be the hpc-centos7
version of the slurm-gcp public images. More information can be found in the
slurm-gcp docs:
https://github.com/SchedMD/slurm-gcp/blob/v5.0.2/docs/images.md#public-image | `string` | `null` | no | diff --git a/community/modules/compute/schedmd-slurm-gcp-v5-partition/main.tf b/community/modules/compute/schedmd-slurm-gcp-v5-partition/main.tf index c8893851ca..db661a9330 100644 --- a/community/modules/compute/schedmd-slurm-gcp-v5-partition/main.tf +++ b/community/modules/compute/schedmd-slurm-gcp-v5-partition/main.tf @@ -28,25 +28,28 @@ locals { node_conf = var.node_conf # Template By Definition - additional_disks = var.additional_disks - bandwidth_tier = var.bandwidth_tier - can_ip_forward = var.can_ip_forward - disable_smt = var.disable_smt - disk_auto_delete = var.disk_auto_delete - disk_labels = var.labels - disk_size_gb = var.disk_size_gb - disk_type = var.disk_type - enable_confidential_vm = var.enable_confidential_vm - enable_oslogin = var.enable_oslogin - enable_shielded_vm = var.enable_shielded_vm - gpu = var.gpu - labels = var.labels - machine_type = var.machine_type - metadata = var.metadata - min_cpu_platform = var.min_cpu_platform - on_host_maintenance = var.on_host_maintenance - preemptible = var.preemptible - service_account = var.service_account + additional_disks = var.additional_disks + bandwidth_tier = var.bandwidth_tier + can_ip_forward = var.can_ip_forward + disable_smt = var.disable_smt + disk_auto_delete = var.disk_auto_delete + disk_labels = var.labels + disk_size_gb = var.disk_size_gb + disk_type = var.disk_type + enable_confidential_vm = var.enable_confidential_vm + enable_oslogin = var.enable_oslogin + enable_shielded_vm = var.enable_shielded_vm + gpu = var.gpu + labels = var.labels + machine_type = var.machine_type + metadata = var.metadata + min_cpu_platform = var.min_cpu_platform + on_host_maintenance = var.on_host_maintenance + preemptible = var.preemptible + service_account = var.service_account != null ? var.service_account : { + email = data.google_compute_default_service_account.default.email + scopes = ["https://www.googleapis.com/auth/cloud-platform"] + } shielded_instance_config = var.shielded_instance_config source_image_family = var.source_image_family == null ? "" : var.source_image_family source_image_project = var.source_image_project == null ? "" : var.source_image_project @@ -68,6 +71,9 @@ locals { slurm_cluster_name = var.slurm_cluster_name != null ? var.slurm_cluster_name : local.tmp_cluster_name } +data "google_compute_default_service_account" "default" { + project = var.project_id +} module "slurm_partition" { source = "github.com/SchedMD/slurm-gcp.git//terraform/slurm_cluster/modules/slurm_partition?ref=v5.1.0" diff --git a/community/modules/compute/schedmd-slurm-gcp-v5-partition/variables.tf b/community/modules/compute/schedmd-slurm-gcp-v5-partition/variables.tf index c4dc33c8ec..6636231f0e 100644 --- a/community/modules/compute/schedmd-slurm-gcp-v5-partition/variables.tf +++ b/community/modules/compute/schedmd-slurm-gcp-v5-partition/variables.tf @@ -292,15 +292,11 @@ variable "service_account" { scopes = set(string) }) description = <<-EOD - Service account to attach to the instances. See - 'main.tf:local.service_account' for the default. + Service account to attach to the compute instances. If not set, the + default compute service account for the given project will be used with the + "https://www.googleapis.com/auth/cloud-platform" scope. EOD - default = { - email = "default" - scopes = [ - "https://www.googleapis.com/auth/cloud-platform", - ] - } + default = null } variable "shielded_instance_config" { diff --git a/community/modules/compute/schedmd-slurm-gcp-v5-partition/versions.tf b/community/modules/compute/schedmd-slurm-gcp-v5-partition/versions.tf index 1b471a522a..3b21ce7f5e 100644 --- a/community/modules/compute/schedmd-slurm-gcp-v5-partition/versions.tf +++ b/community/modules/compute/schedmd-slurm-gcp-v5-partition/versions.tf @@ -15,5 +15,14 @@ */ terraform { + required_providers { + google = { + source = "hashicorp/google" + version = ">= 3.83" + } + } + provider_meta "google" { + module_name = "blueprints/terraform/hpc-toolkit:schedmd-slurm-gcp-v5-partition/v1.6.0" + } required_version = ">= 0.13.0" } diff --git a/community/modules/scheduler/schedmd-slurm-gcp-v5-login/README.md b/community/modules/scheduler/schedmd-slurm-gcp-v5-login/README.md index d596f7e64d..3988928df1 100644 --- a/community/modules/scheduler/schedmd-slurm-gcp-v5-login/README.md +++ b/community/modules/scheduler/schedmd-slurm-gcp-v5-login/README.md @@ -62,10 +62,13 @@ limitations under the License. | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 0.14.0 | +| [google](#requirement\_google) | >= 3.83 | ## Providers -No providers. +| Name | Version | +|------|---------| +| [google](#provider\_google) | >= 3.83 | ## Modules @@ -76,7 +79,9 @@ No providers. ## Resources -No resources. +| Name | Type | +|------|------| +| [google_compute_default_service_account.default](https://registry.terraform.io/providers/hashicorp/google/latest/docs/data-sources/compute_default_service_account) | data source | ## Inputs @@ -107,7 +112,7 @@ No resources. | [preemptible](#input\_preemptible) | Allow the instance to be preempted. | `bool` | `false` | no | | [project\_id](#input\_project\_id) | Project ID to create resources in. | `string` | n/a | yes | | [region](#input\_region) | Region where the instances should be created.
Note: region will be ignored if it can be extracted from subnetwork. | `string` | `null` | no | -| [service\_account](#input\_service\_account) | Service account to attach to the instances. See
'main.tf:local.service\_account' for the default. |
object({
email = string
scopes = set(string)
})
| `null` | no | +| [service\_account](#input\_service\_account) | Service account to attach to the login instance. If not set, the
default compute service account for the given project will be used with the
"https://www.googleapis.com/auth/cloud-platform" scope. |
object({
email = string
scopes = set(string)
})
| `null` | no | | [shielded\_instance\_config](#input\_shielded\_instance\_config) | Shielded VM configuration for the instance. Note: not used unless
enable\_shielded\_vm is 'true'.
* enable\_integrity\_monitoring : Compare the most recent boot measurements to the
integrity policy baseline and return a pair of pass/fail results depending on
whether they match or not.
* enable\_secure\_boot : Verify the digital signature of all boot components, and
halt the boot process if signature verification fails.
* enable\_vtpm : Use a virtualized trusted platform module, which is a
specialized computer chip you can use to encrypt objects like keys and
certificates. |
object({
enable_integrity_monitoring = bool
enable_secure_boot = bool
enable_vtpm = bool
})
|
{
"enable_integrity_monitoring": true,
"enable_secure_boot": true,
"enable_vtpm": true
}
| no | | [slurm\_cluster\_name](#input\_slurm\_cluster\_name) | Cluster name, used for resource naming and slurm accounting. If not provided it will default to the first 8 characters of the deployment name (removing any invalid characters). | `string` | `null` | no | | [source\_image](#input\_source\_image) | Source disk image. By default, the image used will be the hpc-centos7
version of the slurm-gcp public images. More information can be found in the
slurm-gcp docs:
https://github.com/SchedMD/slurm-gcp/blob/v5.0.2/docs/images.md#public-image | `string` | `null` | no | diff --git a/community/modules/scheduler/schedmd-slurm-gcp-v5-login/main.tf b/community/modules/scheduler/schedmd-slurm-gcp-v5-login/main.tf index 7e69227157..c2b9788389 100644 --- a/community/modules/scheduler/schedmd-slurm-gcp-v5-login/main.tf +++ b/community/modules/scheduler/schedmd-slurm-gcp-v5-login/main.tf @@ -28,32 +28,39 @@ locals { access_config = length(var.access_config) == 0 ? local.enable_public_ip_access_config : var.access_config } +data "google_compute_default_service_account" "default" { + project = var.project_id +} + module "slurm_login_template" { source = "github.com/SchedMD/slurm-gcp.git//terraform/slurm_cluster/modules/slurm_instance_template?ref=v5.1.0" - additional_disks = var.additional_disks - bandwidth_tier = "platform_default" - can_ip_forward = var.can_ip_forward - slurm_cluster_name = local.slurm_cluster_name - disable_smt = var.disable_smt - disk_auto_delete = var.disk_auto_delete - disk_labels = var.labels - disk_size_gb = var.disk_size_gb - disk_type = var.disk_type - enable_confidential_vm = var.enable_confidential_vm - enable_oslogin = var.enable_oslogin - enable_shielded_vm = var.enable_shielded_vm - gpu = var.gpu - labels = var.labels - machine_type = var.machine_type - metadata = var.metadata - min_cpu_platform = var.min_cpu_platform - network_ip = var.network_ip != null ? var.network_ip : "" - on_host_maintenance = var.on_host_maintenance - preemptible = var.preemptible - project_id = var.project_id - region = var.region - service_account = var.service_account + additional_disks = var.additional_disks + bandwidth_tier = "platform_default" + can_ip_forward = var.can_ip_forward + slurm_cluster_name = local.slurm_cluster_name + disable_smt = var.disable_smt + disk_auto_delete = var.disk_auto_delete + disk_labels = var.labels + disk_size_gb = var.disk_size_gb + disk_type = var.disk_type + enable_confidential_vm = var.enable_confidential_vm + enable_oslogin = var.enable_oslogin + enable_shielded_vm = var.enable_shielded_vm + gpu = var.gpu + labels = var.labels + machine_type = var.machine_type + metadata = var.metadata + min_cpu_platform = var.min_cpu_platform + network_ip = var.network_ip != null ? var.network_ip : "" + on_host_maintenance = var.on_host_maintenance + preemptible = var.preemptible + project_id = var.project_id + region = var.region + service_account = var.service_account != null ? var.service_account : { + email = data.google_compute_default_service_account.default.email + scopes = ["https://www.googleapis.com/auth/cloud-platform"] + } shielded_instance_config = var.shielded_instance_config slurm_instance_role = "login" source_image_family = var.source_image_family diff --git a/community/modules/scheduler/schedmd-slurm-gcp-v5-login/variables.tf b/community/modules/scheduler/schedmd-slurm-gcp-v5-login/variables.tf index 249d717f48..189f319e77 100644 --- a/community/modules/scheduler/schedmd-slurm-gcp-v5-login/variables.tf +++ b/community/modules/scheduler/schedmd-slurm-gcp-v5-login/variables.tf @@ -170,8 +170,9 @@ variable "service_account" { scopes = set(string) }) description = <<-EOD - Service account to attach to the instances. See - 'main.tf:local.service_account' for the default. + Service account to attach to the login instance. If not set, the + default compute service account for the given project will be used with the + "https://www.googleapis.com/auth/cloud-platform" scope. EOD default = null } diff --git a/community/modules/scheduler/schedmd-slurm-gcp-v5-login/versions.tf b/community/modules/scheduler/schedmd-slurm-gcp-v5-login/versions.tf index 6c6909233e..0489881fc7 100644 --- a/community/modules/scheduler/schedmd-slurm-gcp-v5-login/versions.tf +++ b/community/modules/scheduler/schedmd-slurm-gcp-v5-login/versions.tf @@ -15,5 +15,14 @@ */ terraform { + required_providers { + google = { + source = "hashicorp/google" + version = ">= 3.83" + } + } + provider_meta "google" { + module_name = "blueprints/terraform/hpc-toolkit:schedmd-slurm-gcp-v5-login/v1.6.0" + } required_version = ">= 0.14.0" } From e30f197314d8a6d143279bbf7c572d148c59c49f Mon Sep 17 00:00:00 2001 From: Alex Heye Date: Tue, 18 Oct 2022 20:51:54 +0000 Subject: [PATCH 49/61] Move service_account for cleaner formatting --- .../schedmd-slurm-gcp-v5-partition/main.tf | 44 ++++++++-------- .../schedmd-slurm-gcp-v5-controller/main.tf | 50 +++++++++--------- .../schedmd-slurm-gcp-v5-login/main.tf | 52 +++++++++---------- 3 files changed, 73 insertions(+), 73 deletions(-) diff --git a/community/modules/compute/schedmd-slurm-gcp-v5-partition/main.tf b/community/modules/compute/schedmd-slurm-gcp-v5-partition/main.tf index db661a9330..2cab4d9427 100644 --- a/community/modules/compute/schedmd-slurm-gcp-v5-partition/main.tf +++ b/community/modules/compute/schedmd-slurm-gcp-v5-partition/main.tf @@ -28,33 +28,33 @@ locals { node_conf = var.node_conf # Template By Definition - additional_disks = var.additional_disks - bandwidth_tier = var.bandwidth_tier - can_ip_forward = var.can_ip_forward - disable_smt = var.disable_smt - disk_auto_delete = var.disk_auto_delete - disk_labels = var.labels - disk_size_gb = var.disk_size_gb - disk_type = var.disk_type - enable_confidential_vm = var.enable_confidential_vm - enable_oslogin = var.enable_oslogin - enable_shielded_vm = var.enable_shielded_vm - gpu = var.gpu - labels = var.labels - machine_type = var.machine_type - metadata = var.metadata - min_cpu_platform = var.min_cpu_platform - on_host_maintenance = var.on_host_maintenance - preemptible = var.preemptible - service_account = var.service_account != null ? var.service_account : { - email = data.google_compute_default_service_account.default.email - scopes = ["https://www.googleapis.com/auth/cloud-platform"] - } + additional_disks = var.additional_disks + bandwidth_tier = var.bandwidth_tier + can_ip_forward = var.can_ip_forward + disable_smt = var.disable_smt + disk_auto_delete = var.disk_auto_delete + disk_labels = var.labels + disk_size_gb = var.disk_size_gb + disk_type = var.disk_type + enable_confidential_vm = var.enable_confidential_vm + enable_oslogin = var.enable_oslogin + enable_shielded_vm = var.enable_shielded_vm + gpu = var.gpu + labels = var.labels + machine_type = var.machine_type + metadata = var.metadata + min_cpu_platform = var.min_cpu_platform + on_host_maintenance = var.on_host_maintenance + preemptible = var.preemptible shielded_instance_config = var.shielded_instance_config source_image_family = var.source_image_family == null ? "" : var.source_image_family source_image_project = var.source_image_project == null ? "" : var.source_image_project source_image = var.source_image == null ? "" : var.source_image tags = var.tags + service_account = var.service_account != null ? var.service_account : { + email = data.google_compute_default_service_account.default.email + scopes = ["https://www.googleapis.com/auth/cloud-platform"] + } # Spot VM settings enable_spot_vm = var.enable_spot_vm diff --git a/community/modules/scheduler/schedmd-slurm-gcp-v5-controller/main.tf b/community/modules/scheduler/schedmd-slurm-gcp-v5-controller/main.tf index 756e3929d9..980b239c78 100644 --- a/community/modules/scheduler/schedmd-slurm-gcp-v5-controller/main.tf +++ b/community/modules/scheduler/schedmd-slurm-gcp-v5-controller/main.tf @@ -73,31 +73,27 @@ module "slurm_controller_instance" { module "slurm_controller_template" { source = "github.com/SchedMD/slurm-gcp.git//terraform/slurm_cluster/modules/slurm_instance_template?ref=v5.1.0" - additional_disks = var.additional_disks - can_ip_forward = var.can_ip_forward - slurm_cluster_name = local.slurm_cluster_name - disable_smt = var.disable_smt - disk_auto_delete = var.disk_auto_delete - disk_labels = var.labels - disk_size_gb = var.disk_size_gb - disk_type = var.disk_type - enable_confidential_vm = var.enable_confidential_vm - enable_oslogin = var.enable_oslogin - enable_shielded_vm = var.enable_shielded_vm - gpu = var.gpu - labels = var.labels - machine_type = var.machine_type - metadata = var.metadata - min_cpu_platform = var.min_cpu_platform - network_ip = var.network_ip != null ? var.network_ip : "" - on_host_maintenance = var.on_host_maintenance - preemptible = var.preemptible - project_id = var.project_id - region = var.region - service_account = var.service_account != null ? var.service_account : { - email = data.google_compute_default_service_account.default.email - scopes = ["https://www.googleapis.com/auth/cloud-platform"] - } + additional_disks = var.additional_disks + can_ip_forward = var.can_ip_forward + slurm_cluster_name = local.slurm_cluster_name + disable_smt = var.disable_smt + disk_auto_delete = var.disk_auto_delete + disk_labels = var.labels + disk_size_gb = var.disk_size_gb + disk_type = var.disk_type + enable_confidential_vm = var.enable_confidential_vm + enable_oslogin = var.enable_oslogin + enable_shielded_vm = var.enable_shielded_vm + gpu = var.gpu + labels = var.labels + machine_type = var.machine_type + metadata = var.metadata + min_cpu_platform = var.min_cpu_platform + network_ip = var.network_ip != null ? var.network_ip : "" + on_host_maintenance = var.on_host_maintenance + preemptible = var.preemptible + project_id = var.project_id + region = var.region shielded_instance_config = var.shielded_instance_config slurm_instance_role = "controller" source_image_family = var.source_image_family @@ -107,4 +103,8 @@ module "slurm_controller_template" { subnetwork_project = var.subnetwork_project == null ? "" : var.subnetwork_project subnetwork = var.subnetwork_self_link == null ? "" : var.subnetwork_self_link tags = concat([local.slurm_cluster_name], var.tags) + service_account = var.service_account != null ? var.service_account : { + email = data.google_compute_default_service_account.default.email + scopes = ["https://www.googleapis.com/auth/cloud-platform"] + } } diff --git a/community/modules/scheduler/schedmd-slurm-gcp-v5-login/main.tf b/community/modules/scheduler/schedmd-slurm-gcp-v5-login/main.tf index c2b9788389..6525a91205 100644 --- a/community/modules/scheduler/schedmd-slurm-gcp-v5-login/main.tf +++ b/community/modules/scheduler/schedmd-slurm-gcp-v5-login/main.tf @@ -35,32 +35,28 @@ data "google_compute_default_service_account" "default" { module "slurm_login_template" { source = "github.com/SchedMD/slurm-gcp.git//terraform/slurm_cluster/modules/slurm_instance_template?ref=v5.1.0" - additional_disks = var.additional_disks - bandwidth_tier = "platform_default" - can_ip_forward = var.can_ip_forward - slurm_cluster_name = local.slurm_cluster_name - disable_smt = var.disable_smt - disk_auto_delete = var.disk_auto_delete - disk_labels = var.labels - disk_size_gb = var.disk_size_gb - disk_type = var.disk_type - enable_confidential_vm = var.enable_confidential_vm - enable_oslogin = var.enable_oslogin - enable_shielded_vm = var.enable_shielded_vm - gpu = var.gpu - labels = var.labels - machine_type = var.machine_type - metadata = var.metadata - min_cpu_platform = var.min_cpu_platform - network_ip = var.network_ip != null ? var.network_ip : "" - on_host_maintenance = var.on_host_maintenance - preemptible = var.preemptible - project_id = var.project_id - region = var.region - service_account = var.service_account != null ? var.service_account : { - email = data.google_compute_default_service_account.default.email - scopes = ["https://www.googleapis.com/auth/cloud-platform"] - } + additional_disks = var.additional_disks + bandwidth_tier = "platform_default" + can_ip_forward = var.can_ip_forward + slurm_cluster_name = local.slurm_cluster_name + disable_smt = var.disable_smt + disk_auto_delete = var.disk_auto_delete + disk_labels = var.labels + disk_size_gb = var.disk_size_gb + disk_type = var.disk_type + enable_confidential_vm = var.enable_confidential_vm + enable_oslogin = var.enable_oslogin + enable_shielded_vm = var.enable_shielded_vm + gpu = var.gpu + labels = var.labels + machine_type = var.machine_type + metadata = var.metadata + min_cpu_platform = var.min_cpu_platform + network_ip = var.network_ip != null ? var.network_ip : "" + on_host_maintenance = var.on_host_maintenance + preemptible = var.preemptible + project_id = var.project_id + region = var.region shielded_instance_config = var.shielded_instance_config slurm_instance_role = "login" source_image_family = var.source_image_family @@ -70,6 +66,10 @@ module "slurm_login_template" { subnetwork_project = var.subnetwork_project == null ? "" : var.subnetwork_project subnetwork = var.subnetwork_self_link == null ? "" : var.subnetwork_self_link tags = concat([local.slurm_cluster_name], var.tags) + service_account = var.service_account != null ? var.service_account : { + email = data.google_compute_default_service_account.default.email + scopes = ["https://www.googleapis.com/auth/cloud-platform"] + } } module "slurm_login_instance" { From f9008c4fed949708834a7025a42491f8ea9a398c Mon Sep 17 00:00:00 2001 From: Alex Heye Date: Tue, 18 Oct 2022 20:54:21 +0000 Subject: [PATCH 50/61] Remove reconfigure from hpc centos7 example --- community/examples/slurm-gcp-v5-hpc-centos7.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/community/examples/slurm-gcp-v5-hpc-centos7.yaml b/community/examples/slurm-gcp-v5-hpc-centos7.yaml index db16bbdbcc..512c2f331c 100644 --- a/community/examples/slurm-gcp-v5-hpc-centos7.yaml +++ b/community/examples/slurm-gcp-v5-hpc-centos7.yaml @@ -70,7 +70,6 @@ deployment_groups: - homefs settings: disable_controller_public_ips: false - enable_reconfigure: true - id: slurm_login source: community/modules/scheduler/schedmd-slurm-gcp-v5-login From 0aef522611851eae7d3aa4aeb98528c9c4fce557 Mon Sep 17 00:00:00 2001 From: Nick Stroud Date: Tue, 18 Oct 2022 11:15:45 -0700 Subject: [PATCH 51/61] Update mounting behavior for edge cases --- .../pre-existing-network-storage/README.md | 6 +-- .../scripts/mount.sh | 39 ++++++++++++------- 2 files changed, 29 insertions(+), 16 deletions(-) diff --git a/modules/file-system/pre-existing-network-storage/README.md b/modules/file-system/pre-existing-network-storage/README.md index 5041e0d29c..6a52f3cc43 100644 --- a/modules/file-system/pre-existing-network-storage/README.md +++ b/modules/file-system/pre-existing-network-storage/README.md @@ -26,9 +26,9 @@ that the `server_ip` must be known before deployment. ### Mounting -For some `fs_type`, this module will provide `client_install_runner` and -`mount_runner` outputs. These can be used to create a startup script to mount -the network storage system. +For the `fs_type` listed below, this module will provide `client_install_runner` +and `mount_runner` outputs. These can be used to create a startup script to +mount the network storage system. Supported `fs_type`: diff --git a/modules/file-system/pre-existing-network-storage/scripts/mount.sh b/modules/file-system/pre-existing-network-storage/scripts/mount.sh index ec080fbd2d..f3a7d2dd31 100644 --- a/modules/file-system/pre-existing-network-storage/scripts/mount.sh +++ b/modules/file-system/pre-existing-network-storage/scripts/mount.sh @@ -18,21 +18,34 @@ REMOTE_MOUNT_WITH_SLASH=$2 LOCAL_MOUNT=$3 FS_TYPE=$4 MOUNT_OPTIONS=$5 +[[ -z "${MOUNT_OPTIONS}" ]] && POPULATED_MOUNT_OPTIONS="defaults" || POPULATED_MOUNT_OPTIONS="${MOUNT_OPTIONS}" -MOUNT_IDENTIFIER="${SERVER_IP}:${REMOTE_MOUNT_WITH_SLASH}[[:space:]]${LOCAL_MOUNT}" -if ! grep -q "${MOUNT_IDENTIFIER}" /etc/fstab; then - echo "Adding ${SERVER_IP}:${REMOTE_MOUNT_WITH_SLASH} -> ${LOCAL_MOUNT} to /etc/fstab" +SAME_LOCAL_IDENTIFIER="^[^#].*[[:space:]]${LOCAL_MOUNT}" +EXACT_MATCH_IDENTIFIER="${SERVER_IP}:${REMOTE_MOUNT_WITH_SLASH}[[:space:]]${LOCAL_MOUNT}[[:space:]]${FS_TYPE}[[:space:]]${POPULATED_MOUNT_OPTIONS}[[:space:]]0[[:space:]]0" - [[ -z "${MOUNT_OPTIONS}" ]] && POPULATED_MOUNT_OPTIONS="defaults" || POPULATED_MOUNT_OPTIONS="${MOUNT_OPTIONS}" - echo "${SERVER_IP}:${REMOTE_MOUNT_WITH_SLASH} ${LOCAL_MOUNT} ${FS_TYPE} ${POPULATED_MOUNT_OPTIONS} 0 0" >>/etc/fstab -else - echo "Skipping editing /etc/fstab as entry already exists" -fi +grep -q "${SAME_LOCAL_IDENTIFIER}" /etc/fstab && SAME_LOCAL_IN_FSTAB=true || SAME_LOCAL_IN_FSTAB=false +grep -q "${EXACT_MATCH_IDENTIFIER}" /etc/fstab && EXACT_IN_FSTAB=true || EXACT_IN_FSTAB=false +findmnt --source "${SERVER_IP}":"${REMOTE_MOUNT_WITH_SLASH}" --target "${LOCAL_MOUNT}" &>/dev/null && EXACT_MOUNTED=true || EXACT_MOUNTED=false -if ! findmnt --source "${SERVER_IP}":"${REMOTE_MOUNT_WITH_SLASH}" --target "${LOCAL_MOUNT}" &>/dev/null; then - echo "Mounting --target ${LOCAL_MOUNT} from fstab" - mkdir -p "${LOCAL_MOUNT}" - mount --target "${LOCAL_MOUNT}" -else +# Do nothing and success if exact entry is already in fstab and mounted +if [ "$EXACT_IN_FSTAB" = true ] && [ "${EXACT_MOUNTED}" = true ]; then echo "Skipping mounting source: ${SERVER_IP}:${REMOTE_MOUNT_WITH_SLASH}, already mounted to target:${LOCAL_MOUNT}" + exit 0 +fi + +# Fail if previous fstab entry is using same local mount +if [ "$SAME_LOCAL_IN_FSTAB" = true ] && [ "${EXACT_IN_FSTAB}" = false ]; then + echo "Mounting failed as local mount: ${LOCAL_MOUNT} was already in use in fstab" + exit 1 fi + +# Add to fstab if entry is not already there +if [ "${EXACT_IN_FSTAB}" = false ]; then + echo "Adding ${SERVER_IP}:${REMOTE_MOUNT_WITH_SLASH} -> ${LOCAL_MOUNT} to /etc/fstab" + echo "${SERVER_IP}:${REMOTE_MOUNT_WITH_SLASH} ${LOCAL_MOUNT} ${FS_TYPE} ${POPULATED_MOUNT_OPTIONS} 0 0" >>/etc/fstab +fi + +# Mount from fstab +echo "Mounting --target ${LOCAL_MOUNT} from fstab" +mkdir -p "${LOCAL_MOUNT}" +mount --target "${LOCAL_MOUNT}" From d47d4f5135ae9340ab0ca95e18ec13f67bc526ff Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 18 Oct 2022 22:42:54 +0000 Subject: [PATCH 52/61] Bump google.golang.org/api from 0.99.0 to 0.100.0 Bumps [google.golang.org/api](https://github.com/googleapis/google-api-go-client) from 0.99.0 to 0.100.0. - [Release notes](https://github.com/googleapis/google-api-go-client/releases) - [Changelog](https://github.com/googleapis/google-api-go-client/blob/main/CHANGES.md) - [Commits](https://github.com/googleapis/google-api-go-client/compare/v0.99.0...v0.100.0) --- updated-dependencies: - dependency-name: google.golang.org/api dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 10 +++++----- go.sum | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/go.mod b/go.mod index f471d4cb69..5cab1f779a 100644 --- a/go.mod +++ b/go.mod @@ -15,7 +15,7 @@ require ( github.com/spf13/cobra v1.6.0 github.com/zclconf/go-cty v1.11.1 golang.org/x/exp v0.0.0-20220907003533-145caa8ea1d0 - google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e + google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f gopkg.in/yaml.v3 v3.0.1 ) @@ -23,7 +23,7 @@ require ( require ( cloud.google.com/go/serviceusage v1.2.0 github.com/googleapis/gax-go/v2 v2.6.0 - google.golang.org/api v0.99.0 + google.golang.org/api v0.100.0 ) require ( @@ -53,12 +53,12 @@ require ( github.com/spf13/pflag v1.0.5 // indirect github.com/ulikunitz/xz v0.5.8 // indirect go.opencensus.io v0.23.0 // indirect - golang.org/x/net v0.0.0-20221012135044-0b7e1fb9d458 // indirect - golang.org/x/oauth2 v0.0.0-20221006150949-b44042a4b9c1 // indirect + golang.org/x/net v0.0.0-20221014081412-f15817d10f9b // indirect + golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 // indirect golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect golang.org/x/text v0.3.7 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/grpc v1.50.0 // indirect + google.golang.org/grpc v1.50.1 // indirect google.golang.org/protobuf v1.28.1 // indirect ) diff --git a/go.sum b/go.sum index 05f689bdef..aad047c9a3 100644 --- a/go.sum +++ b/go.sum @@ -405,8 +405,8 @@ golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.0.0-20221012135044-0b7e1fb9d458 h1:MgJ6t2zo8v0tbmLCueaCbF1RM+TtB0rs3Lv8DGtOIpY= -golang.org/x/net v0.0.0-20221012135044-0b7e1fb9d458/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= +golang.org/x/net v0.0.0-20221014081412-f15817d10f9b h1:tvrvnPFcdzp294diPnrdZZZ8XUt2Tyj7svb7X52iDuU= +golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -427,8 +427,8 @@ golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/oauth2 v0.0.0-20220608161450-d0670ef3b1eb/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE= -golang.org/x/oauth2 v0.0.0-20221006150949-b44042a4b9c1 h1:3VPzK7eqH25j7GYw5w6g/GzNRc0/fYtrxz27z1gD4W0= -golang.org/x/oauth2 v0.0.0-20221006150949-b44042a4b9c1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= +golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783 h1:nt+Q6cXKz4MosCSpnbMtqiQ8Oz0pxTef2B4Vca2lvfk= +golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -617,8 +617,8 @@ google.golang.org/api v0.74.0/go.mod h1:ZpfMZOVRMywNyvJFeqL9HRWBgAuRfSjJFpe9QtRR google.golang.org/api v0.75.0/go.mod h1:pU9QmyHLnzlpar1Mjt4IbapUCy8J+6HD6GeELN69ljA= google.golang.org/api v0.78.0/go.mod h1:1Sg78yoMLOhlQTeF+ARBoytAcH1NNyyl390YMy6rKmw= google.golang.org/api v0.84.0/go.mod h1:NTsGnUFJMYROtiquksZHBWtHfeMC7iYthki7Eq3pa8o= -google.golang.org/api v0.99.0 h1:tsBtOIklCE2OFxhmcYSVqGwSAN/Y897srxmcvAQnwK8= -google.golang.org/api v0.99.0/go.mod h1:1YOf74vkVndF7pG6hIHuINsM7eWwpVTAfNMNiL91A08= +google.golang.org/api v0.100.0 h1:LGUYIrbW9pzYQQ8NWXlaIVkgnfubVBZbMFb9P8TK374= +google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.5.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -706,8 +706,8 @@ google.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3/go.mod h1:RAyBrSAP google.golang.org/genproto v0.0.0-20220518221133-4f43b3371335/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= google.golang.org/genproto v0.0.0-20220608133413-ed9918b62aac/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= google.golang.org/genproto v0.0.0-20220617124728-180714bec0ad/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA= -google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e h1:halCgTFuLWDRD61piiNSxPsARANGD3Xl16hPrLgLiIg= -google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqwhZAwq4wsRUaVG555sVgsNmIjRtO7t/JH29U= +google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a h1:GH6UPn3ixhWcKDhpnEC55S75cerLPdpp3hrhfKYjZgw= +google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -738,8 +738,8 @@ google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ5 google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ= google.golang.org/grpc v1.46.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= -google.golang.org/grpc v1.50.0 h1:fPVVDxY9w++VjTZsYvXWqEf9Rqar/e+9zYfxKK+W+YU= -google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= +google.golang.org/grpc v1.50.1 h1:DS/BukOZWp8s6p4Dt/tOaJaTQyPyOoCcrjroHuCeLzY= +google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= From 76046d6a3844e98e350f86dc2adf03eddc6e02f5 Mon Sep 17 00:00:00 2001 From: Alex Heye Date: Tue, 18 Oct 2022 23:40:18 +0000 Subject: [PATCH 53/61] Add documentation for Slurm reconfigure option --- .../schedmd-slurm-gcp-v5-controller/README.md | 26 +++++++++++++++++++ .../variables.tf | 16 ++++++------ 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/community/modules/scheduler/schedmd-slurm-gcp-v5-controller/README.md b/community/modules/scheduler/schedmd-slurm-gcp-v5-controller/README.md index 419fa3186c..47449182ca 100644 --- a/community/modules/scheduler/schedmd-slurm-gcp-v5-controller/README.md +++ b/community/modules/scheduler/schedmd-slurm-gcp-v5-controller/README.md @@ -50,6 +50,32 @@ This creates a controller node with the following attributes: For a complete example using this module, see [slurm-gcp-v5-cluster.yaml](../../../examples/slurm-gcp-v5-cluster.yaml). +### Reconfigure Option +The schedmd-slurm-gcp-v5-controller module supports the reconfiguration of +partitions and slurm configuration in a running, active cluster. This option is +activated through the `enable_reconfigure` setting: + +```yaml +- id: slurm_controller + source: community/modules/scheduler/schedmd-slurm-gcp-v5-controller + settings: + enable_reconfigure: true +``` + +Reconfigure has some additional requirements: + +* The Pub/Sub API must be activated in the target project: + `gcloud services enable file.googleapis.com --project "<>"` +* Python package dependencies need to be installed with pip in the environment + deployment the cluster. See the [Slurm on GCP Documentation][optdeps] for more + info. +* The project in your gcloud config must match the project the cluster is being + deployed onto due to a known issue with the reconfigure scripts. To set your + default config project, run the following command: + `gcloud config set core/<>` + +[optdeps]: https://github.com/SchedMD/slurm-gcp/tree/v5.1.0/terraform/slurm_cluster#optional + ## Support The HPC Toolkit team maintains the wrapper around the [slurm-on-gcp] terraform modules. For support with the underlying modules, see the instructions in the diff --git a/community/modules/scheduler/schedmd-slurm-gcp-v5-controller/variables.tf b/community/modules/scheduler/schedmd-slurm-gcp-v5-controller/variables.tf index 793a1c3573..638522837f 100644 --- a/community/modules/scheduler/schedmd-slurm-gcp-v5-controller/variables.tf +++ b/community/modules/scheduler/schedmd-slurm-gcp-v5-controller/variables.tf @@ -189,14 +189,14 @@ variable "enable_cleanup_subscriptions" { } variable "enable_reconfigure" { - description = < Date: Tue, 18 Oct 2022 17:20:47 -0700 Subject: [PATCH 54/61] Address feedback: Add 'set -e' & reword documentation --- modules/file-system/pre-existing-network-storage/README.md | 7 +++---- .../pre-existing-network-storage/scripts/mount.sh | 2 +- .../templates/ddn_exascaler_luster_client_install.tftpl | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/modules/file-system/pre-existing-network-storage/README.md b/modules/file-system/pre-existing-network-storage/README.md index 6a52f3cc43..1971fac17e 100644 --- a/modules/file-system/pre-existing-network-storage/README.md +++ b/modules/file-system/pre-existing-network-storage/README.md @@ -35,10 +35,9 @@ Supported `fs_type`: - lustre (DDN) [scripts/mount.sh](./scripts/mount.sh) is used as the contents of -`mount_runner`. This script will update `/etc/fstab` and mount the -network storage. Behavior is undefined if: - -- System already has an entry in `/etc/fstab` for `local_mount`. +`mount_runner`. This script will update `/etc/fstab` and mount the network +storage. This script will fail if the specified `local_mount` is already being +used by another entry in `/etc/fstab`. ## License diff --git a/modules/file-system/pre-existing-network-storage/scripts/mount.sh b/modules/file-system/pre-existing-network-storage/scripts/mount.sh index f3a7d2dd31..134cb1bb53 100644 --- a/modules/file-system/pre-existing-network-storage/scripts/mount.sh +++ b/modules/file-system/pre-existing-network-storage/scripts/mount.sh @@ -12,7 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. - +set -e SERVER_IP=$1 REMOTE_MOUNT_WITH_SLASH=$2 LOCAL_MOUNT=$3 diff --git a/modules/file-system/pre-existing-network-storage/templates/ddn_exascaler_luster_client_install.tftpl b/modules/file-system/pre-existing-network-storage/templates/ddn_exascaler_luster_client_install.tftpl index 59a14d077c..db69d43b96 100644 --- a/modules/file-system/pre-existing-network-storage/templates/ddn_exascaler_luster_client_install.tftpl +++ b/modules/file-system/pre-existing-network-storage/templates/ddn_exascaler_luster_client_install.tftpl @@ -22,7 +22,7 @@ # and connected to the same network and subnet # to set up EXAScaler Cloud filesystem on a new client instance, # run the folowing commands on the client with root privileges: - +set -e if [[ ! -z $(cat /proc/filesystems | grep lustre) ]]; then echo "Skipping lustre client install as it is already supported" exit 0 From a01acaf4ef147dbf548c775cf8404eed3c1e00e4 Mon Sep 17 00:00:00 2001 From: Nick Stroud Date: Mon, 17 Oct 2022 21:01:40 -0700 Subject: [PATCH 55/61] Update filestore to use shell runner for mounting --- modules/file-system/filestore/main.tf | 12 +++-- modules/file-system/filestore/outputs.tf | 8 +-- .../file-system/filestore/scripts/mount.sh | 51 +++++++++++++++++++ 3 files changed, 64 insertions(+), 7 deletions(-) create mode 100644 modules/file-system/filestore/scripts/mount.sh diff --git a/modules/file-system/filestore/main.tf b/modules/file-system/filestore/main.tf index 70c1707f02..376e70a885 100644 --- a/modules/file-system/filestore/main.tf +++ b/modules/file-system/filestore/main.tf @@ -19,15 +19,21 @@ resource "random_id" "resource_name_suffix" { } locals { - timeouts = var.filestore_tier == "HIGH_SCALE_SSD" ? [1] : [] + timeouts = var.filestore_tier == "HIGH_SCALE_SSD" ? [1] : [] + server_ip = google_filestore_instance.filestore_instance.networks[0].ip_addresses[0] + remote_mount = format("/%s", google_filestore_instance.filestore_instance.file_shares[0].name) + fs_type = "nfs" + mount_options = "defaults,_netdev" + install_nfs_client_runner = { "type" = "shell" "source" = "${path.module}/scripts/install-nfs-client.sh" "destination" = "install-nfs.sh" } mount_runner = { - "type" = "ansible-local" - "source" = "${path.module}/scripts/mount.yaml" + "type" = "shell" + "source" = "${path.module}/scripts/mount.sh" + "args" = "\"${local.server_ip}\" \"${local.remote_mount}\" \"${var.local_mount}\" \"${local.fs_type}\" \"${local.mount_options}\"" "destination" = "mount.yaml" } } diff --git a/modules/file-system/filestore/outputs.tf b/modules/file-system/filestore/outputs.tf index 1126828e43..e9a546c316 100644 --- a/modules/file-system/filestore/outputs.tf +++ b/modules/file-system/filestore/outputs.tf @@ -17,11 +17,11 @@ output "network_storage" { description = "Describes a filestore instance." value = { - server_ip = google_filestore_instance.filestore_instance.networks[0].ip_addresses[0] - remote_mount = format("/%s", google_filestore_instance.filestore_instance.file_shares[0].name) + server_ip = local.server_ip + remote_mount = local.remote_mount local_mount = var.local_mount - fs_type = "nfs" - mount_options = "defaults,_netdev" + fs_type = local.fs_type + mount_options = local.mount_options client_install_runner = local.install_nfs_client_runner mount_runner = local.mount_runner } diff --git a/modules/file-system/filestore/scripts/mount.sh b/modules/file-system/filestore/scripts/mount.sh new file mode 100644 index 0000000000..134cb1bb53 --- /dev/null +++ b/modules/file-system/filestore/scripts/mount.sh @@ -0,0 +1,51 @@ +#!/bin/bash +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +set -e +SERVER_IP=$1 +REMOTE_MOUNT_WITH_SLASH=$2 +LOCAL_MOUNT=$3 +FS_TYPE=$4 +MOUNT_OPTIONS=$5 +[[ -z "${MOUNT_OPTIONS}" ]] && POPULATED_MOUNT_OPTIONS="defaults" || POPULATED_MOUNT_OPTIONS="${MOUNT_OPTIONS}" + +SAME_LOCAL_IDENTIFIER="^[^#].*[[:space:]]${LOCAL_MOUNT}" +EXACT_MATCH_IDENTIFIER="${SERVER_IP}:${REMOTE_MOUNT_WITH_SLASH}[[:space:]]${LOCAL_MOUNT}[[:space:]]${FS_TYPE}[[:space:]]${POPULATED_MOUNT_OPTIONS}[[:space:]]0[[:space:]]0" + +grep -q "${SAME_LOCAL_IDENTIFIER}" /etc/fstab && SAME_LOCAL_IN_FSTAB=true || SAME_LOCAL_IN_FSTAB=false +grep -q "${EXACT_MATCH_IDENTIFIER}" /etc/fstab && EXACT_IN_FSTAB=true || EXACT_IN_FSTAB=false +findmnt --source "${SERVER_IP}":"${REMOTE_MOUNT_WITH_SLASH}" --target "${LOCAL_MOUNT}" &>/dev/null && EXACT_MOUNTED=true || EXACT_MOUNTED=false + +# Do nothing and success if exact entry is already in fstab and mounted +if [ "$EXACT_IN_FSTAB" = true ] && [ "${EXACT_MOUNTED}" = true ]; then + echo "Skipping mounting source: ${SERVER_IP}:${REMOTE_MOUNT_WITH_SLASH}, already mounted to target:${LOCAL_MOUNT}" + exit 0 +fi + +# Fail if previous fstab entry is using same local mount +if [ "$SAME_LOCAL_IN_FSTAB" = true ] && [ "${EXACT_IN_FSTAB}" = false ]; then + echo "Mounting failed as local mount: ${LOCAL_MOUNT} was already in use in fstab" + exit 1 +fi + +# Add to fstab if entry is not already there +if [ "${EXACT_IN_FSTAB}" = false ]; then + echo "Adding ${SERVER_IP}:${REMOTE_MOUNT_WITH_SLASH} -> ${LOCAL_MOUNT} to /etc/fstab" + echo "${SERVER_IP}:${REMOTE_MOUNT_WITH_SLASH} ${LOCAL_MOUNT} ${FS_TYPE} ${POPULATED_MOUNT_OPTIONS} 0 0" >>/etc/fstab +fi + +# Mount from fstab +echo "Mounting --target ${LOCAL_MOUNT} from fstab" +mkdir -p "${LOCAL_MOUNT}" +mount --target "${LOCAL_MOUNT}" From e9703250b4d79b94cfa8ce12c0d8ca08dd29fdad Mon Sep 17 00:00:00 2001 From: Nick Stroud Date: Mon, 17 Oct 2022 21:02:32 -0700 Subject: [PATCH 56/61] Update pre-existing-network-storage to support runners for nfs --- .../pre-existing-network-storage/README.md | 1 + .../pre-existing-network-storage/outputs.tf | 4 +- .../scripts/install-nfs-client.sh | 37 +++++++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 modules/file-system/pre-existing-network-storage/scripts/install-nfs-client.sh diff --git a/modules/file-system/pre-existing-network-storage/README.md b/modules/file-system/pre-existing-network-storage/README.md index 1971fac17e..833da8c705 100644 --- a/modules/file-system/pre-existing-network-storage/README.md +++ b/modules/file-system/pre-existing-network-storage/README.md @@ -32,6 +32,7 @@ mount the network storage system. Supported `fs_type`: +- nfs - lustre (DDN) [scripts/mount.sh](./scripts/mount.sh) is used as the contents of diff --git a/modules/file-system/pre-existing-network-storage/outputs.tf b/modules/file-system/pre-existing-network-storage/outputs.tf index e8e92c88a3..fe7e28a6d6 100644 --- a/modules/file-system/pre-existing-network-storage/outputs.tf +++ b/modules/file-system/pre-existing-network-storage/outputs.tf @@ -38,9 +38,11 @@ locals { local_mount = var.local_mount } ) + nfs_client_install_script = file("${path.module}/scripts/install-nfs-client.sh") install_scripts = { "lustre" = local.ddn_lustre_client_install_script + "nfs" = local.nfs_client_install_script } client_install_runner = { "type" = "shell" @@ -48,7 +50,7 @@ locals { "destination" = "install_filesystem_client${replace(var.local_mount, "/", "_")}.sh" } - mount_supported_fstype = ["lustre"] + mount_supported_fstype = ["lustre", "nfs"] mount_runner = { "type" = "shell" "destination" = "mount_filesystem${replace(var.local_mount, "/", "_")}.sh" diff --git a/modules/file-system/pre-existing-network-storage/scripts/install-nfs-client.sh b/modules/file-system/pre-existing-network-storage/scripts/install-nfs-client.sh new file mode 100644 index 0000000000..6c49163eb2 --- /dev/null +++ b/modules/file-system/pre-existing-network-storage/scripts/install-nfs-client.sh @@ -0,0 +1,37 @@ +#!/bin/sh +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +if [ ! "$(which mount.nfs)" ]; then + if [ -f /etc/centos-release ] || [ -f /etc/redhat-release ] || + [ -f /etc/oracle-release ] || [ -f /etc/system-release ]; then + major_version=$(rpm -E "%{rhel}") + enable_repo="" + if [ "${major_version}" -eq "7" ]; then + enable_repo="base,epel" + elif [ "${major_version}" -eq "8" ]; then + enable_repo="baseos" + else + echo "Unsupported version of centos/RHEL/Rocky" + return 1 + fi + yum install --disablerepo="*" --enablerepo=${enable_repo} -y nfs-utils + elif [ -f /etc/debian_version ] || grep -qi ubuntu /etc/lsb-release || grep -qi ubuntu /etc/os-release; then + apt-get -y update + apt-get -y install nfs-common + else + echo 'Unsuported distribution' + return 1 + fi +fi From 20ac89fe315f235a3052707bef32ba514a54c6b3 Mon Sep 17 00:00:00 2001 From: Nick Stroud Date: Mon, 17 Oct 2022 21:41:01 -0700 Subject: [PATCH 57/61] Add pre-commit check to ensure duplicate file stay in sync --- .pre-commit-config.yaml | 8 ++++++++ tools/duplicate-diff.sh | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100755 tools/duplicate-diff.sh diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6cd90ced5b..0d8b18f147 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -39,6 +39,14 @@ repos: files: ^.*\.pkr\.hcl$ pass_filenames: true require_serial: true + - id: duplicate-diff + name: duplicate-diff + entry: tools/duplicate-diff.sh + language: script + files: ^.*\.sh$ + pass_filenames: true + require_serial: true + - repo: https://github.com/dnephin/pre-commit-golang rev: v0.5.1 hooks: diff --git a/tools/duplicate-diff.sh b/tools/duplicate-diff.sh new file mode 100755 index 0000000000..4b3b9d9213 --- /dev/null +++ b/tools/duplicate-diff.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +A="modules/file-system/filestore/scripts/mount.sh" +B="modules/file-system/pre-existing-network-storage/scripts/mount.sh" +LIST1="${A} ${B}" + +A="community/modules/file-system/nfs-server/scripts/install-nfs-client.sh" +B="modules/file-system/filestore/scripts/install-nfs-client.sh" +C="modules/file-system/pre-existing-network-storage/scripts/install-nfs-client.sh" +LIST2="${A} ${B} ${C}" + +for i in 1 2; do + [[ $i == 1 ]] && LIST="${LIST1}" || LIST="${LIST2}" + for a in $LIST; do + for b in $LIST; do + if [[ -n $(git diff --no-index "$a" "$b") ]]; then + echo "found diff between ${a} and ${b}" + exit 1 + fi + done + done +done From 1c71d49e14fc3e7a59998c9e7d808c1b9d9c97af Mon Sep 17 00:00:00 2001 From: Nick Stroud Date: Wed, 19 Oct 2022 16:55:54 -0700 Subject: [PATCH 58/61] Rewrite pre-commit in python to improve readability and make scalable --- .pre-commit-config.yaml | 8 ++++---- tools/duplicate-diff.py | 35 +++++++++++++++++++++++++++++++++++ tools/duplicate-diff.sh | 35 ----------------------------------- 3 files changed, 39 insertions(+), 39 deletions(-) create mode 100644 tools/duplicate-diff.py delete mode 100755 tools/duplicate-diff.sh diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0d8b18f147..8585f6d826 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -41,12 +41,12 @@ repos: require_serial: true - id: duplicate-diff name: duplicate-diff - entry: tools/duplicate-diff.sh - language: script - files: ^.*\.sh$ + entry: python3 tools/duplicate-diff.py + language: python + language_version: python3 + types: [shell] pass_filenames: true require_serial: true - - repo: https://github.com/dnephin/pre-commit-golang rev: v0.5.1 hooks: diff --git a/tools/duplicate-diff.py b/tools/duplicate-diff.py new file mode 100644 index 0000000000..3ecc6b7300 --- /dev/null +++ b/tools/duplicate-diff.py @@ -0,0 +1,35 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import filecmp +import sys + +duplicates = [ + [ + "modules/file-system/filestore/scripts/mount.sh", + "modules/file-system/pre-existing-network-storage/scripts/mount.sh", + ], + [ + "community/modules/file-system/nfs-server/scripts/install-nfs-client.sh", + "modules/file-system/filestore/scripts/install-nfs-client.sh", + "modules/file-system/pre-existing-network-storage/scripts/install-nfs-client.sh", + ] +] + +for group in duplicates: + first = group[0] + for second in group[1:]: + if not filecmp.cmp(first, second): # true if files are the same + print(f'found diff between {first} and {second}') + sys.exit(1) diff --git a/tools/duplicate-diff.sh b/tools/duplicate-diff.sh deleted file mode 100755 index 4b3b9d9213..0000000000 --- a/tools/duplicate-diff.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -# Copyright 2022 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -A="modules/file-system/filestore/scripts/mount.sh" -B="modules/file-system/pre-existing-network-storage/scripts/mount.sh" -LIST1="${A} ${B}" - -A="community/modules/file-system/nfs-server/scripts/install-nfs-client.sh" -B="modules/file-system/filestore/scripts/install-nfs-client.sh" -C="modules/file-system/pre-existing-network-storage/scripts/install-nfs-client.sh" -LIST2="${A} ${B} ${C}" - -for i in 1 2; do - [[ $i == 1 ]] && LIST="${LIST1}" || LIST="${LIST2}" - for a in $LIST; do - for b in $LIST; do - if [[ -n $(git diff --no-index "$a" "$b") ]]; then - echo "found diff between ${a} and ${b}" - exit 1 - fi - done - done -done From 490ce2b2e1f0d7e0648818d681f6b80d3f37ff92 Mon Sep 17 00:00:00 2001 From: Tom Downes Date: Wed, 19 Oct 2022 20:43:45 -0500 Subject: [PATCH 59/61] Remove remaining explicit installations of Ansible --- community/examples/starccm-tutorial.yaml | 4 ---- community/modules/scripts/omnia-install/README.md | 2 +- .../modules/scripts/omnia-install/outputs.tf | 15 +++++++-------- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/community/examples/starccm-tutorial.yaml b/community/examples/starccm-tutorial.yaml index d50a9a8878..0ae5752104 100644 --- a/community/examples/starccm-tutorial.yaml +++ b/community/examples/starccm-tutorial.yaml @@ -38,10 +38,6 @@ deployment_groups: sudo yum -y install libExt libXext.x86_64 nmap destination: /tmp/install-deps.sh - - type: shell - source: modules/startup-script/examples/install_ansible.sh - destination: install_ansible.sh - - type: shell content: $(homefs.install_nfs_client) destination: "/tmp/nfs_client.sh" diff --git a/community/modules/scripts/omnia-install/README.md b/community/modules/scripts/omnia-install/README.md index c602555931..be7033b45d 100644 --- a/community/modules/scripts/omnia-install/README.md +++ b/community/modules/scripts/omnia-install/README.md @@ -65,6 +65,6 @@ No resources. | [install\_omnia\_runner](#output\_install\_omnia\_runner) | Runner to install Omnia using an ansible playbook. The startup-script module
will automatically handle installation of ansible.
- id: example-startup-script
source: modules/scripts/startup-script
settings:
runners:
- $(your-omnia-id.install\_omnia\_runner)
... | | [inventory\_file](#output\_inventory\_file) | The inventory file for the omnia cluster | | [omnia\_user\_warning](#output\_omnia\_user\_warning) | Warn developers that the omnia user was created with sudo permissions | -| [setup\_omnia\_node\_runner](#output\_setup\_omnia\_node\_runner) | Runner to create the omnia user using the startup-script module.
This runner requires ansible to be installed. This can be achieved using the
install\_ansible.sh script as a prior runner in the startup-script module:
runners:
- type: shell
source: modules/startup-script/examples/install\_ansible.sh
destination: install\_ansible.sh
- $(omnia.setup\_omnia\_node\_runner)
... | +| [setup\_omnia\_node\_runner](#output\_setup\_omnia\_node\_runner) | Runner to create the omnia user using an ansible playbook. The startup-script
module will automatically handle installation of ansible.
- id: example-startup-script
source: modules/scripts/startup-script
settings:
runners:
- $(your-omnia-id.setup\_omnia\_node\_runner)
... | | [setup\_omnia\_node\_script](#output\_setup\_omnia\_node\_script) | An ansible script that adds the user that install omnia | diff --git a/community/modules/scripts/omnia-install/outputs.tf b/community/modules/scripts/omnia-install/outputs.tf index 178a546c7b..b33eaa1fc8 100644 --- a/community/modules/scripts/omnia-install/outputs.tf +++ b/community/modules/scripts/omnia-install/outputs.tf @@ -31,14 +31,13 @@ output "copy_inventory_runner" { output "setup_omnia_node_runner" { description = <<-EOT - Runner to create the omnia user using the startup-script module. - This runner requires ansible to be installed. This can be achieved using the - install_ansible.sh script as a prior runner in the startup-script module: - runners: - - type: shell - source: modules/startup-script/examples/install_ansible.sh - destination: install_ansible.sh - - $(omnia.setup_omnia_node_runner) + Runner to create the omnia user using an ansible playbook. The startup-script + module will automatically handle installation of ansible. + - id: example-startup-script + source: modules/scripts/startup-script + settings: + runners: + - $(your-omnia-id.setup_omnia_node_runner) ... EOT value = local.setup_omnia_node_runner From b89297b80ec066cb86200449d039831db484fe13 Mon Sep 17 00:00:00 2001 From: Alex Heye Date: Mon, 24 Oct 2022 16:44:30 +0000 Subject: [PATCH 60/61] Clarify reconfig requirements, point to existing warning Addresses reviewer feedback: * Renaming of "Reconfiguration option" to "Live cluster reconfiguration" * Specifies python requirement * Add pub/sub Admin role requirement. --- .../schedmd-slurm-gcp-v5-controller/README.md | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/community/modules/scheduler/schedmd-slurm-gcp-v5-controller/README.md b/community/modules/scheduler/schedmd-slurm-gcp-v5-controller/README.md index 47449182ca..5f84ff9266 100644 --- a/community/modules/scheduler/schedmd-slurm-gcp-v5-controller/README.md +++ b/community/modules/scheduler/schedmd-slurm-gcp-v5-controller/README.md @@ -11,19 +11,20 @@ The [user guide][slurm-ug] provides detailed instructions on customizing and enhancing the Slurm on GCP cluster as well as recommendations on configuring the controller for optimal performance at different scales. -> **_WARNING:_** The variables [enable\_cleanup\_compute] and +> **_WARNING:_** The variables [enable\_reconfigure], [enable\_cleanup\_compute] and > [enable\_cleanup\_subscriptions], if set to true, require additional > dependencies **to be installed on the system running `terraform apply`**. -> Python3 must be installed along with the pip packages listed in the +> Python3 (>=3.6.0, <4.0.0) must be installed along with the pip packages listed in the > [requirements.txt] file of [SchedMD/slurm-gcp]. -[SchedMD/slurm-gcp]: https://github.com/SchedMD/slurm-gcp/tree/v5.0.2 -[slurm\_controller\_instance]: https://github.com/SchedMD/slurm-gcp/tree/v5.0.2/terraform/slurm_cluster/modules/slurm_controller_instance -[slurm\_instance\_template]: https://github.com/SchedMD/slurm-gcp/tree/v5.0.2/terraform/slurm_cluster/modules/slurm_instance_template +[SchedMD/slurm-gcp]: https://github.com/SchedMD/slurm-gcp/tree/v5.1.0 +[slurm\_controller\_instance]: https://github.com/SchedMD/slurm-gcp/tree/v5.1.0/terraform/slurm_cluster/modules/slurm_controller_instance +[slurm\_instance\_template]: https://github.com/SchedMD/slurm-gcp/tree/v5.1.0/terraform/slurm_cluster/modules/slurm_instance_template [slurm-ug]: https://goo.gle/slurm-gcp-user-guide. -[requirements.txt]: https://github.com/SchedMD/slurm-gcp/blob/v5.0.2/scripts/requirements.txt +[requirements.txt]: https://github.com/SchedMD/slurm-gcp/blob/v5.1.0/scripts/requirements.txt [enable\_cleanup\_compute]: #input\_enable\_cleanup\_compute [enable\_cleanup\_subscriptions]: #input\_enable\_cleanup\_subscriptions +[enable\_reconfigure]: #input\_enable\_reconfigure ### Example @@ -50,7 +51,7 @@ This creates a controller node with the following attributes: For a complete example using this module, see [slurm-gcp-v5-cluster.yaml](../../../examples/slurm-gcp-v5-cluster.yaml). -### Reconfigure Option +### Live Cluster Reconfiguration (`enable_reconfigure`) The schedmd-slurm-gcp-v5-controller module supports the reconfiguration of partitions and slurm configuration in a running, active cluster. This option is activated through the `enable_reconfigure` setting: @@ -62,13 +63,16 @@ activated through the `enable_reconfigure` setting: enable_reconfigure: true ``` -Reconfigure has some additional requirements: +This option has some additional requirements: * The Pub/Sub API must be activated in the target project: `gcloud services enable file.googleapis.com --project "<>"` -* Python package dependencies need to be installed with pip in the environment - deployment the cluster. See the [Slurm on GCP Documentation][optdeps] for more - info. +* The authenticated user in the local development environment (or where + `terraform apply` is called) must have the Pub/Sub Admin (roles/pubsub.admin) + IAM role. +* Python and some python packages need to be installed with pip in the local + development environment deploying the cluster. For more information, see the + warning in the [description](#description) of this module. * The project in your gcloud config must match the project the cluster is being deployed onto due to a known issue with the reconfigure scripts. To set your default config project, run the following command: From e6891c5b86b02557e4cd512f38377813503dad86 Mon Sep 17 00:00:00 2001 From: Alex Heye Date: Mon, 31 Oct 2022 21:59:16 +0000 Subject: [PATCH 61/61] Update version to 1.8.0 --- cmd/root.go | 2 +- .../compute/SchedMD-slurm-on-gcp-partition/versions.tf | 2 +- .../modules/database/slurm-cloudsql-federation/versions.tf | 4 ++-- community/modules/file-system/nfs-server/versions.tf | 2 +- community/modules/project/service-enablement/versions.tf | 2 +- .../scheduler/SchedMD-slurm-on-gcp-controller/versions.tf | 2 +- .../scheduler/SchedMD-slurm-on-gcp-login-node/versions.tf | 2 +- .../modules/scheduler/cloud-batch-login-node/versions.tf | 2 +- community/modules/scheduler/htcondor-configure/versions.tf | 2 +- community/modules/scripts/wait-for-startup/versions.tf | 2 +- modules/compute/vm-instance/versions.tf | 4 ++-- modules/file-system/filestore/versions.tf | 4 ++-- modules/monitoring/dashboard/versions.tf | 2 +- modules/network/pre-existing-vpc/versions.tf | 2 +- modules/scripts/startup-script/versions.tf | 2 +- 15 files changed, 18 insertions(+), 18 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index 23ca6b855d..fec1b589ad 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -42,7 +42,7 @@ HPC deployments on the Google Cloud Platform.`, log.Fatalf("cmd.Help function failed: %s", err) } }, - Version: "v1.7.0", + Version: "v1.8.0", Annotations: annotation, } ) diff --git a/community/modules/compute/SchedMD-slurm-on-gcp-partition/versions.tf b/community/modules/compute/SchedMD-slurm-on-gcp-partition/versions.tf index 7234755540..62984e8962 100644 --- a/community/modules/compute/SchedMD-slurm-on-gcp-partition/versions.tf +++ b/community/modules/compute/SchedMD-slurm-on-gcp-partition/versions.tf @@ -22,7 +22,7 @@ terraform { } } provider_meta "google" { - module_name = "blueprints/terraform/hpc-toolkit:SchedMD-slurm-on-gcp-partition/v1.7.0" + module_name = "blueprints/terraform/hpc-toolkit:SchedMD-slurm-on-gcp-partition/v1.8.0" } required_version = ">= 0.14.0" diff --git a/community/modules/database/slurm-cloudsql-federation/versions.tf b/community/modules/database/slurm-cloudsql-federation/versions.tf index fee80ff01a..1611acdc4b 100644 --- a/community/modules/database/slurm-cloudsql-federation/versions.tf +++ b/community/modules/database/slurm-cloudsql-federation/versions.tf @@ -30,10 +30,10 @@ terraform { } } provider_meta "google" { - module_name = "blueprints/terraform/hpc-toolkit:slurm-cloudsql-federation/v1.7.0" + module_name = "blueprints/terraform/hpc-toolkit:slurm-cloudsql-federation/v1.8.0" } provider_meta "google-beta" { - module_name = "blueprints/terraform/hpc-toolkit:slurm-cloudsql-federation/v1.7.0" + module_name = "blueprints/terraform/hpc-toolkit:slurm-cloudsql-federation/v1.8.0" } required_version = ">= 0.13.0" diff --git a/community/modules/file-system/nfs-server/versions.tf b/community/modules/file-system/nfs-server/versions.tf index ba43b1c845..2f4b057cea 100644 --- a/community/modules/file-system/nfs-server/versions.tf +++ b/community/modules/file-system/nfs-server/versions.tf @@ -26,7 +26,7 @@ terraform { } } provider_meta "google" { - module_name = "blueprints/terraform/hpc-toolkit:nfs-server/v1.7.0" + module_name = "blueprints/terraform/hpc-toolkit:nfs-server/v1.8.0" } required_version = ">= 0.14.0" diff --git a/community/modules/project/service-enablement/versions.tf b/community/modules/project/service-enablement/versions.tf index d6ba0045b4..bc654959fe 100644 --- a/community/modules/project/service-enablement/versions.tf +++ b/community/modules/project/service-enablement/versions.tf @@ -22,7 +22,7 @@ terraform { } } provider_meta "google" { - module_name = "blueprints/terraform/hpc-toolkit:service-enablement/v1.7.0" + module_name = "blueprints/terraform/hpc-toolkit:service-enablement/v1.8.0" } required_version = ">= 0.14.0" diff --git a/community/modules/scheduler/SchedMD-slurm-on-gcp-controller/versions.tf b/community/modules/scheduler/SchedMD-slurm-on-gcp-controller/versions.tf index 08ae3d95af..f2c0c0c0a2 100644 --- a/community/modules/scheduler/SchedMD-slurm-on-gcp-controller/versions.tf +++ b/community/modules/scheduler/SchedMD-slurm-on-gcp-controller/versions.tf @@ -22,7 +22,7 @@ terraform { } } provider_meta "google" { - module_name = "blueprints/terraform/hpc-toolkit:SchedMD-slurm-on-gcp-controller/v1.7.0" + module_name = "blueprints/terraform/hpc-toolkit:SchedMD-slurm-on-gcp-controller/v1.8.0" } required_version = ">= 0.14.0" diff --git a/community/modules/scheduler/SchedMD-slurm-on-gcp-login-node/versions.tf b/community/modules/scheduler/SchedMD-slurm-on-gcp-login-node/versions.tf index 7688ff4c45..d33ca5172e 100644 --- a/community/modules/scheduler/SchedMD-slurm-on-gcp-login-node/versions.tf +++ b/community/modules/scheduler/SchedMD-slurm-on-gcp-login-node/versions.tf @@ -22,7 +22,7 @@ terraform { } } provider_meta "google" { - module_name = "blueprints/terraform/hpc-toolkit:SchedMD-slurm-on-gcp-login-node/v1.7.0" + module_name = "blueprints/terraform/hpc-toolkit:SchedMD-slurm-on-gcp-login-node/v1.8.0" } required_version = ">= 0.14.0" diff --git a/community/modules/scheduler/cloud-batch-login-node/versions.tf b/community/modules/scheduler/cloud-batch-login-node/versions.tf index c6a1922419..ba3818f345 100644 --- a/community/modules/scheduler/cloud-batch-login-node/versions.tf +++ b/community/modules/scheduler/cloud-batch-login-node/versions.tf @@ -22,7 +22,7 @@ terraform { } } provider_meta "google" { - module_name = "blueprints/terraform/hpc-toolkit:cloud-batch-login-node/v1.7.0" + module_name = "blueprints/terraform/hpc-toolkit:cloud-batch-login-node/v1.8.0" } required_version = ">= 0.14.0" diff --git a/community/modules/scheduler/htcondor-configure/versions.tf b/community/modules/scheduler/htcondor-configure/versions.tf index 3d8e12643f..175fe9f921 100644 --- a/community/modules/scheduler/htcondor-configure/versions.tf +++ b/community/modules/scheduler/htcondor-configure/versions.tf @@ -26,7 +26,7 @@ terraform { } } provider_meta "google" { - module_name = "blueprints/terraform/hpc-toolkit:htcondor-configure/v1.7.0" + module_name = "blueprints/terraform/hpc-toolkit:htcondor-configure/v1.8.0" } required_version = ">= 0.13.0" diff --git a/community/modules/scripts/wait-for-startup/versions.tf b/community/modules/scripts/wait-for-startup/versions.tf index ac0d192ee7..cc84af9a87 100644 --- a/community/modules/scripts/wait-for-startup/versions.tf +++ b/community/modules/scripts/wait-for-startup/versions.tf @@ -26,7 +26,7 @@ terraform { } } provider_meta "google" { - module_name = "blueprints/terraform/hpc-toolkit:wait-for-startup/v1.7.0" + module_name = "blueprints/terraform/hpc-toolkit:wait-for-startup/v1.8.0" } required_version = ">= 0.14.0" diff --git a/modules/compute/vm-instance/versions.tf b/modules/compute/vm-instance/versions.tf index c41ead4a70..d2e7dbfc69 100644 --- a/modules/compute/vm-instance/versions.tf +++ b/modules/compute/vm-instance/versions.tf @@ -27,10 +27,10 @@ terraform { } } provider_meta "google" { - module_name = "blueprints/terraform/hpc-toolkit:vm-instance/v1.7.0" + module_name = "blueprints/terraform/hpc-toolkit:vm-instance/v1.8.0" } provider_meta "google-beta" { - module_name = "blueprints/terraform/hpc-toolkit:vm-instance/v1.7.0" + module_name = "blueprints/terraform/hpc-toolkit:vm-instance/v1.8.0" } required_version = ">= 0.14.0" diff --git a/modules/file-system/filestore/versions.tf b/modules/file-system/filestore/versions.tf index 7881b2587f..15e5771c19 100644 --- a/modules/file-system/filestore/versions.tf +++ b/modules/file-system/filestore/versions.tf @@ -26,10 +26,10 @@ terraform { } } provider_meta "google" { - module_name = "blueprints/terraform/hpc-toolkit:filestore/v1.7.0" + module_name = "blueprints/terraform/hpc-toolkit:filestore/v1.8.0" } provider_meta "google-beta" { - module_name = "blueprints/terraform/hpc-toolkit:filestore/v1.7.0" + module_name = "blueprints/terraform/hpc-toolkit:filestore/v1.8.0" } required_version = ">= 0.14.0" diff --git a/modules/monitoring/dashboard/versions.tf b/modules/monitoring/dashboard/versions.tf index 40bf75c369..a6e4a101ac 100644 --- a/modules/monitoring/dashboard/versions.tf +++ b/modules/monitoring/dashboard/versions.tf @@ -22,7 +22,7 @@ terraform { } } provider_meta "google" { - module_name = "blueprints/terraform/hpc-toolkit:dashboard/v1.7.0" + module_name = "blueprints/terraform/hpc-toolkit:dashboard/v1.8.0" } required_version = ">= 0.14.0" diff --git a/modules/network/pre-existing-vpc/versions.tf b/modules/network/pre-existing-vpc/versions.tf index 2d00ec815d..deadec5cc5 100644 --- a/modules/network/pre-existing-vpc/versions.tf +++ b/modules/network/pre-existing-vpc/versions.tf @@ -22,7 +22,7 @@ terraform { } } provider_meta "google" { - module_name = "blueprints/terraform/hpc-toolkit:pre-existing-vpc/v1.7.0" + module_name = "blueprints/terraform/hpc-toolkit:pre-existing-vpc/v1.8.0" } required_version = ">= 0.14.0" diff --git a/modules/scripts/startup-script/versions.tf b/modules/scripts/startup-script/versions.tf index 19f74a95d8..99d0d3dcb2 100644 --- a/modules/scripts/startup-script/versions.tf +++ b/modules/scripts/startup-script/versions.tf @@ -30,7 +30,7 @@ terraform { } } provider_meta "google" { - module_name = "blueprints/terraform/hpc-toolkit:startup-script/v1.7.0" + module_name = "blueprints/terraform/hpc-toolkit:startup-script/v1.8.0" } required_version = ">= 0.14.0"