Skip to content

Commit

Permalink
Merge pull request #391 from stackhpc/add-storage-network
Browse files Browse the repository at this point in the history
add storage VLAN interface on all slurm nodes
  • Loading branch information
scrungus authored Jun 3, 2024
2 parents a0109b4 + ba8b7f3 commit 4433026
Showing 1 changed file with 94 additions and 17 deletions.
111 changes: 94 additions & 17 deletions ansible/roles/cluster_infra/templates/resources.tf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@ data "openstack_networking_network_v2" "cluster_external_network" {
name = "{{ cluster_external_network }}"
}

# Storage network
{% if cluster_storage_network is defined %}
data "openstack_networking_network_v2" "cluster_storage" {
name = "{{ cluster_storage_network }}"
}
{% endif %}

data "openstack_networking_subnet_ids_v2" "cluster_external_subnets" {
network_id = "${data.openstack_networking_network_v2.cluster_external_network.id}"
}
Expand Down Expand Up @@ -177,6 +184,11 @@ data "openstack_networking_subnet_v2" "cluster_subnet" {
##### Cluster ports
#####

###
# Login node
###

# Primary network
resource "openstack_networking_port_v2" "login" {
name = "{{ cluster_name }}-login-0"
network_id = "${data.openstack_networking_network_v2.cluster_network.id}"
Expand All @@ -193,14 +205,31 @@ resource "openstack_networking_port_v2" "login" {

binding {
vnic_type = "{{ cluster_vnic_type | default('normal') }}"
{% if cluster_vnic_profile is defined %}
profile = <<EOF
{{ cluster_vnic_profile | to_json }}
EOF
{% endif %}
}
}

# Storage network
{% if cluster_storage_network is defined %}
resource "openstack_networking_port_v2" "login_storage" {
name = "{{ cluster_name }}-login-storage-0"
network_id = data.openstack_networking_network_v2.cluster_storage.id
admin_state_up = "true"

security_group_ids = [
"${openstack_networking_secgroup_v2.secgroup_slurm_cluster.id}",
]

binding {
vnic_type = "{{ cluster_storage_vnic_type | default('normal') }}"
}
}
{% endif %}

###
# Control node
###

# Primary network
resource "openstack_networking_port_v2" "control" {
name = "{{ cluster_name }}-control-0"
network_id = "${data.openstack_networking_network_v2.cluster_network.id}"
Expand All @@ -216,15 +245,32 @@ resource "openstack_networking_port_v2" "control" {

binding {
vnic_type = "{{ cluster_vnic_type | default('normal') }}"
{% if cluster_vnic_profile is defined %}
profile = <<EOF
{{ cluster_vnic_profile | to_json }}
EOF
{% endif %}

}
}

# Storage network
{% if cluster_storage_network is defined %}
resource "openstack_networking_port_v2" "control_storage" {
name = "{{ cluster_name }}-control-storage-0"
network_id = data.openstack_networking_network_v2.cluster_storage.id
admin_state_up = "true"

security_group_ids = [
"${openstack_networking_secgroup_v2.secgroup_slurm_cluster.id}"
]

binding {
vnic_type = "{{ cluster_storage_vnic_type | default('normal') }}"
}
}
{% endif %}

###
# Workers
###
{% for partition in openhpc_slurm_partitions %}
# Primary network
resource "openstack_networking_port_v2" "{{ partition.name }}" {
count = {{ partition.count }}
name = "{{ cluster_name }}-compute-{{ partition.name }}-${count.index}"
Expand All @@ -241,14 +287,27 @@ resource "openstack_networking_port_v2" "{{ partition.name }}" {

binding {
vnic_type = "{{ cluster_vnic_type | default('normal') }}"
{% if cluster_vnic_profile is defined %}
profile = <<EOF
{{ cluster_vnic_profile | to_json }}
EOF
{% endif %}
}
}

# Storage network
{% if cluster_storage_network is defined %}
resource "openstack_networking_port_v2" "{{ partition.name }}_storage" {
count = {{ partition.count }}
name = "{{ cluster_name }}-compute-{{ partition.name }}-storage-${count.index}"
network_id = data.openstack_networking_network_v2.cluster_storage.id
admin_state_up = "true"

security_group_ids = [
"${openstack_networking_secgroup_v2.secgroup_slurm_cluster.id}"
]

binding {
vnic_type = "{{ cluster_storage_vnic_type | default('normal') }}"
}
}
{% endif %}

{% endfor %}

#####
Expand All @@ -274,9 +333,15 @@ resource "openstack_compute_instance_v2" "login" {
{% endif %}

network {
port = "${openstack_networking_port_v2.login.id}"
port = openstack_networking_port_v2.login.id
}

{% if cluster_storage_network is defined %}
network {
port = openstack_networking_port_v2.login_storage.id
}
{% endif %}

# root device:
block_device {
uuid = "{{ cluster_image }}"
Expand Down Expand Up @@ -317,9 +382,15 @@ resource "openstack_compute_instance_v2" "control" {
{% endif %}

network {
port = "${openstack_networking_port_v2.control.id}"
port = openstack_networking_port_v2.control.id
}

{% if cluster_storage_network is defined %}
network {
port = openstack_networking_port_v2.control_storage.id
}
{% endif %}

# root device:
block_device {
uuid = "{{ cluster_image }}"
Expand Down Expand Up @@ -393,6 +464,12 @@ resource "openstack_compute_instance_v2" "{{ partition.name }}" {
port = openstack_networking_port_v2.{{ partition.name }}[count.index].id
}

{% if cluster_storage_network is defined %}
network {
port = openstack_networking_port_v2.{{ partition.name }}_storage[count.index].id
}
{% endif %}

# root device:
block_device {
uuid = "{{ cluster_image }}"
Expand Down

0 comments on commit 4433026

Please sign in to comment.