Skip to content

add storage VLAN interface on all slurm nodes #391

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jun 3, 2024
Merged
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
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
Loading