Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions community/modules/compute/htcondor-execute-point/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,9 @@ limitations under the License.

| Name | Source | Version |
|------|--------|---------|
| <a name="module_execute_point_instance_template"></a> [execute\_point\_instance\_template](#module\_execute\_point\_instance\_template) | terraform-google-modules/vm/google//modules/instance_template | ~> 12.1 |
| <a name="module_execute_point_instance_template"></a> [execute\_point\_instance\_template](#module\_execute\_point\_instance\_template) | terraform-google-modules/vm/google//modules/instance_template | ~> 14.0 |
| <a name="module_gpu"></a> [gpu](#module\_gpu) | ../../../../modules/internal/gpu-definition | n/a |
| <a name="module_mig"></a> [mig](#module\_mig) | terraform-google-modules/vm/google//modules/mig | ~> 12.1 |
| <a name="module_mig"></a> [mig](#module\_mig) | terraform-google-modules/vm/google//modules/mig | ~> 14.0 |
| <a name="module_startup_script"></a> [startup\_script](#module\_startup\_script) | ../../../../modules/scripts/startup-script | n/a |

## Resources
Expand Down Expand Up @@ -249,6 +249,7 @@ limitations under the License.
| <a name="input_metadata"></a> [metadata](#input\_metadata) | Metadata to add to HTCondor execute points | `map(string)` | `{}` | no |
| <a name="input_min_idle"></a> [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 |
| <a name="input_name_prefix"></a> [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 |
| <a name="input_network_interfaces"></a> [network\_interfaces](#input\_network\_interfaces) | A list of network interfaces to attach to HTCondor execute point instances.<br/>Each network interface should have the following fields:<br/>- network (required): The self link of the network<br/>- subnetwork (optional): The self link of the subnetwork<br/>- nic\_type (optional): "GVNIC" or "VIRTIO\_NET"<br/>- stack\_type (optional): "IPV4\_ONLY" or "IPV4\_IPV6"<br/>- network\_ip (optional): Specific IP address to assign<br/>- queue\_count (optional): Queue count for multiqueue NIC<br/>- access\_config (optional): List of NAT config objects<br/>- ipv6\_access\_config (optional): List of IPv6 access config objects<br/>- alias\_ip\_range (optional): List of alias IP ranges<br/><br/>If the list is empty, the module will fall back to using var.network\_self\_link<br/>and var.subnetwork\_self\_link for backward compatibility.<br/><br/>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 | <pre>list(object({<br/> network = string<br/> subnetwork = optional(string)<br/> nic_type = optional(string)<br/> stack_type = optional(string)<br/> network_ip = optional(string, "")<br/> queue_count = optional(number)<br/> access_config = optional(list(object({<br/> nat_ip = optional(string)<br/> network_tier = optional(string)<br/> })), [])<br/> ipv6_access_config = optional(list(object({<br/> network_tier = optional(string)<br/> })), [])<br/> alias_ip_range = optional(list(object({<br/> ip_cidr_range = string<br/> subnetwork_range_name = string<br/> })), [])<br/> }))</pre> | `[]` | no |
| <a name="input_network_self_link"></a> [network\_self\_link](#input\_network\_self\_link) | The self link of the network HTCondor execute points will join | `string` | `"default"` | no |
| <a name="input_network_storage"></a> [network\_storage](#input\_network\_storage) | An array of network attached storage mounts to be configured | <pre>list(object({<br/> server_ip = string,<br/> remote_mount = string,<br/> local_mount = string,<br/> fs_type = string,<br/> mount_options = string,<br/> client_install_runner = map(string)<br/> mount_runner = map(string)<br/> }))</pre> | `[]` | no |
| <a name="input_project_id"></a> [project\_id](#input\_project\_id) | Project in which the HTCondor execute points will be created | `string` | n/a | yes |
Expand Down
58 changes: 54 additions & 4 deletions community/modules/compute/htcondor-execute-point/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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" {
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
43 changes: 43 additions & 0 deletions community/modules/compute/htcondor-execute-point/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions community/modules/scheduler/htcondor-access-point/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@ limitations under the License.

| Name | Source | Version |
|------|--------|---------|
| <a name="module_access_point_instance_template"></a> [access\_point\_instance\_template](#module\_access\_point\_instance\_template) | terraform-google-modules/vm/google//modules/instance_template | ~> 12.1 |
| <a name="module_htcondor_ap"></a> [htcondor\_ap](#module\_htcondor\_ap) | terraform-google-modules/vm/google//modules/mig | ~> 12.1 |
| <a name="module_access_point_instance_template"></a> [access\_point\_instance\_template](#module\_access\_point\_instance\_template) | terraform-google-modules/vm/google//modules/instance_template | ~> 14.0 |
| <a name="module_htcondor_ap"></a> [htcondor\_ap](#module\_htcondor\_ap) | terraform-google-modules/vm/google//modules/mig | ~> 14.0 |
| <a name="module_startup_script"></a> [startup\_script](#module\_startup\_script) | ../../../../modules/scripts/startup-script | n/a |

## Resources
Expand Down
5 changes: 3 additions & 2 deletions community/modules/scheduler/htcondor-access-point/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ limitations under the License.

| Name | Source | Version |
|------|--------|---------|
| <a name="module_central_manager_instance_template"></a> [central\_manager\_instance\_template](#module\_central\_manager\_instance\_template) | terraform-google-modules/vm/google//modules/instance_template | ~> 12.1 |
| <a name="module_htcondor_cm"></a> [htcondor\_cm](#module\_htcondor\_cm) | terraform-google-modules/vm/google//modules/mig | ~> 12.1 |
| <a name="module_central_manager_instance_template"></a> [central\_manager\_instance\_template](#module\_central\_manager\_instance\_template) | terraform-google-modules/vm/google//modules/instance_template | ~> 14.0 |
| <a name="module_htcondor_cm"></a> [htcondor\_cm](#module\_htcondor\_cm) | terraform-google-modules/vm/google//modules/mig | ~> 14.0 |
| <a name="module_startup_script"></a> [startup\_script](#module\_startup\_script) | ../../../../modules/scripts/startup-script | n/a |

## Resources
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion modules/scripts/startup-script/files/install_ansible.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
Loading