diff --git a/README.md b/README.md index e0424400..188d9782 100644 --- a/README.md +++ b/README.md @@ -371,12 +371,12 @@ proxy_url = VALUE | [application\_insights\_name](#input\_application\_insights\_name) | The Application Insights name. | `string` | `""` | no | | [apt\_repo\_server](#input\_apt\_repo\_server) | The URL of the apt private repository. | `string` | `""` | no | | [assign\_public\_ip](#input\_assign\_public\_ip) | Determines whether to assign public IP to all instances deployed by TF module. Includes backends, clients and protocol gateways. | `string` | `"auto"` | no | -| [client\_arch](#input\_client\_arch) | Use arch for ami id, value can be arm64/x86\_64, the default value is x86\_64. | `string` | `"x86_64"` | no | +| [client\_arch](#input\_client\_arch) | Use arch for ami id, value can be arm64/x86\_64. | `string` | `null` | no | | [client\_frontend\_cores](#input\_client\_frontend\_cores) | The client NICs number. | `number` | `1` | no | | [client\_identity\_name](#input\_client\_identity\_name) | The user assigned identity name for the client instances (if empty - new one is created). | `string` | `""` | no | | [client\_instance\_type](#input\_client\_instance\_type) | The client virtual machine type (sku) to deploy. | `string` | `""` | no | | [client\_placement\_group\_id](#input\_client\_placement\_group\_id) | The client instances placement group id. Backend placement group can be reused. If not specified placement group will be created automatically | `string` | `""` | no | -| [client\_source\_image\_id](#input\_client\_source\_image\_id) | Use weka custom image, ubuntu 20.04 with kernel 5.4 and ofed 5.8-1.1.2.1 / ubuntu arm 20.04 with kernel 5.4 and ofed 5.9-0.5.6.0 |
object({
x86_64 = string
arm64 = string
})
|
{
"arm64": "/communityGalleries/WekaIO-d7d3f308-d5a1-4c45-8e8a-818aed57375a/images/arm20.04/versions/latest",
"x86_64": "/communityGalleries/WekaIO-d7d3f308-d5a1-4c45-8e8a-818aed57375a/images/ubuntu20.04/versions/latest"
}
| no | +| [client\_source\_image\_id](#input\_client\_source\_image\_id) | Use weka custom image, ubuntu 20.04 with kernel 5.4 and ofed 5.8-1.1.2.1 / ubuntu arm 20.04 with kernel 5.4 and ofed 5.9-0.5.6.0 | `string` | `""` | no | | [clients\_custom\_data](#input\_clients\_custom\_data) | Custom data to pass to the client instances | `string` | `""` | no | | [clients\_number](#input\_clients\_number) | The number of client virtual machines to deploy. | `number` | `0` | no | | [clients\_use\_dpdk](#input\_clients\_use\_dpdk) | Mount weka clients in DPDK mode | `bool` | `true` | no | @@ -399,7 +399,7 @@ proxy_url = VALUE | [function\_app\_storage\_account\_prefix](#input\_function\_app\_storage\_account\_prefix) | Weka storage account name prefix | `string` | `"weka"` | no | | [function\_app\_subnet\_delegation\_cidr](#input\_function\_app\_subnet\_delegation\_cidr) | Subnet delegation enables you to designate a specific subnet for an Azure PaaS service. | `string` | `"10.0.1.0/25"` | no | | [function\_app\_subnet\_delegation\_id](#input\_function\_app\_subnet\_delegation\_id) | Required to specify if subnet\_name were used to specify pre-defined subnets for weka. Function subnet delegation requires an additional subnet, and in the case of pre-defined networking this one also should be pre-defined | `string` | `""` | no | -| [function\_app\_version](#input\_function\_app\_version) | Function app code version (hash) | `string` | `"5efbf69b612a1294ac2dc23d81e9a29c"` | no | +| [function\_app\_version](#input\_function\_app\_version) | Function app code version (hash) | `string` | `"2380b026b2b6b84b67c8e553122766ae"` | no | | [get\_weka\_io\_token](#input\_get\_weka\_io\_token) | The token to download the Weka release from get.weka.io. | `string` | `""` | no | | [hotspare](#input\_hotspare) | Number of hotspares to set on weka cluster. Refer to https://docs.weka.io/overview/ssd-capacity-management#hot-spare | `number` | `1` | no | | [install\_cluster\_dpdk](#input\_install\_cluster\_dpdk) | Install weka cluster with DPDK | `bool` | `true` | no | @@ -462,7 +462,7 @@ proxy_url = VALUE | [vnets\_to\_peer\_to\_deployment\_vnet](#input\_vnets\_to\_peer\_to\_deployment\_vnet) | List of vent-name:resource-group-name to peer |
list(object({
vnet = string
rg = string
}))
| `[]` | no | | [weka\_home\_url](#input\_weka\_home\_url) | Weka Home url | `string` | `""` | no | | [weka\_tar\_storage\_account\_id](#input\_weka\_tar\_storage\_account\_id) | ### private blob | `string` | `""` | no | -| [weka\_version](#input\_weka\_version) | The Weka version to deploy. | `string` | `"4.2.10"` | no | +| [weka\_version](#input\_weka\_version) | The Weka version to deploy. | `string` | `"4.2.11"` | no | | [zone](#input\_zone) | The zone in which the resources should be created. | `string` | `"1"` | no | ## Outputs diff --git a/ci/deployment/main.tf b/ci/deployment/main.tf index 33aac15b..c69a3874 100644 --- a/ci/deployment/main.tf +++ b/ci/deployment/main.tf @@ -10,14 +10,11 @@ provider "azurerm" { } module "weka_deployment" { - source = "../.." - prefix = var.prefix - rg_name = var.rg_name - get_weka_io_token = var.get_weka_io_token - subscription_id = var.subscription_id - cluster_name = var.cluster_name - set_obs_integration = true - cluster_size = var.cluster_size - tiering_ssd_percent = 20 - allow_ssh_ranges = ["0.0.0.0/0"] + source = "../.." + prefix = var.prefix + rg_name = var.rg_name + get_weka_io_token = var.get_weka_io_token + subscription_id = var.subscription_id + cluster_name = var.cluster_name + cluster_size = var.cluster_size } diff --git a/clients.tf b/clients.tf index 1c669574..f8a0b07a 100644 --- a/clients.tf +++ b/clients.tf @@ -1,11 +1,3 @@ -locals { - default_client_instance_type = { - x86_64 = "Standard_D8_v5" - arm64 = "Standard_E2ps_v5" - } -} - - module "clients" { count = var.clients_number > 0 ? 1 : 0 source = "./modules/clients" @@ -18,16 +10,17 @@ module "clients" { vnet_name = local.vnet_name vm_identity_name = var.client_identity_name frontend_container_cores_num = var.clients_use_dpdk ? var.client_frontend_cores : 1 - instance_type = var.client_instance_type != "" ? var.client_instance_type : local.default_client_instance_type[var.client_arch] + instance_type = var.client_instance_type backend_lb_ip = var.create_lb ? azurerm_lb.backend_lb[0].private_ip_address : "" ssh_public_key = var.ssh_public_key == null ? tls_private_key.ssh_key[0].public_key_openssh : var.ssh_public_key ppg_id = var.client_placement_group_id == "" ? local.placement_group_id : var.client_placement_group_id assign_public_ip = local.assign_public_ip vnet_rg_name = local.vnet_rg_name - source_image_id = var.client_source_image_id[var.client_arch] + source_image_id = var.client_source_image_id sg_id = local.sg_id tags_map = var.tags_map custom_data = var.clients_custom_data vmss_name = "${var.prefix}-${var.cluster_name}-vmss" depends_on = [azurerm_proximity_placement_group.ppg, module.network] + arch = var.client_arch } diff --git a/examples/existing_private_network/main.tf b/examples/existing_private_network/main.tf index 277bb895..98e5952c 100644 --- a/examples/existing_private_network/main.tf +++ b/examples/existing_private_network/main.tf @@ -14,7 +14,7 @@ module "weka_deployment" { vnet_name = "vnet-name" vnet_rg_name = "vnet-rg-name" sg_id = "/subscriptions/../resourceGroups/../providers/Microsoft.Network/networkSecurityGroups/.." - install_weka_url = "https://wekatars.blob.core.windows.net/tars/weka-4.2.10.tar?" + install_weka_url = "https://wekatars.blob.core.windows.net/tars/weka-4.2.11.tar?" assign_public_ip = false cluster_size = 6 tiering_enable_obs_integration = true diff --git a/examples/existing_private_network_with_peering/main.tf b/examples/existing_private_network_with_peering/main.tf index 9490e685..937c8eba 100644 --- a/examples/existing_private_network_with_peering/main.tf +++ b/examples/existing_private_network_with_peering/main.tf @@ -11,7 +11,7 @@ module "weka_deployment" { rg_name = "weka-rg" assign_public_ip = false apt_repo_server = "http://11.0.0.4/ubuntu/mirror/archive.ubuntu.com/ubuntu/" - install_weka_url = "https://wekatars.blob.core.windows.net/tars/weka-4.2.10.tar?" + install_weka_url = "https://wekatars.blob.core.windows.net/tars/weka-4.2.11.tar?" vnet_rg_name = "weka-rg" vnet_name = "weka-vnet" subnet_name = "weka-subnet" diff --git a/functions.tf b/functions.tf index 8fe36163..0ed2a877 100644 --- a/functions.tf +++ b/functions.tf @@ -12,7 +12,7 @@ locals { deployment_storage_account_id = var.deployment_storage_account_name == "" ? azurerm_storage_account.deployment_sa[0].id : data.azurerm_storage_account.deployment_blob[0].id deployment_storage_account_name = var.deployment_storage_account_name == "" ? azurerm_storage_account.deployment_sa[0].name : var.deployment_storage_account_name deployment_container_name = var.deployment_container_name == "" ? azurerm_storage_container.deployment[0].name : var.deployment_container_name - obs_storage_account_name = var.tiering_obs_name == "" ? "${local.alphanumeric_prefix_name}${local.alphanumeric_cluster_name}obs" : var.tiering_obs_name + obs_storage_account_name = var.tiering_obs_name == "" ? "${substr("${local.alphanumeric_prefix_name}${local.alphanumeric_cluster_name}", 0, 21)}obs" : var.tiering_obs_name obs_container_name = var.tiering_obs_container_name == "" ? "${var.prefix}-${var.cluster_name}-obs" : var.tiering_obs_container_name function_app_name = "${local.alphanumeric_prefix_name}-${local.alphanumeric_cluster_name}-function-app" install_weka_url = var.install_weka_url != "" ? var.install_weka_url : "https://$TOKEN@get.weka.io/dist/v1/install/${var.weka_version}/${var.weka_version}" diff --git a/modules/clients/README.md b/modules/clients/README.md index e5a07888..6040b50e 100644 --- a/modules/clients/README.md +++ b/modules/clients/README.md @@ -40,6 +40,7 @@ No modules. | Name | Description | Type | Default | Required | |------|-------------|------|---------|:--------:| | [apt\_repo\_server](#input\_apt\_repo\_server) | The URL of the apt private repository. | `string` | `""` | no | +| [arch](#input\_arch) | n/a | `string` | `null` | no | | [assign\_public\_ip](#input\_assign\_public\_ip) | Determines whether to assign public ip. | `bool` | `true` | no | | [backend\_lb\_ip](#input\_backend\_lb\_ip) | The backend load balancer ip address. | `string` | `""` | no | | [clients\_name](#input\_clients\_name) | The clients name. | `string` | n/a | yes | @@ -51,7 +52,7 @@ No modules. | [ppg\_id](#input\_ppg\_id) | Placement proximity group id. | `string` | `null` | no | | [rg\_name](#input\_rg\_name) | A predefined resource group in the Azure subscription. | `string` | n/a | yes | | [sg\_id](#input\_sg\_id) | Security group id | `string` | n/a | yes | -| [source\_image\_id](#input\_source\_image\_id) | Use weka custom image, ubuntu 20.04 with kernel 5.4 and ofed 5.8-1.1.2.1 | `string` | n/a | yes | +| [source\_image\_id](#input\_source\_image\_id) | Use weka custom image, ubuntu 20.04 with kernel 5.4 and ofed 5.8-1.1.2.1 | `string` | `""` | no | | [ssh\_public\_key](#input\_ssh\_public\_key) | Ssh public key to pass to vms. | `string` | n/a | yes | | [subnet\_name](#input\_subnet\_name) | The subnet names. | `string` | n/a | yes | | [tags\_map](#input\_tags\_map) | A map of tags to assign the same metadata to all resources in the environment. Format: key:value. | `map(string)` | `{}` | no | diff --git a/modules/clients/iam.tf b/modules/clients/iam.tf index a5962cb7..93b01215 100644 --- a/modules/clients/iam.tf +++ b/modules/clients/iam.tf @@ -32,4 +32,6 @@ resource "azurerm_role_assignment" "reader" { scope = data.azurerm_resource_group.rg.id role_definition_name = azurerm_role_definition.nics_reader[0].name principal_id = azurerm_user_assigned_identity.this[0].principal_id + + depends_on = [azurerm_role_definition.nics_reader] } diff --git a/modules/clients/main.tf b/modules/clients/main.tf index 6c1be28a..a8aa2b0c 100644 --- a/modules/clients/main.tf +++ b/modules/clients/main.tf @@ -30,6 +30,20 @@ locals { vms_custom_data = base64encode(join("\n", local.custom_data_parts)) client_identity_id = var.vm_identity_name == "" ? azurerm_user_assigned_identity.this[0].id : data.azurerm_user_assigned_identity.this[0].id + + arm_instances = ["Standard_D4ps_v5", "Standard_D8ps_v5", "Standard_D16ps_v5", "Standard_D32ps_v5", "Standard_D48ps_v5", "Standard_D64ps_v5", "Standard_D8plds_v5", "Standard_D32plds_v5", "Standard_D64plds_v5"] + default_arch = contains(local.arm_instances, var.instance_type) ? "arm64" : "x86_64" + arch = var.arch == null ? local.default_arch : var.arch + default_client_instance_type = { + x86_64 = "Standard_D8_v5" + arm64 = "Standard_E2ps_v5" + } + instance_type = var.instance_type != "" ? var.instance_type : local.default_client_instance_type[local.arch] + default_source_image_id = { + x86_64 = "/communityGalleries/WekaIO-d7d3f308-d5a1-4c45-8e8a-818aed57375a/images/ubuntu20.04/versions/latest" + arm64 = "/communityGalleries/WekaIO-d7d3f308-d5a1-4c45-8e8a-818aed57375a/images/arm20.04/versions/latest" + } + source_image_id = var.source_image_id != "" ? var.source_image_id : local.default_source_image_id[local.arch] } resource "azurerm_public_ip" "public_ip" { @@ -114,8 +128,8 @@ resource "azurerm_linux_virtual_machine" "this" { admin_username = var.vm_username tags = merge({ "weka_cluster_client" : var.clients_name }, var.tags_map) custom_data = local.vms_custom_data - source_image_id = var.source_image_id - size = var.instance_type + source_image_id = local.source_image_id + size = local.instance_type network_interface_ids = concat([ local.first_nic_ids[count.index] ], slice(azurerm_network_interface.private_nics[*].id, (local.nics_num - 1) * count.index, (local.nics_num - 1) * (count.index + 1))) diff --git a/modules/clients/variables.tf b/modules/clients/variables.tf index d52f06e1..7b6a0536 100644 --- a/modules/clients/variables.tf +++ b/modules/clients/variables.tf @@ -10,11 +10,6 @@ variable "frontend_container_cores_num" { description = "Number of nics to set on each client vm" } -variable "source_image_id" { - type = string - description = "Use weka custom image, ubuntu 20.04 with kernel 5.4 and ofed 5.8-1.1.2.1" -} - variable "rg_name" { type = string description = "A predefined resource group in the Azure subscription." @@ -113,3 +108,14 @@ variable "vm_identity_name" { description = "The name of the user assigned identity for the client VMs." default = "" } + +variable "arch" { + type = string + default = null +} + +variable "source_image_id" { + type = string + description = "Use weka custom image, ubuntu 20.04 with kernel 5.4 and ofed 5.8-1.1.2.1" + default = "" +} diff --git a/variables.tf b/variables.tf index 558a505b..8b0f7c7a 100644 --- a/variables.tf +++ b/variables.tf @@ -129,7 +129,7 @@ variable "logic_app_identity_name" { variable "weka_version" { type = string description = "The Weka version to deploy." - default = "4.2.10" + default = "4.2.11" } variable "get_weka_io_token" { @@ -495,24 +495,18 @@ variable "client_instance_type" { } variable "client_source_image_id" { - type = object({ - x86_64 = string - arm64 = string - }) - default = { - x86_64 = "/communityGalleries/WekaIO-d7d3f308-d5a1-4c45-8e8a-818aed57375a/images/ubuntu20.04/versions/latest" - arm64 = "/communityGalleries/WekaIO-d7d3f308-d5a1-4c45-8e8a-818aed57375a/images/arm20.04/versions/latest" - } + type = string description = "Use weka custom image, ubuntu 20.04 with kernel 5.4 and ofed 5.8-1.1.2.1 / ubuntu arm 20.04 with kernel 5.4 and ofed 5.9-0.5.6.0" + default = "" } variable "client_arch" { type = string - default = "x86_64" - description = "Use arch for ami id, value can be arm64/x86_64, the default value is x86_64." + default = null + description = "Use arch for ami id, value can be arm64/x86_64." validation { - condition = var.client_arch == "arm64" || var.client_arch == "x86_64" - error_message = "Allowed client_arch values: [\"arm64\", \"x86_64\"]." + condition = var.client_arch == "arm64" || var.client_arch == "x86_64" || var.client_arch == null + error_message = "Allowed client_arch values: [\"arm64\", \"x86_64\", null]." } }