From d62124a80bc7ef6df85f8728808cc3379b78d41c Mon Sep 17 00:00:00 2001 From: Keith Mannthey Date: Fri, 13 May 2022 14:42:27 -0700 Subject: [PATCH 1/2] DAOSGCP-111 Remove unneeded Examples Enable daos_cluster to be used for all examples. Setting "client_number_of_instances = 0" allows just severs to be created. Only_daos_client has an unclear use. Users should use the Server output script to install new clients. Signed-off-by: Keith Mannthey --- terraform/examples/only_daos_client/README.md | 154 ------------- terraform/examples/only_daos_client/main.tf | 45 ---- .../examples/only_daos_client/module.json | 191 ---------------- .../only_daos_client/terraform.tfvars.example | 198 ---------------- .../examples/only_daos_client/variables.tf | 151 ------------- .../examples/only_daos_client/versions.tf | 22 -- terraform/examples/only_daos_server/README.md | 171 -------------- terraform/examples/only_daos_server/main.tf | 48 ---- .../examples/only_daos_server/module.json | 213 ------------------ .../terraform.tfvars.perf.example | 58 ----- .../terraform.tfvars.tco.example | 58 ----- .../examples/only_daos_server/variables.tf | 189 ---------------- .../examples/only_daos_server/versions.tf | 22 -- terraform/modules/daos_client/main.tf | 9 +- 14 files changed, 5 insertions(+), 1524 deletions(-) delete mode 100644 terraform/examples/only_daos_client/README.md delete mode 100644 terraform/examples/only_daos_client/main.tf delete mode 100644 terraform/examples/only_daos_client/module.json delete mode 100644 terraform/examples/only_daos_client/terraform.tfvars.example delete mode 100644 terraform/examples/only_daos_client/variables.tf delete mode 100644 terraform/examples/only_daos_client/versions.tf delete mode 100644 terraform/examples/only_daos_server/README.md delete mode 100644 terraform/examples/only_daos_server/main.tf delete mode 100644 terraform/examples/only_daos_server/module.json delete mode 100644 terraform/examples/only_daos_server/terraform.tfvars.perf.example delete mode 100644 terraform/examples/only_daos_server/terraform.tfvars.tco.example delete mode 100644 terraform/examples/only_daos_server/variables.tf delete mode 100644 terraform/examples/only_daos_server/versions.tf diff --git a/terraform/examples/only_daos_client/README.md b/terraform/examples/only_daos_client/README.md deleted file mode 100644 index 65ea8f8..0000000 --- a/terraform/examples/only_daos_client/README.md +++ /dev/null @@ -1,154 +0,0 @@ -# DAOS Client Example - -This example Terraform configuration demonstrates how to use the [DAOS Client Terraform Module](../../modules/daos_client) in your own Terraform code to deploy a group of DAOS clients. - -## Setup - -The following steps must be performed prior to deploying DAOS clients. - -1. Set defaults for Google Cloud CLI (```gcloud```) -2. Create a Packer image in your GCP project -3. Build DAOS client images - -If you have not completed these steps yet, click the button below to open an interactive walkthrough in [Cloud Shell](https://cloud.google.com/shell). After completing the walkthrough your GCP project will contain the images required to run this Terraform example. - -[![DAOS on GCP Setup](http://gstatic.com/cloudssh/images/open-btn.png)](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/daos-stack/google-cloud-daos&cloudshell_git_branch=main&shellonly=true&tutorial=docs/tutorials/daosgcp_setup.md) - -## Terraform Files - -List of Terraform files in this example - -| Filename | Description | -| ----------------------------- | ------------------------------------------------------------------------------- | -| main.tf | Main Terrform configuration file containing resource definitions | -| variables.tf | Variable definitions for variables used in main.tf | -| versions.tf | Provider definitions | -| terraform.tfvars.example | Pre-Configured set of set of variables | - -## Create a terraform.tfvars file - -Before you run `terraform apply` with this example you need to create a `terraform.tfvars` file in the `terraform/examples/only_daos_server` directory. - -The `terraform.tfvars` file will contain the variable values that are used by the `main.tf` configuration file. - -Copy the `terraform.tfvars.example` to `terraform.tfvars` and then modify it to contain your GCP project info. - - -```bash -cp terraform.tfvars.example terraform.tfvars -GCP_PROJECT=$(gcloud config list --format='value(core.project)') -sed -i "s//${GCP_PROJECT}/g" terraform.tfvars -``` - -### Update the client_*_yml variables - -Typically, when using both the `terraform/modules/daos_server` and `terraform/modules/daos_client` modules in the same Terraform configuration the `client_daos_agent_yml` and `client_daos_control_yml` variables would be set using output variables from the `terraform/modules/daos_server` module. - -In this client only example we are assuming that the DAOS server instances already exist and are not deployed in your Terraform configuration. You are only deploying clients in your Terrform configuration. - -Therefore, you will not have the output variables from the `terraform/modules/daos_server` module to pass to the `client_daos_agent_yml` and `client_daos_control_yml` variables. - -In this case [heredocs](https://www.terraform.io/language/expressions/strings#indented-heredocs) are used to set the values `client_*_yml` variables. - -The `client_daos_agent_yml` variable should contain the contents of the `/etc/daos/daos_agent.yml` file on the DAOS client instances. - -The `client_daos_control_yml` variable should contain the contents of the `/etc/daos/daos_control.yml` file on the DAOS client instances. - -See the values of the variables in the `terraform.tfvars.example` file. - -The names of the servers will need to be modified to match the names of the DAOS server instances your clients will communicate with. - -## Deploy DAOS Client Instances - -> **Billing Notification!** -> -> Running this example will incur charges in your project. -> -> To avoid surprises, be sure to monitor your costs associated with running this example. -> -> Don't forget to shut down the DAOS clients with `terraform destroy` when you are finished. - -To deploy the DAOS client instances - -```bash -cd terraform/examples/only_daos_client -terraform init -input=false -terraform plan -out=tfplan -input=false -terraform apply -input=false tfplan -``` - -## Remove DAOS client deployment - -To destroy the DAOS client instances run - -```bash -terraform destroy -``` - - -Copyright 2022 Intel Corporation - -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. - -## Requirements - -| Name | Version | -|------|---------| -| [terraform](#requirement\_terraform) | >= 0.14.5 | -| [google](#requirement\_google) | >= 3.54.0 | - -## Providers - -No providers. - -## Modules - -| Name | Source | Version | -|------|--------|---------| -| [daos\_client](#module\_daos\_client) | ../../modules/daos_client | n/a | - -## Resources - -No resources. - -## Inputs - -| Name | Description | Type | Default | Required | -|------|-------------|------|---------|:--------:| -| [allow\_insecure](#input\_allow\_insecure) | Sets the allow\_insecure setting in the transport\_config section of the daos\_*.yml files | `bool` | `false` | no | -| [certs\_install\_script\_content](#input\_certs\_install\_script\_content) | Content of script that installs DAOS certificates | `string` | n/a | yes | -| [client\_daos\_agent\_yml](#input\_client\_daos\_agent\_yml) | YAML to configure the daos agent. | `string` | n/a | yes | -| [client\_daos\_control\_yml](#input\_client\_daos\_control\_yml) | YAML configuring DAOS control. | `string` | n/a | yes | -| [client\_instance\_base\_name](#input\_client\_instance\_base\_name) | MIG instance base names to use | `string` | `"daos-client"` | no | -| [client\_labels](#input\_client\_labels) | Set of key/value label pairs to assign to daos-client instances | `any` | `{}` | no | -| [client\_machine\_type](#input\_client\_machine\_type) | GCP machine type. ie. c2-standard-16 | `string` | `"c2-standard-16"` | no | -| [client\_mig\_name](#input\_client\_mig\_name) | MIG name | `string` | `"daos-client"` | no | -| [client\_number\_of\_instances](#input\_client\_number\_of\_instances) | Number of daos clients to bring up | `number` | `4` | no | -| [client\_os\_disk\_size\_gb](#input\_client\_os\_disk\_size\_gb) | OS disk size in GB | `number` | `20` | no | -| [client\_os\_disk\_type](#input\_client\_os\_disk\_type) | OS disk type ie. pd-ssd, pd-standard | `string` | `"pd-ssd"` | no | -| [client\_os\_family](#input\_client\_os\_family) | OS GCP image family | `string` | `"daos-client-hpc-centos-7"` | no | -| [client\_os\_project](#input\_client\_os\_project) | OS GCP image project name. Defaults to project\_id if null. | `string` | `null` | no | -| [client\_preemptible](#input\_client\_preemptible) | If preemptible instances | `string` | `false` | no | -| [client\_service\_account](#input\_client\_service\_account) | Service account to attach to the instance. See https://www.terraform.io/docs/providers/google/r/compute_instance_template.html#service_account. |
object({
email = string,
scopes = set(string)
})
|
{
"email": null,
"scopes": [
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/logging.write",
"https://www.googleapis.com/auth/monitoring.write",
"https://www.googleapis.com/auth/servicecontrol",
"https://www.googleapis.com/auth/service.management.readonly",
"https://www.googleapis.com/auth/trace.append"
]
}
| no | -| [client\_template\_name](#input\_client\_template\_name) | MIG template name | `string` | `"daos-client"` | no | -| [network\_name](#input\_network\_name) | Name of the GCP network to use | `string` | `"default"` | no | -| [project\_id](#input\_project\_id) | The GCP project to use | `string` | n/a | yes | -| [region](#input\_region) | The GCP region to create and test resources in | `string` | n/a | yes | -| [subnetwork\_name](#input\_subnetwork\_name) | Name of the GCP sub-network to use | `string` | `"default"` | no | -| [subnetwork\_project](#input\_subnetwork\_project) | The GCP project where the subnetwork is defined | `string` | `null` | no | -| [zone](#input\_zone) | The GCP zone to create and test resources in | `string` | n/a | yes | - -## Outputs - -No outputs. - diff --git a/terraform/examples/only_daos_client/main.tf b/terraform/examples/only_daos_client/main.tf deleted file mode 100644 index 63ca3c6..0000000 --- a/terraform/examples/only_daos_client/main.tf +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright 2022 Intel Corporation - * - * 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. - */ - -provider "google" { - region = var.region -} - -module "daos_client" { - source = "../../modules/daos_client" - project_id = var.project_id - region = var.region - zone = var.zone - network_name = var.network_name - subnetwork_project = var.subnetwork_project - subnetwork_name = var.subnetwork_name - number_of_instances = var.client_number_of_instances - labels = var.client_labels - preemptible = var.client_preemptible - mig_name = var.client_mig_name - template_name = var.client_template_name - instance_base_name = var.client_instance_base_name - machine_type = var.client_machine_type - os_family = var.client_os_family - os_project = var.client_os_project - os_disk_type = var.client_os_disk_type - os_disk_size_gb = var.client_os_disk_size_gb - service_account = var.client_service_account - daos_agent_yml = var.client_daos_agent_yml - daos_control_yml = var.client_daos_control_yml - allow_insecure = var.allow_insecure - certs_install_script_content = var.certs_install_script_content -} diff --git a/terraform/examples/only_daos_client/module.json b/terraform/examples/only_daos_client/module.json deleted file mode 100644 index 0e61407..0000000 --- a/terraform/examples/only_daos_client/module.json +++ /dev/null @@ -1,191 +0,0 @@ -{ - "header": "Copyright 2022 Intel Corporation\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.", - "footer": "", - "inputs": [ - { - "name": "allow_insecure", - "type": "bool", - "description": "Sets the allow_insecure setting in the transport_config section of the daos_*.yml files", - "default": false, - "required": false - }, - { - "name": "certs_install_script_content", - "type": "string", - "description": "Content of script that installs DAOS certificates", - "default": null, - "required": true - }, - { - "name": "client_daos_agent_yml", - "type": "string", - "description": "YAML to configure the daos agent.", - "default": null, - "required": true - }, - { - "name": "client_daos_control_yml", - "type": "string", - "description": "YAML configuring DAOS control.", - "default": null, - "required": true - }, - { - "name": "client_instance_base_name", - "type": "string", - "description": "MIG instance base names to use", - "default": "daos-client", - "required": false - }, - { - "name": "client_labels", - "type": "any", - "description": "Set of key/value label pairs to assign to daos-client instances", - "default": {}, - "required": false - }, - { - "name": "client_machine_type", - "type": "string", - "description": "GCP machine type. ie. c2-standard-16", - "default": "c2-standard-16", - "required": false - }, - { - "name": "client_mig_name", - "type": "string", - "description": "MIG name ", - "default": "daos-client", - "required": false - }, - { - "name": "client_number_of_instances", - "type": "number", - "description": "Number of daos clients to bring up", - "default": 4, - "required": false - }, - { - "name": "client_os_disk_size_gb", - "type": "number", - "description": "OS disk size in GB", - "default": 20, - "required": false - }, - { - "name": "client_os_disk_type", - "type": "string", - "description": "OS disk type ie. pd-ssd, pd-standard", - "default": "pd-ssd", - "required": false - }, - { - "name": "client_os_family", - "type": "string", - "description": "OS GCP image family", - "default": "daos-client-hpc-centos-7", - "required": false - }, - { - "name": "client_os_project", - "type": "string", - "description": "OS GCP image project name. Defaults to project_id if null.", - "default": null, - "required": false - }, - { - "name": "client_preemptible", - "type": "string", - "description": "If preemptible instances", - "default": false, - "required": false - }, - { - "name": "client_service_account", - "type": "object({\n email = string,\n scopes = set(string)\n })", - "description": "Service account to attach to the instance. See https://www.terraform.io/docs/providers/google/r/compute_instance_template.html#service_account.", - "default": { - "email": null, - "scopes": [ - "https://www.googleapis.com/auth/devstorage.read_only", - "https://www.googleapis.com/auth/logging.write", - "https://www.googleapis.com/auth/monitoring.write", - "https://www.googleapis.com/auth/servicecontrol", - "https://www.googleapis.com/auth/service.management.readonly", - "https://www.googleapis.com/auth/trace.append" - ] - }, - "required": false - }, - { - "name": "client_template_name", - "type": "string", - "description": "MIG template name", - "default": "daos-client", - "required": false - }, - { - "name": "network_name", - "type": "string", - "description": "Name of the GCP network to use", - "default": "default", - "required": false - }, - { - "name": "project_id", - "type": "string", - "description": "The GCP project to use ", - "default": null, - "required": true - }, - { - "name": "region", - "type": "string", - "description": "The GCP region to create and test resources in", - "default": null, - "required": true - }, - { - "name": "subnetwork_name", - "type": "string", - "description": "Name of the GCP sub-network to use", - "default": "default", - "required": false - }, - { - "name": "subnetwork_project", - "type": "string", - "description": "The GCP project where the subnetwork is defined", - "default": null, - "required": false - }, - { - "name": "zone", - "type": "string", - "description": "The GCP zone to create and test resources in", - "default": null, - "required": true - } - ], - "modules": [ - { - "name": "daos_client", - "source": "../../modules/daos_client", - "version": "", - "description": null - } - ], - "outputs": [], - "providers": [], - "requirements": [ - { - "name": "terraform", - "version": "\u003e= 0.14.5" - }, - { - "name": "google", - "version": "\u003e= 3.54.0" - } - ], - "resources": [] -} diff --git a/terraform/examples/only_daos_client/terraform.tfvars.example b/terraform/examples/only_daos_client/terraform.tfvars.example deleted file mode 100644 index eb51ffc..0000000 --- a/terraform/examples/only_daos_client/terraform.tfvars.example +++ /dev/null @@ -1,198 +0,0 @@ -project_id = "" -region = "us-central1" -zone = "us-central1-f" -# network_name = "default" -# subnetwork_name = "default" -# subnetwork_project = "" - -client_labels = { - example = "only_daos_client" -} - -# client_number_of_instances = 4 -# client_preemptible = "false" -# client_mig_name = "daos-client" -# client_template_name = "daos-client" -# client_instance_base_name = "daos-client" -# client_machine_type = "c2-standard-16" -# client_os_family = "daos-client-hpc-centos-7" -# client_os_project = "" -# client_os_disk_type = "pd-ssd" -# client_os_disk_size_gb = 20 - -client_daos_agent_yml = < "/var/daos/daosCA.tar.gz" - - if [[ ! -f "/var/daos/daosCA.tar.gz" ]]; then - echo "ERROR: File not found '/var/daos/daosCA.tar.gz'" - exit 1 - fi - - echo "Extracting /var/daos/daosCA.tar.gz" - tar xzf "/var/daos/daosCA.tar.gz" -C "/var/daos/" - rm -f "/var/daos/daosCA.tar.gz" - - # Check to make sure the directory was created before continuing - if [[ ! -d "/var/daos/daosCA" ]]; then - echo "ERROR: Directory '/var/daos/daosCA' not found. Exiting ..." - exit 1 - fi -} - -echo "BEGIN: ${SCRIPT_NAME}" - -cd "/var/daos" - -# Only get the /var/daos/daosCA from Secret Manager -# when the /var/daos/daosCA directory doesn't exist. -# On the first DAOS server instance /var/daos/daosCA will exist because that -# is where the certs were generated. No need to get the daosCA.tar.gz file -# from the secret in that case. -if [[ ! -d "/var/daos/daosCA" ]]; then - get_ca_from_sm -fi - -# Cleanup any old certs that may exist. -rm -rf /etc/daos/certs -mkdir -p /etc/daos/certs - -echo "Copying certs and setting permissions on ${INSTALL_TYPE,,} instance" - -# CLIENT CERTS -if [[ "${INSTALL_TYPE,,}" == "client" ]]; then - cp /var/daos/daosCA/certs/daosCA.crt /etc/daos/certs/ - cp /var/daos/daosCA/certs/agent.* /etc/daos/certs/ - chown -R daos_agent:daos_agent /etc/daos/certs - chmod 0755 /etc/daos/certs - chmod 0644 /etc/daos/certs/*.crt - chmod 0600 /etc/daos/certs/*.key -fi - -# SERVER CERTS -if [[ "${INSTALL_TYPE,,}" == "server" ]]; then - # On GCP daos_server runs as root because instances don't have IOMMU - # So server certs and keys should be owned by root - cp /var/daos/daosCA/certs/daosCA.crt /etc/daos/certs/ - cp /var/daos/daosCA/certs/server.* /etc/daos/certs/ - - # Server needs a copy of the agent.crt in /etc/daos/certs/clients - mkdir -p /etc/daos/certs/clients - cp "/var/daos/daosCA/certs/agent.crt" /etc/daos/certs/clients - - chown -R root:root /etc/daos/certs - chmod 0755 /etc/daos/certs - chmod 0755 /etc/daos/certs/clients - - # Since the daos_agent is also running on the server instances the - # agent certs must exist in /etc/daos/certs/ and be owned by the daos_agent - # user - cp /var/daos/daosCA/certs/agent.* /etc/daos/certs/ - chown daos_agent:daos_agent /etc/daos/certs/agent.* - - chmod 0644 /etc/daos/certs/*.crt - chmod 0600 /etc/daos/certs/*.key - chmod 0644 /etc/daos/certs/clients/* - -fi - -# -# ADMIN CERTS ON CLIENTS AND SERVERS -# - -# As of 2022-05-05 dmg requires mode 0700 admin.key -# Odd that its not 0600 -# dmg must run as root -cp /var/daos/daosCA/certs/admin.* /etc/daos/certs/ - -chown root:root /etc/daos/certs/admin.* -chmod 0644 /etc/daos/certs/admin.crt -chmod 0700 /etc/daos/certs/admin.key - -# Remove the CA dir now that the certs have been copied to /etc/daos/certs -if [[ -d "/var/daos/daosCA" ]]; then - rm -rf "/var/daos/daosCA" -fi - -echo "END: ${SCRIPT_NAME}" - -EOT diff --git a/terraform/examples/only_daos_client/variables.tf b/terraform/examples/only_daos_client/variables.tf deleted file mode 100644 index c4e197f..0000000 --- a/terraform/examples/only_daos_client/variables.tf +++ /dev/null @@ -1,151 +0,0 @@ -/** - * Copyright 2019 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. - */ -variable "project_id" { - description = "The GCP project to use " - type = string -} - -variable "region" { - description = "The GCP region to create and test resources in" - type = string -} - -variable "zone" { - description = "The GCP zone to create and test resources in" - type = string -} - -variable "network_name" { - description = "Name of the GCP network to use" - default = "default" - type = string -} - -variable "subnetwork_name" { - description = "Name of the GCP sub-network to use" - default = "default" - type = string -} - -variable "subnetwork_project" { - description = "The GCP project where the subnetwork is defined" - type = string - default = null -} - -variable "allow_insecure" { - description = "Sets the allow_insecure setting in the transport_config section of the daos_*.yml files" - default = false - type = bool -} - -variable "client_labels" { - description = "Set of key/value label pairs to assign to daos-client instances" - type = any - default = {} -} - -variable "client_os_family" { - description = "OS GCP image family" - default = "daos-client-hpc-centos-7" - type = string -} - -variable "client_os_project" { - description = "OS GCP image project name. Defaults to project_id if null." - default = null - type = string -} - -variable "client_os_disk_size_gb" { - description = "OS disk size in GB" - default = 20 - type = number -} - -variable "client_os_disk_type" { - description = "OS disk type ie. pd-ssd, pd-standard" - default = "pd-ssd" - type = string -} - -variable "client_template_name" { - description = "MIG template name" - default = "daos-client" - type = string -} - -variable "client_mig_name" { - description = "MIG name " - default = "daos-client" - type = string -} - -variable "client_machine_type" { - description = "GCP machine type. ie. c2-standard-16" - default = "c2-standard-16" - type = string -} - -variable "client_instance_base_name" { - description = "MIG instance base names to use" - default = "daos-client" - type = string -} - -variable "client_number_of_instances" { - description = "Number of daos clients to bring up" - default = 4 - type = number -} - -variable "client_service_account" { - description = "Service account to attach to the instance. See https://www.terraform.io/docs/providers/google/r/compute_instance_template.html#service_account." - type = object({ - email = string, - scopes = set(string) - }) - default = { - email = null - scopes = ["https://www.googleapis.com/auth/devstorage.read_only", - "https://www.googleapis.com/auth/logging.write", - "https://www.googleapis.com/auth/monitoring.write", - "https://www.googleapis.com/auth/servicecontrol", - "https://www.googleapis.com/auth/service.management.readonly", - "https://www.googleapis.com/auth/trace.append"] - } -} - -variable "client_preemptible" { - description = "If preemptible instances" - default = false - type = string -} - -variable "client_daos_agent_yml" { - description = "YAML to configure the daos agent." - type = string -} - -variable "client_daos_control_yml" { - description = "YAML configuring DAOS control." - type = string -} - -variable "certs_install_script_content" { - description = "Content of script that installs DAOS certificates" - type = string -} diff --git a/terraform/examples/only_daos_client/versions.tf b/terraform/examples/only_daos_client/versions.tf deleted file mode 100644 index 61dd781..0000000 --- a/terraform/examples/only_daos_client/versions.tf +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright 2022 Intel Corporation - * - * 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. - */ - -terraform { - required_version = ">= 0.14.5" - required_providers { - google = ">= 3.54.0" - } -} diff --git a/terraform/examples/only_daos_server/README.md b/terraform/examples/only_daos_server/README.md deleted file mode 100644 index 18c40ed..0000000 --- a/terraform/examples/only_daos_server/README.md +++ /dev/null @@ -1,171 +0,0 @@ -# DAOS Server Example - -This example Terraform configuration demonstrates how to use the [DAOS Server Terraform Module](../../modules/daos_server) in your own Terraform code to deploy a group of DAOS servers. - -## Setup - -The following steps must be performed prior to deploying DAOS servers. - -1. Set defaults for Google Cloud CLI (```gcloud```) -2. Create a Packer image in your GCP project -3. Build DAOS server images - -If you have not completed these steps yet, click the button below to open an interactive walkthrough in [Cloud Shell](https://cloud.google.com/shell). After completing the walkthrough your GCP project will contain the images required to run this Terraform example. - -[![DAOS on GCP Setup](http://gstatic.com/cloudssh/images/open-btn.png)](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/daos-stack/google-cloud-daos&cloudshell_git_branch=main&shellonly=true&tutorial=docs/tutorials/daosgcp_setup.md) - -## Terraform Files - -List of Terraform files in this example - -| Filename | Description | -| ----------------------------- | ------------------------------------------------------------------------------- | -| main.tf | Main Terrform configuration file containing resource definitions | -| variables.tf | Variable definitions for variables used in main.tf | -| versions.tf | Provider definitions | -| terraform.tfvars.perf.example | Pre-Configured set of set of variables focused on performance | -| terraform.tfvars.tco.example | Pre-Configured set of set of variables focused on lower total cost of ownership | - -## Create a terraform.tfvars file - -Before you run `terraform apply` with this example you need to create a `terraform.tfvars` file in the `terraform/examples/only_daos_server` directory. - -The `terraform.tfvars` file will contain the variable values that are used by the `main.tf` configuration file. - -To ensure a successful deployment of a DAOS cluster there are two `terraform.tfvars.*.example` files that you can choose from. - -You will need to decide which of these files you will copy to `terraform.tfvars` and then modify to contain your GCP project info. - - -### The terraform.tfvars.tco.example file - -The `terraform.tfvars.tco.example` configuration will result in a smaller cluster deployment that is more affordable to operate due to fewer instances. - -This is a good choice if you just want to deploy a DAOS cluster to learn how to use DAOS. - -To use the `terraform.tfvars.tco.example` file run - -```bash -cp terraform.tfvars.tco.example terraform.tfvars -``` - -### The terraform.tfvars.perf.example file - -The `terraform.tfvars.perf.example` configuration will result in a larger cluster deployment that costs more to operate but will have better performance due to more instances being deployed. - -To use the ```terraform.tfvars.perf.example``` file run - -```bash -cp terraform.tfvars.tco.example terraform.tfvars -``` - -### Update `terraform.tfvars` with your project id - -Now that you have a `terraform.tfvars` file you need to replace the `` placeholder in the file with your project id. - -To update the project id in `terraform.tfvars` run - -```bash -PROJECT_ID=$(gcloud config list --format 'value(core.project)') -sed -i "s//${PROJECT_ID}/g" terraform.tfvars -``` - -## Deploy DAOS Server Instances - -> **Billing Notification!** -> -> Running this example will incur charges in your project. -> -> To avoid surprises, be sure to monitor your costs associated with running this example. -> -> Don't forget to shut down the DAOS servers with `terraform destroy` when you are finished. - -To deploy the DAOS server instances - -```bash -cd terraform/examples/only_daos_server -terraform init -input=false -terraform plan -out=tfplan -input=false -terraform apply -input=false tfplan -``` - -## Remove DAOS server deployment - -To destroy the DAOS server instances run - -```bash -terraform destroy -``` - -# Terraform Documentation for this Example - - -Copyright 2022 Intel Corporation - -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. - -## Requirements - -| Name | Version | -|------|---------| -| [terraform](#requirement\_terraform) | >= 0.14.5 | -| [google](#requirement\_google) | >= 3.54.0 | - -## Providers - -No providers. - -## Modules - -| Name | Source | Version | -|------|--------|---------| -| [daos\_server](#module\_daos\_server) | ../../modules/daos_server | n/a | - -## Resources - -No resources. - -## Inputs - -| Name | Description | Type | Default | Required | -|------|-------------|------|---------|:--------:| -| [allow\_insecure](#input\_allow\_insecure) | Sets the allow\_insecure setting in the transport\_config section of the daos\_*.yml files | `bool` | `false` | no | -| [network\_name](#input\_network\_name) | Name of the GCP network to use | `string` | `"default"` | no | -| [project\_id](#input\_project\_id) | The GCP project to use | `string` | n/a | yes | -| [region](#input\_region) | The GCP region to create and test resources in | `string` | n/a | yes | -| [server\_daos\_crt\_timeout](#input\_server\_daos\_crt\_timeout) | crt\_timeout | `number` | `300` | no | -| [server\_daos\_disk\_count](#input\_server\_daos\_disk\_count) | Number of local ssd's to use | `number` | `16` | no | -| [server\_daos\_disk\_type](#input\_server\_daos\_disk\_type) | Daos disk type to use. For now only suported one is local-ssd | `string` | `"local-ssd"` | no | -| [server\_daos\_scm\_size](#input\_server\_daos\_scm\_size) | scm\_size | `number` | `200` | no | -| [server\_gvnic](#input\_server\_gvnic) | Use Google Virtual NIC (gVNIC) network interface on DAOS clients | `bool` | `false` | no | -| [server\_instance\_base\_name](#input\_server\_instance\_base\_name) | MIG instance base names to use | `string` | `"daos-server"` | no | -| [server\_labels](#input\_server\_labels) | Set of key/value label pairs to assign to daos-server instances | `any` | `{}` | no | -| [server\_machine\_type](#input\_server\_machine\_type) | GCP machine type. ie. e2-medium | `string` | `"n2-custom-36-215040"` | no | -| [server\_mig\_name](#input\_server\_mig\_name) | MIG name | `string` | `"daos-server"` | no | -| [server\_number\_of\_instances](#input\_server\_number\_of\_instances) | Number of daos servers to bring up | `number` | `4` | no | -| [server\_os\_disk\_size\_gb](#input\_server\_os\_disk\_size\_gb) | OS disk size in GB | `number` | `20` | no | -| [server\_os\_disk\_type](#input\_server\_os\_disk\_type) | OS disk type ie. pd-ssd, pd-standard | `string` | `"pd-ssd"` | no | -| [server\_os\_family](#input\_server\_os\_family) | OS GCP image family | `string` | `"daos-server-centos-7"` | no | -| [server\_os\_project](#input\_server\_os\_project) | OS GCP image project name. Defaults to project\_id if null. | `string` | `null` | no | -| [server\_pools](#input\_server\_pools) | List of pools and containers to be created |
list(object({
name = string
size = string
tier_ratio = number
acls = list(string)
properties = map(string)
containers = list(object({
name = string
type = string
acls = list(string)
properties = map(string)
user_attributes = map(any)
}))
}))
| `[]` | no | -| [server\_preemptible](#input\_server\_preemptible) | If preemptible instances | `string` | `false` | no | -| [server\_service\_account](#input\_server\_service\_account) | Service account to attach to the instance. See https://www.terraform.io/docs/providers/google/r/compute_instance_template.html#service_account. |
object({
email = string,
scopes = set(string)
})
|
{
"email": null,
"scopes": [
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/logging.write",
"https://www.googleapis.com/auth/monitoring.write",
"https://www.googleapis.com/auth/servicecontrol",
"https://www.googleapis.com/auth/service.management.readonly",
"https://www.googleapis.com/auth/trace.append",
"https://www.googleapis.com/auth/cloud-platform"
]
}
| no | -| [server\_template\_name](#input\_server\_template\_name) | MIG template name | `string` | `"daos-server"` | no | -| [subnetwork\_name](#input\_subnetwork\_name) | Name of the GCP sub-network to use | `string` | `"default"` | no | -| [subnetwork\_project](#input\_subnetwork\_project) | The GCP project where the subnetwork is defined | `string` | `null` | no | -| [zone](#input\_zone) | The GCP zone to create and test resources in | `string` | n/a | yes | - -## Outputs - -No outputs. - diff --git a/terraform/examples/only_daos_server/main.tf b/terraform/examples/only_daos_server/main.tf deleted file mode 100644 index 50cc8b9..0000000 --- a/terraform/examples/only_daos_server/main.tf +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright 2022 Intel Corporation - * - * 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. - */ - -provider "google" { - region = var.region -} - -module "daos_server" { - source = "../../modules/daos_server" - project_id = var.project_id - region = var.region - zone = var.zone - network_name = var.network_name - subnetwork_project = var.subnetwork_project - subnetwork_name = var.subnetwork_name - number_of_instances = var.server_number_of_instances - labels = var.server_labels - preemptible = var.server_preemptible - mig_name = var.server_mig_name - template_name = var.server_template_name - instance_base_name = var.server_instance_base_name - machine_type = var.server_machine_type - os_family = var.server_os_family - os_project = var.server_os_project - os_disk_type = var.server_os_disk_type - os_disk_size_gb = var.server_os_disk_size_gb - daos_disk_count = var.server_daos_disk_count - daos_disk_type = var.server_daos_disk_type - daos_crt_timeout = var.server_daos_crt_timeout - daos_scm_size = var.server_daos_scm_size - service_account = var.server_service_account - pools = var.server_pools - gvnic = var.server_gvnic - allow_insecure = var.allow_insecure -} diff --git a/terraform/examples/only_daos_server/module.json b/terraform/examples/only_daos_server/module.json deleted file mode 100644 index e06163d..0000000 --- a/terraform/examples/only_daos_server/module.json +++ /dev/null @@ -1,213 +0,0 @@ -{ - "header": "Copyright 2022 Intel Corporation\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.", - "footer": "", - "inputs": [ - { - "name": "allow_insecure", - "type": "bool", - "description": "Sets the allow_insecure setting in the transport_config section of the daos_*.yml files", - "default": false, - "required": false - }, - { - "name": "network_name", - "type": "string", - "description": "Name of the GCP network to use", - "default": "default", - "required": false - }, - { - "name": "project_id", - "type": "string", - "description": "The GCP project to use ", - "default": null, - "required": true - }, - { - "name": "region", - "type": "string", - "description": "The GCP region to create and test resources in", - "default": null, - "required": true - }, - { - "name": "server_daos_crt_timeout", - "type": "number", - "description": "crt_timeout", - "default": 300, - "required": false - }, - { - "name": "server_daos_disk_count", - "type": "number", - "description": "Number of local ssd's to use", - "default": 16, - "required": false - }, - { - "name": "server_daos_disk_type", - "type": "string", - "description": "Daos disk type to use. For now only suported one is local-ssd", - "default": "local-ssd", - "required": false - }, - { - "name": "server_daos_scm_size", - "type": "number", - "description": "scm_size", - "default": 200, - "required": false - }, - { - "name": "server_gvnic", - "type": "bool", - "description": "Use Google Virtual NIC (gVNIC) network interface on DAOS clients", - "default": false, - "required": false - }, - { - "name": "server_instance_base_name", - "type": "string", - "description": "MIG instance base names to use", - "default": "daos-server", - "required": false - }, - { - "name": "server_labels", - "type": "any", - "description": "Set of key/value label pairs to assign to daos-server instances", - "default": {}, - "required": false - }, - { - "name": "server_machine_type", - "type": "string", - "description": "GCP machine type. ie. e2-medium", - "default": "n2-custom-36-215040", - "required": false - }, - { - "name": "server_mig_name", - "type": "string", - "description": "MIG name ", - "default": "daos-server", - "required": false - }, - { - "name": "server_number_of_instances", - "type": "number", - "description": "Number of daos servers to bring up", - "default": 4, - "required": false - }, - { - "name": "server_os_disk_size_gb", - "type": "number", - "description": "OS disk size in GB", - "default": 20, - "required": false - }, - { - "name": "server_os_disk_type", - "type": "string", - "description": "OS disk type ie. pd-ssd, pd-standard", - "default": "pd-ssd", - "required": false - }, - { - "name": "server_os_family", - "type": "string", - "description": "OS GCP image family", - "default": "daos-server-centos-7", - "required": false - }, - { - "name": "server_os_project", - "type": "string", - "description": "OS GCP image project name. Defaults to project_id if null.", - "default": null, - "required": false - }, - { - "name": "server_pools", - "type": "list(object({\n name = string\n size = string\n tier_ratio = number\n acls = list(string)\n properties = map(string)\n containers = list(object({\n name = string\n type = string\n acls = list(string)\n properties = map(string)\n user_attributes = map(any)\n }))\n }))", - "description": "List of pools and containers to be created", - "default": [], - "required": false - }, - { - "name": "server_preemptible", - "type": "string", - "description": "If preemptible instances", - "default": false, - "required": false - }, - { - "name": "server_service_account", - "type": "object({\n email = string,\n scopes = set(string)\n })", - "description": "Service account to attach to the instance. See https://www.terraform.io/docs/providers/google/r/compute_instance_template.html#service_account.", - "default": { - "email": null, - "scopes": [ - "https://www.googleapis.com/auth/devstorage.read_only", - "https://www.googleapis.com/auth/logging.write", - "https://www.googleapis.com/auth/monitoring.write", - "https://www.googleapis.com/auth/servicecontrol", - "https://www.googleapis.com/auth/service.management.readonly", - "https://www.googleapis.com/auth/trace.append", - "https://www.googleapis.com/auth/cloud-platform" - ] - }, - "required": false - }, - { - "name": "server_template_name", - "type": "string", - "description": "MIG template name", - "default": "daos-server", - "required": false - }, - { - "name": "subnetwork_name", - "type": "string", - "description": "Name of the GCP sub-network to use", - "default": "default", - "required": false - }, - { - "name": "subnetwork_project", - "type": "string", - "description": "The GCP project where the subnetwork is defined", - "default": null, - "required": false - }, - { - "name": "zone", - "type": "string", - "description": "The GCP zone to create and test resources in", - "default": null, - "required": true - } - ], - "modules": [ - { - "name": "daos_server", - "source": "../../modules/daos_server", - "version": "", - "description": null - } - ], - "outputs": [], - "providers": [], - "requirements": [ - { - "name": "terraform", - "version": "\u003e= 0.14.5" - }, - { - "name": "google", - "version": "\u003e= 3.54.0" - } - ], - "resources": [] -} diff --git a/terraform/examples/only_daos_server/terraform.tfvars.perf.example b/terraform/examples/only_daos_server/terraform.tfvars.perf.example deleted file mode 100644 index 340cedb..0000000 --- a/terraform/examples/only_daos_server/terraform.tfvars.perf.example +++ /dev/null @@ -1,58 +0,0 @@ -project_id = "" -region = "us-central1" -zone = "us-central1-f" - -server_machine_type = "n2-standard-16" -server_os_disk_size_gb = 20 -server_daos_disk_count = 4 -server_daos_crt_timeout = 300 -server_daos_scm_size = 45 - -# network_name = "default" -# subnetwork_name = "default" -# subnetwork_project = "" -# server_number_of_instances = 4 -server_labels = { - example = "only_daos_server" -} -# server_preemptible = "false" -# server_mig_name = "daos-server" -# server_template_name = "daos-server" -# server_instance_base_name = "daos-server" - -# server_os_family = "daos-server-centos-7" -# server_os_project = "" -# server_os_disk_type = "pd-ssd" - -# server_pools = [ -# { -# name = "pool1", -# size = "1TB", -# tier_ratio = 6 -# acls = [ -# "A::OWNER@:rwdtTaAo", -# "A:G:GROUP@:rwtT", -# "A::EVERYONE@:r", -# ], -# properties = { -# reclaim = "lazy" -# }, -# containers = [ -# { -# name = "container1", -# type = "POSIX", -# acls = [ -# "A::OWNER@:rwdtTaAo", -# "A:G:GROUP@:rwtT", -# "A::EVERYONE@:rwtT" -# ], -# properties = { -# rf = 0 -# }, -# user_attributes = { -# automount = true -# } -# } -# ] -# } -# ] diff --git a/terraform/examples/only_daos_server/terraform.tfvars.tco.example b/terraform/examples/only_daos_server/terraform.tfvars.tco.example deleted file mode 100644 index 23f9907..0000000 --- a/terraform/examples/only_daos_server/terraform.tfvars.tco.example +++ /dev/null @@ -1,58 +0,0 @@ -project_id = "" -region = "us-central1" -zone = "us-central1-f" - -server_machine_type = "n2-custom-36-215040" -server_os_disk_size_gb = 20 -server_daos_disk_count = 16 -server_daos_crt_timeout = 300 -server_daos_scm_size = 180 - -# network_name = "default" -# subnetwork_name = "default" -# subnetwork_project = "" -server_number_of_instances = 4 -server_labels = { - example = "only_daos_server" -} -# server_preemptible = "false" -# server_mig_name = "daos-server" -# server_template_name = "daos-server" -# server_instance_base_name = "daos-server" - -# server_os_family = "daos-server-centos-7" -# server_os_project = "" -# server_os_disk_type = "pd-ssd" - -# server_pools = [ -# { -# name = "pool1", -# size = "1TB", -# tier_ratio = 6 -# acls = [ -# "A::OWNER@:rwdtTaAo", -# "A:G:GROUP@:rwtT", -# "A::EVERYONE@:r", -# ], -# properties = { -# reclaim = "lazy" -# }, -# containers = [ -# { -# name = "container1", -# type = "POSIX", -# acls = [ -# "A::OWNER@:rwdtTaAo", -# "A:G:GROUP@:rwtT", -# "A::EVERYONE@:rwtT" -# ], -# properties = { -# rf = 0 -# }, -# user_attributes = { -# automount = true -# } -# } -# ] -# } -# ] diff --git a/terraform/examples/only_daos_server/variables.tf b/terraform/examples/only_daos_server/variables.tf deleted file mode 100644 index d05eaf1..0000000 --- a/terraform/examples/only_daos_server/variables.tf +++ /dev/null @@ -1,189 +0,0 @@ -/** - * Copyright 2022 Intel Corporation - * - * 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. - */ - -variable "project_id" { - description = "The GCP project to use " - type = string -} - -variable "region" { - description = "The GCP region to create and test resources in" - type = string -} - -variable "zone" { - description = "The GCP zone to create and test resources in" - type = string -} - -variable "network_name" { - description = "Name of the GCP network to use" - default = "default" - type = string -} - -variable "subnetwork_name" { - description = "Name of the GCP sub-network to use" - default = "default" - type = string -} - -variable "subnetwork_project" { - description = "The GCP project where the subnetwork is defined" - type = string - default = null -} - -variable "allow_insecure" { - description = "Sets the allow_insecure setting in the transport_config section of the daos_*.yml files" - default = false - type = bool -} - -variable "server_labels" { - description = "Set of key/value label pairs to assign to daos-server instances" - type = any - default = {} -} - -variable "server_os_family" { - description = "OS GCP image family" - type = string - default = "daos-server-centos-7" -} - -variable "server_os_project" { - description = "OS GCP image project name. Defaults to project_id if null." - default = null - type = string -} - -variable "server_os_disk_size_gb" { - description = "OS disk size in GB" - default = 20 - type = number -} - -variable "server_os_disk_type" { - description = "OS disk type ie. pd-ssd, pd-standard" - default = "pd-ssd" - type = string -} - -variable "server_template_name" { - description = "MIG template name" - default = "daos-server" - type = string -} - -variable "server_mig_name" { - description = "MIG name " - default = "daos-server" - type = string -} - -variable "server_machine_type" { - description = "GCP machine type. ie. e2-medium" - default = "n2-custom-36-215040" - type = string -} - -variable "server_instance_base_name" { - description = "MIG instance base names to use" - default = "daos-server" - type = string -} - -variable "server_number_of_instances" { - description = "Number of daos servers to bring up" - default = 4 - type = number -} - -variable "server_daos_disk_type" { - #TODO: At some point we will support more than local-ssd with NVME - # interface. This variable will be useful then. For now its just this. - description = "Daos disk type to use. For now only suported one is local-ssd" - default = "local-ssd" - type = string -} - -variable "server_daos_disk_count" { - description = "Number of local ssd's to use" - default = 16 - type = number -} - -variable "server_service_account" { - description = "Service account to attach to the instance. See https://www.terraform.io/docs/providers/google/r/compute_instance_template.html#service_account." - type = object({ - email = string, - scopes = set(string) - }) - default = { - email = null - scopes = ["https://www.googleapis.com/auth/devstorage.read_only", - "https://www.googleapis.com/auth/logging.write", - "https://www.googleapis.com/auth/monitoring.write", - "https://www.googleapis.com/auth/servicecontrol", - "https://www.googleapis.com/auth/service.management.readonly", - "https://www.googleapis.com/auth/trace.append", - "https://www.googleapis.com/auth/cloud-platform"] - } -} - -variable "server_preemptible" { - description = "If preemptible instances" - default = false - type = string -} - -variable "server_pools" { - description = "List of pools and containers to be created" - default = [] - type = list(object({ - name = string - size = string - tier_ratio = number - acls = list(string) - properties = map(any) - containers = list(object({ - name = string - type = string - acls = list(string) - properties = map(any) - user_attributes = map(any) - })) - })) -} - -variable "server_daos_scm_size" { - description = "scm_size" - default = 200 - type = number -} - -variable "server_daos_crt_timeout" { - description = "crt_timeout" - default = 300 - type = number -} - -variable "server_gvnic" { - description = "Use Google Virtual NIC (gVNIC) network interface on DAOS clients" - default = false - type = bool -} diff --git a/terraform/examples/only_daos_server/versions.tf b/terraform/examples/only_daos_server/versions.tf deleted file mode 100644 index 61dd781..0000000 --- a/terraform/examples/only_daos_server/versions.tf +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright 2022 Intel Corporation - * - * 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. - */ - -terraform { - required_version = ">= 0.14.5" - required_providers { - google = ">= 3.54.0" - } -} diff --git a/terraform/modules/daos_client/main.tf b/terraform/modules/daos_client/main.tf index 5828057..837afda 100644 --- a/terraform/modules/daos_client/main.tf +++ b/terraform/modules/daos_client/main.tf @@ -44,6 +44,7 @@ resource "google_compute_instance_template" "daos_sig_template" { project = var.project_id region = var.region labels = var.labels + count = var.number_of_instances > 0 ? 1 : 0 disk { source_image = data.google_compute_image.os_image.self_link @@ -81,9 +82,9 @@ resource "google_compute_instance_template" "daos_sig_template" { resource "google_compute_instance_group_manager" "daos_sig" { description = "Stateful Instance group for DAOS clients" name = var.mig_name - + count = var.number_of_instances > 0 ? 1 : 0 version { - instance_template = google_compute_instance_template.daos_sig_template.self_link + instance_template = google_compute_instance_template.daos_sig_template[1].self_link } base_instance_name = var.instance_base_name @@ -95,7 +96,7 @@ resource "google_compute_instance_group_manager" "daos_sig" { resource "google_compute_per_instance_config" "named_instances" { zone = var.zone project = var.project_id - instance_group_manager = google_compute_instance_group_manager.daos_sig.name + instance_group_manager = google_compute_instance_group_manager.daos_sig[1].name count = var.number_of_instances name = format("%s-%04d", var.instance_base_name, sum([count.index, 1])) preserved_state { @@ -108,7 +109,7 @@ resource "google_compute_per_instance_config" "named_instances" { # Adding a reference to the instance template used causes the stateful instance to update # if the instance template changes. Otherwise there is no explicit dependency and template # changes may not occur on the stateful instance - instance_template = google_compute_instance_template.daos_sig_template.self_link + instance_template = google_compute_instance_template.daos_sig_template[1].self_link } } } From 94e4cd1332e77ee721f85af518ffd4574415ff5c Mon Sep 17 00:00:00 2001 From: Keith Mannthey Date: Fri, 13 May 2022 16:48:39 -0700 Subject: [PATCH 2/2] DAOSGCP-111 cleanup 1 more tested needed to move the index to 0. The current DAOS configs are 3% Signed-off-by: Keith Mannthey --- .../examples/daos_cluster/terraform.tfvars.perf.example | 4 ++-- terraform/modules/daos_client/main.tf | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/terraform/examples/daos_cluster/terraform.tfvars.perf.example b/terraform/examples/daos_cluster/terraform.tfvars.perf.example index 1d1884d..e53657e 100644 --- a/terraform/examples/daos_cluster/terraform.tfvars.perf.example +++ b/terraform/examples/daos_cluster/terraform.tfvars.perf.example @@ -29,14 +29,14 @@ server_daos_scm_size = 45 # { # name = "pool1", # size = "1TB", -# tier_ratio = 6 +# tier_ratio = 3 # acls = [ # "A::OWNER@:rwdtTaAo", # "A:G:GROUP@:rwtT", # "A::EVERYONE@:r", # ], # properties = { -# reclaim = "lazy" +# checksum = "disabled" # }, # containers = [ # { diff --git a/terraform/modules/daos_client/main.tf b/terraform/modules/daos_client/main.tf index 837afda..35f6b6f 100644 --- a/terraform/modules/daos_client/main.tf +++ b/terraform/modules/daos_client/main.tf @@ -84,7 +84,7 @@ resource "google_compute_instance_group_manager" "daos_sig" { name = var.mig_name count = var.number_of_instances > 0 ? 1 : 0 version { - instance_template = google_compute_instance_template.daos_sig_template[1].self_link + instance_template = google_compute_instance_template.daos_sig_template[0].self_link } base_instance_name = var.instance_base_name @@ -96,7 +96,7 @@ resource "google_compute_instance_group_manager" "daos_sig" { resource "google_compute_per_instance_config" "named_instances" { zone = var.zone project = var.project_id - instance_group_manager = google_compute_instance_group_manager.daos_sig[1].name + instance_group_manager = google_compute_instance_group_manager.daos_sig[0].name count = var.number_of_instances name = format("%s-%04d", var.instance_base_name, sum([count.index, 1])) preserved_state { @@ -109,7 +109,7 @@ resource "google_compute_per_instance_config" "named_instances" { # Adding a reference to the instance template used causes the stateful instance to update # if the instance template changes. Otherwise there is no explicit dependency and template # changes may not occur on the stateful instance - instance_template = google_compute_instance_template.daos_sig_template[1].self_link + instance_template = google_compute_instance_template.daos_sig_template[0].self_link } } }