diff --git a/community/modules/compute/htcondor-execute-point/README.md b/community/modules/compute/htcondor-execute-point/README.md index f0bbf1d51c..fcaeca6a15 100644 --- a/community/modules/compute/htcondor-execute-point/README.md +++ b/community/modules/compute/htcondor-execute-point/README.md @@ -212,9 +212,9 @@ limitations under the License. | Name | Source | Version | |------|--------|---------| -| [execute\_point\_instance\_template](#module\_execute\_point\_instance\_template) | terraform-google-modules/vm/google//modules/instance_template | ~> 12.1 | +| [execute\_point\_instance\_template](#module\_execute\_point\_instance\_template) | terraform-google-modules/vm/google//modules/instance_template | ~> 14.0 | | [gpu](#module\_gpu) | ../../../../modules/internal/gpu-definition | n/a | -| [mig](#module\_mig) | terraform-google-modules/vm/google//modules/mig | ~> 12.1 | +| [mig](#module\_mig) | terraform-google-modules/vm/google//modules/mig | ~> 14.0 | | [startup\_script](#module\_startup\_script) | ../../../../modules/scripts/startup-script | n/a | ## Resources @@ -249,6 +249,7 @@ limitations under the License. | [metadata](#input\_metadata) | Metadata to add to HTCondor execute points | `map(string)` | `{}` | no | | [min\_idle](#input\_min\_idle) | Minimum number of idle VMs in the HTCondor pool (if pool reaches var.max\_size, this minimum is not guaranteed); set to ensure jobs beginning run more quickly. | `number` | `0` | no | | [name\_prefix](#input\_name\_prefix) | Name prefix given to hostnames in this group of execute points; must be unique across all instances of this module | `string` | n/a | yes | +| [network\_interfaces](#input\_network\_interfaces) | A list of network interfaces to attach to HTCondor execute point instances.
Each network interface should have the following fields:
- network (required): The self link of the network
- subnetwork (optional): The self link of the subnetwork
- nic\_type (optional): "GVNIC" or "VIRTIO\_NET"
- stack\_type (optional): "IPV4\_ONLY" or "IPV4\_IPV6"
- network\_ip (optional): Specific IP address to assign
- queue\_count (optional): Queue count for multiqueue NIC
- access\_config (optional): List of NAT config objects
- ipv6\_access\_config (optional): List of IPv6 access config objects
- alias\_ip\_range (optional): List of alias IP ranges

If the list is empty, the module will fall back to using var.network\_self\_link
and var.subnetwork\_self\_link for backward compatibility.

NB: If you update the current setup with network interfaces, you may need to delete the current mig to apply the new network interface configuration |
list(object({
network = string
subnetwork = optional(string)
nic_type = optional(string)
stack_type = optional(string)
network_ip = optional(string, "")
queue_count = optional(number)
access_config = optional(list(object({
nat_ip = optional(string)
network_tier = optional(string)
})), [])
ipv6_access_config = optional(list(object({
network_tier = optional(string)
})), [])
alias_ip_range = optional(list(object({
ip_cidr_range = string
subnetwork_range_name = string
})), [])
}))
| `[]` | no | | [network\_self\_link](#input\_network\_self\_link) | The self link of the network HTCondor execute points will join | `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,
client_install_runner = map(string)
mount_runner = map(string)
}))
| `[]` | no | | [project\_id](#input\_project\_id) | Project in which the HTCondor execute points will be created | `string` | n/a | yes | diff --git a/community/modules/compute/htcondor-execute-point/main.tf b/community/modules/compute/htcondor-execute-point/main.tf index 159a4fb29d..72ced7eb8f 100644 --- a/community/modules/compute/htcondor-execute-point/main.tf +++ b/community/modules/compute/htcondor-execute-point/main.tf @@ -115,6 +115,39 @@ locals { ) name_prefix = "${var.deployment_name}-${var.name_prefix}-ep" + + # Handle backward compatibility for network configuration + # If var.network_interfaces is provided, use it directly. + # Otherwise, fall back to the older vars var.network_self_link and var.subnetwork_self_link + network_interfaces = ( + length(var.network_interfaces) > 0 + ? [ + for ni in var.network_interfaces : { + network = ni.network + subnetwork = ni.subnetwork + nic_type = ni.nic_type + stack_type = ni.stack_type + network_ip = ni.network_ip + queue_count = ni.queue_count + access_config = ni.access_config + ipv6_access_config = ni.ipv6_access_config + alias_ip_range = ni.alias_ip_range + } + ] + : [ + { + network = var.network_self_link + subnetwork = var.subnetwork_self_link + nic_type = null + stack_type = null + network_ip = "" + queue_count = null + access_config = [] + ipv6_access_config = [] + alias_ip_range = [] + } + ] + ) } data "google_compute_zones" "available" { @@ -147,12 +180,29 @@ module "startup_script" { module "execute_point_instance_template" { source = "terraform-google-modules/vm/google//modules/instance_template" - version = "~> 12.1" + version = "~> 14.0" name_prefix = local.name_prefix project_id = var.project_id - network = var.network_self_link - subnetwork = var.subnetwork_self_link + region = var.region + network = local.network_interfaces[0].network + subnetwork = local.network_interfaces[0].subnetwork + + additional_networks = [ + for network_interface in slice(local.network_interfaces, 1, length(local.network_interfaces)) : { + network = network_interface.network + subnetwork = network_interface.subnetwork + subnetwork_project = network_interface.subnetwork != null ? var.project_id : null + nic_type = network_interface.nic_type + stack_type = network_interface.stack_type + network_ip = network_interface.network_ip + queue_count = network_interface.queue_count + access_config = network_interface.access_config + ipv6_access_config = network_interface.ipv6_access_config + alias_ip_range = network_interface.alias_ip_range + } + ] + service_account = { email = var.execute_point_service_account_email scopes = var.service_account_scopes @@ -175,7 +225,7 @@ module "execute_point_instance_template" { module "mig" { source = "terraform-google-modules/vm/google//modules/mig" - version = "~> 12.1" + version = "~> 14.0" project_id = var.project_id region = var.region diff --git a/community/modules/compute/htcondor-execute-point/variables.tf b/community/modules/compute/htcondor-execute-point/variables.tf index 9d1e5cc03e..2e29634420 100644 --- a/community/modules/compute/htcondor-execute-point/variables.tf +++ b/community/modules/compute/htcondor-execute-point/variables.tf @@ -135,6 +135,49 @@ variable "subnetwork_self_link" { default = null } +variable "network_interfaces" { + description = <<-EOT + A list of network interfaces to attach to HTCondor execute point instances. + Each network interface should have the following fields: + - network (required): The self link of the network + - subnetwork (optional): The self link of the subnetwork + - nic_type (optional): "GVNIC" or "VIRTIO_NET" + - stack_type (optional): "IPV4_ONLY" or "IPV4_IPV6" + - network_ip (optional): Specific IP address to assign + - queue_count (optional): Queue count for multiqueue NIC + - access_config (optional): List of NAT config objects + - ipv6_access_config (optional): List of IPv6 access config objects + - alias_ip_range (optional): List of alias IP ranges + + If the list is empty, the module will fall back to using var.network_self_link + and var.subnetwork_self_link for backward compatibility. + + NB: If you update the current setup with network interfaces, you may need to delete the current mig to apply the new network interface configuration + EOT + + type = list(object({ + network = string + subnetwork = optional(string) + nic_type = optional(string) + stack_type = optional(string) + network_ip = optional(string, "") + queue_count = optional(number) + access_config = optional(list(object({ + nat_ip = optional(string) + network_tier = optional(string) + })), []) + ipv6_access_config = optional(list(object({ + network_tier = optional(string) + })), []) + alias_ip_range = optional(list(object({ + ip_cidr_range = string + subnetwork_range_name = string + })), []) + })) + + default = [] +} + variable "target_size" { description = "Initial size of the HTCondor execute point pool; set to null (default) to avoid Terraform management of size." type = number diff --git a/community/modules/scheduler/htcondor-access-point/README.md b/community/modules/scheduler/htcondor-access-point/README.md index 990278653b..db93ad0e04 100644 --- a/community/modules/scheduler/htcondor-access-point/README.md +++ b/community/modules/scheduler/htcondor-access-point/README.md @@ -122,8 +122,8 @@ limitations under the License. | Name | Source | Version | |------|--------|---------| -| [access\_point\_instance\_template](#module\_access\_point\_instance\_template) | terraform-google-modules/vm/google//modules/instance_template | ~> 12.1 | -| [htcondor\_ap](#module\_htcondor\_ap) | terraform-google-modules/vm/google//modules/mig | ~> 12.1 | +| [access\_point\_instance\_template](#module\_access\_point\_instance\_template) | terraform-google-modules/vm/google//modules/instance_template | ~> 14.0 | +| [htcondor\_ap](#module\_htcondor\_ap) | terraform-google-modules/vm/google//modules/mig | ~> 14.0 | | [startup\_script](#module\_startup\_script) | ../../../../modules/scripts/startup-script | n/a | ## Resources diff --git a/community/modules/scheduler/htcondor-access-point/main.tf b/community/modules/scheduler/htcondor-access-point/main.tf index 2af1db42c8..2011bdfc60 100644 --- a/community/modules/scheduler/htcondor-access-point/main.tf +++ b/community/modules/scheduler/htcondor-access-point/main.tf @@ -242,10 +242,11 @@ resource "google_compute_address" "ap" { module "access_point_instance_template" { source = "terraform-google-modules/vm/google//modules/instance_template" - version = "~> 12.1" + version = "~> 14.0" name_prefix = local.name_prefix project_id = var.project_id + region = var.region network = var.network_self_link subnetwork = var.subnetwork_self_link service_account = { @@ -279,7 +280,7 @@ module "access_point_instance_template" { module "htcondor_ap" { source = "terraform-google-modules/vm/google//modules/mig" - version = "~> 12.1" + version = "~> 14.0" project_id = var.project_id region = var.region diff --git a/community/modules/scheduler/htcondor-central-manager/README.md b/community/modules/scheduler/htcondor-central-manager/README.md index 067c3c6798..622af3626c 100644 --- a/community/modules/scheduler/htcondor-central-manager/README.md +++ b/community/modules/scheduler/htcondor-central-manager/README.md @@ -106,8 +106,8 @@ limitations under the License. | Name | Source | Version | |------|--------|---------| -| [central\_manager\_instance\_template](#module\_central\_manager\_instance\_template) | terraform-google-modules/vm/google//modules/instance_template | ~> 12.1 | -| [htcondor\_cm](#module\_htcondor\_cm) | terraform-google-modules/vm/google//modules/mig | ~> 12.1 | +| [central\_manager\_instance\_template](#module\_central\_manager\_instance\_template) | terraform-google-modules/vm/google//modules/instance_template | ~> 14.0 | +| [htcondor\_cm](#module\_htcondor\_cm) | terraform-google-modules/vm/google//modules/mig | ~> 14.0 | | [startup\_script](#module\_startup\_script) | ../../../../modules/scripts/startup-script | n/a | ## Resources diff --git a/community/modules/scheduler/htcondor-central-manager/main.tf b/community/modules/scheduler/htcondor-central-manager/main.tf index 44e5e9cee4..8d854d0740 100644 --- a/community/modules/scheduler/htcondor-central-manager/main.tf +++ b/community/modules/scheduler/htcondor-central-manager/main.tf @@ -149,10 +149,11 @@ resource "google_compute_address" "cm" { module "central_manager_instance_template" { source = "terraform-google-modules/vm/google//modules/instance_template" - version = "~> 12.1" + version = "~> 14.0" name_prefix = local.name_prefix project_id = var.project_id + region = var.region network = var.network_self_link subnetwork = var.subnetwork_self_link service_account = { @@ -177,7 +178,7 @@ module "central_manager_instance_template" { module "htcondor_cm" { source = "terraform-google-modules/vm/google//modules/mig" - version = "~> 12.1" + version = "~> 14.0" project_id = var.project_id region = var.region diff --git a/modules/scripts/startup-script/files/install_ansible.sh b/modules/scripts/startup-script/files/install_ansible.sh index 7ec98f95e9..af28008cf5 100644 --- a/modules/scripts/startup-script/files/install_ansible.sh +++ b/modules/scripts/startup-script/files/install_ansible.sh @@ -180,7 +180,7 @@ main() { # Create pip virtual environment for Cluster Toolkit ${python_path} -m venv "${venv_path}" --copies - venv_python_path=${venv_path}/bin/python3 + venv_python_path="${venv_path}/bin/$(basename "${python_path}")" # Upgrade pip if necessary pip_version=$(${venv_python_path} -m pip --version | sed -nr 's/^pip ([0-9]+\.[0-9]+).*$/\1/p')