Skip to content

Commit

Permalink
DAOS-9737 Add support for applying labels to instances (#17)
Browse files Browse the repository at this point in the history
Updated modules to allow labels on instances.

Updated examples to show how to add labels.

Signed-off-by: Mark A. Olson <mark.a.olson@intel.com>
  • Loading branch information
markaolson authored Feb 11, 2022
1 parent 21b1f49 commit 5756eec
Show file tree
Hide file tree
Showing 17 changed files with 60 additions and 1 deletion.
1 change: 1 addition & 0 deletions terraform/examples/daos_client_mig/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ No resources.
| <a name="input_instance_base_name"></a> [instance\_base\_name](#input\_instance\_base\_name) | MIG instance base names to use | `string` | `"daos-client"` | no |
| <a name="input_machine_type"></a> [machine\_type](#input\_machine\_type) | GCP machine type. ie. e2-medium | `string` | `"n2-highmem-16"` | no |
| <a name="input_mig_name"></a> [mig\_name](#input\_mig\_name) | MIG name | `string` | `"daos-client"` | no |
| <a name="input_labels"></a> [labels](#input\_labels) | Set of key/value label pairs to assign to daos-client instances | `any` | n/a | no |
| <a name="input_network"></a> [network](#input\_network) | GCP network to use | `string` | n/a | yes |
| <a name="input_number_of_instances"></a> [number\_of\_instances](#input\_number\_of\_instances) | Number of daos clients to bring up | `number` | `2` | no |
| <a name="input_os_disk_size_gb"></a> [os\_disk\_size\_gb](#input\_os\_disk\_size\_gb) | OS disk size in GB | `number` | `20` | no |
Expand Down
1 change: 1 addition & 0 deletions terraform/examples/daos_client_mig/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module "daos_client" {
subnetwork_project = var.subnetwork_project
region = var.region
zone = var.zone
labels = var.labels

number_of_instances = var.number_of_instances

Expand Down
3 changes: 3 additions & 0 deletions terraform/examples/daos_client_mig/terraform.tfvars.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ subnetwork = "<my_VPC_subnetwork>"
subnetwork_project = "<my_project_id>"
region = "europe-west4"
zone = "europe-west4-a"
labels = {
example="daos_client_mig"
}

number_of_instances = 2

Expand Down
6 changes: 6 additions & 0 deletions terraform/examples/daos_client_mig/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ variable "zone" {
type = string
}

variable "labels" {
description = "Set of key/value label pairs to assign to daos-client instances"
type = any
default = {}
}

variable "os_family" {
description = "OS GCP image family"
default = null
Expand Down
2 changes: 2 additions & 0 deletions terraform/examples/full_cluster_setup/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module "daos_server" {
subnetwork_project = var.subnetwork_project
region = var.region
zone = var.zone
labels = var.server_labels

number_of_instances = var.server_number_of_instances
daos_disk_count = var.server_daos_disk_count
Expand All @@ -33,6 +34,7 @@ module "daos_client" {
subnetwork_project = var.subnetwork_project
region = var.region
zone = var.zone
labels = var.client_labels

number_of_instances = var.client_number_of_instances

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ server_mig_name = "daos-server"
server_machine_type = "n2-highmem-32"
server_os_project = ""
server_os_family = "daos-server-centos-7"
server_labels = {
example = "full_cluster_setup"
}
# Client
client_number_of_instances = 1
client_instance_base_name = "daos-client"
Expand All @@ -26,3 +29,6 @@ client_mig_name = "daos-client"
client_machine_type = "c2-standard-16"
client_os_project = ""
client_os_family = "daos-client-hpc-centos-7"
client_labels = {
example = "full_cluster_setup"
}
13 changes: 13 additions & 0 deletions terraform/examples/full_cluster_setup/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@ variable "zone" {
default = null
}

variable "server_labels" {
description = "Set of key/value label pairs to assign to daos-server instances"
type = any
default = {}
}

variable "client_labels" {
description = "Set of key/value label pairs to assign to daos-client instances"
type = any
default = {}
}


variable "server_os_family" {
description = "OS GCP image family"
default = null
Expand Down
1 change: 1 addition & 0 deletions terraform/examples/simple_daos_server_example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ No resources.
|------|-------------|------|---------|:--------:|
| <a name="input_daos_disk_count"></a> [daos\_disk\_count](#input\_daos\_disk\_count) | Number of local ssd's to use | `number` | `16` | no |
| <a name="input_instance_base_name"></a> [instance\_base\_name](#input\_instance\_base\_name) | MIG instance base names to use | `string` | `"daos-server"` | no |
| <a name="input_labels"></a> [labels](#input\_labels) | Set of key/value label pairs to assign to daos-server instances | `any` | n/a | no |
| <a name="input_machine_type"></a> [machine\_type](#input\_machine\_type) | GCP machine type. ie. e2-medium | `string` | `"n2-custom-20-131072"` | no |
| <a name="input_mig_name"></a> [mig\_name](#input\_mig\_name) | MIG name | `string` | `"daos-server"` | no |
| <a name="input_network"></a> [network](#input\_network) | GCP network to use | `string` | n/a | yes |
Expand Down
1 change: 1 addition & 0 deletions terraform/examples/simple_daos_server_example/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ module "daos_server" {
subnetwork_project = var.subnetwork_project
region = var.region
zone = var.zone
labels = var.labels

number_of_instances = var.number_of_instances
daos_disk_count = var.daos_disk_count
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
project_id="<my_project_id>"
project_id = "<my_project_id>"
network = "<my_VPC_network>"
subnetwork = "<my_VPC_subnetwork>"
subnetwork_project = "<my_project_id>"
region = "europe-west4"
zone = "europe-west4-a"
labels = {
example="simple_daos_server_example"
}

number_of_instances = 4 # Allow 3-way replication with extra spare for rebuild
daos_disk_count = 16
Expand Down
6 changes: 6 additions & 0 deletions terraform/examples/simple_daos_server_example/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ variable "zone" {
type = string
}

variable "labels" {
description = "Set of key/value label pairs to assign to daos-server instances"
type = any
default = {}
}

variable "os_family" {
description = "OS GCP image family"
default = null
Expand Down
1 change: 1 addition & 0 deletions terraform/modules/daos_client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ No modules.
|------|-------------|------|---------|:--------:|
| <a name="input_daos_service_account_scopes"></a> [daos\_service\_account\_scopes](#input\_daos\_service\_account\_scopes) | Scopes for the DAOS client service account | `list(string)` | <pre>[<br> "userinfo-email",<br> "compute-ro",<br> "storage-ro"<br>]</pre> | no |
| <a name="input_instance_base_name"></a> [instance\_base\_name](#input\_instance\_base\_name) | MIG instance base names to use | `string` | `null` | no |
| <a name="input_labels"></a> [labels](#input\_labels) | Set of key/value label pairs to assign to daos-client instances | `any` | n/a | no |
| <a name="input_machine_type"></a> [machine\_type](#input\_machine\_type) | GCP machine type. ie. e2-medium | `string` | `null` | no |
| <a name="input_mig_name"></a> [mig\_name](#input\_mig\_name) | MIG name | `string` | `null` | no |
| <a name="input_network"></a> [network](#input\_network) | GCP network to use | `string` | `null` | no |
Expand Down
1 change: 1 addition & 0 deletions terraform/modules/daos_client/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ resource "google_compute_instance_template" "daos_sig_template" {
tags = ["daos-client"]
project = var.project_id
region = var.region
labels = var.labels

disk {
source_image = data.google_compute_image.os_image.self_link
Expand Down
6 changes: 6 additions & 0 deletions terraform/modules/daos_client/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ variable "zone" {
default = null
}

variable "labels" {
description = "Set of key/value label pairs to assign to daos-client instances"
type = any
default = {}
}

variable "os_family" {
description = "OS GCP image family"
default = null
Expand Down
1 change: 1 addition & 0 deletions terraform/modules/daos_server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ The resources/services/activations/deletions that this module will create/trigge
| <a name="input_daos_disk_type"></a> [daos\_disk\_type](#input\_daos\_disk\_type) | Daos disk type to use. For now only suported one is local-ssd | `string` | `"local-ssd"` | no |
| <a name="input_daos_service_account_scopes"></a> [daos\_service\_account\_scopes](#input\_daos\_service\_account\_scopes) | Scopes for the DAOS server service account | `list(string)` | <pre>[<br> "userinfo-email",<br> "compute-ro",<br> "storage-ro"<br>]</pre> | no |
| <a name="input_instance_base_name"></a> [instance\_base\_name](#input\_instance\_base\_name) | MIG instance base names to use | `string` | `"daos-server"` | no |
| <a name="input_labels"></a> [labels](#input\_labels) | Set of key/value label pairs to assign to daos-server instances | `any` | n/a | no |
| <a name="input_machine_type"></a> [machine\_type](#input\_machine\_type) | GCP machine type. ie. e2-medium | `string` | `"n2-custom-20-131072"` | no |
| <a name="input_mig_name"></a> [mig\_name](#input\_mig\_name) | MIG name | `string` | `"daos-server"` | no |
| <a name="input_network"></a> [network](#input\_network) | GCP network to use | `string` | n/a | yes |
Expand Down
1 change: 1 addition & 0 deletions terraform/modules/daos_server/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ resource "google_compute_instance_template" "daos_sig_template" {
tags = ["daos-server"]
project = var.project_id
region = var.region
labels = var.labels

disk {
source_image = data.google_compute_image.os_image.self_link
Expand Down
6 changes: 6 additions & 0 deletions terraform/modules/daos_server/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ variable "zone" {
default = null
}

variable "labels" {
description = "Set of key/value label pairs to assign to daos-server instances"
type = any
default = {}
}

variable "os_family" {
description = "OS GCP image family"
default = null
Expand Down

0 comments on commit 5756eec

Please sign in to comment.