Skip to content

Commit a61adbb

Browse files
committed
Create PV and PVC from network storage passed into gke nodeset
1 parent 9447456 commit a61adbb

File tree

6 files changed

+40
-20
lines changed

6 files changed

+40
-20
lines changed

community/examples/slurm-gke/slurm-gke.yaml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -123,18 +123,9 @@ deployment_groups:
123123
install_slurm_chart: false
124124
outputs: [instructions]
125125

126-
- id: homefs-pv
127-
source: modules/file-system/gke-persistent-volume
128-
use: [homefs, gke_cluster]
129-
settings:
130-
capacity_gib: 1024
131-
namespace: $(vars.slurm_namespace)
132-
pv_name: home-pv
133-
pvc_name: home-pvc
134-
135126
- id: gke_compute_nodeset
136127
source: community/modules/compute/gke-nodeset
137-
use: [gke_compute_pool, slinky, homefs-pv, slurm_controller, network]
128+
use: [gke_compute_pool, slinky, homefs, slurm_controller, network]
138129
settings:
139130
slurm_cluster_name: $(vars.deployment_name)
140131
image: $(vars.slinky_image)

community/modules/compute/gke-nodeset/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
| Name | Source | Version |
1818
|------|--------|---------|
19+
| <a name="module_home_pv"></a> [home\_pv](#module\_home\_pv) | ../../../../modules/file-system/gke-persistent-volume | n/a |
1920
| <a name="module_kubectl_apply"></a> [kubectl\_apply](#module\_kubectl\_apply) | ../../../../modules/management/kubectl-apply | n/a |
2021
| <a name="module_slurm_key_pv"></a> [slurm\_key\_pv](#module\_slurm\_key\_pv) | ../../../../modules/file-system/gke-persistent-volume | n/a |
2122

@@ -31,13 +32,14 @@
3132
| Name | Description | Type | Default | Required |
3233
|------|-------------|------|---------|:--------:|
3334
| <a name="input_cluster_id"></a> [cluster\_id](#input\_cluster\_id) | projects/{{project}}/locations/{{location}}/clusters/{{cluster}} | `string` | n/a | yes |
35+
| <a name="input_filestore_id"></a> [filestore\_id](#input\_filestore\_id) | An array of identifier for a filestore with the format `projects/{{project}}/locations/{{location}}/instances/{{name}}`. | `string` | n/a | yes |
3436
| <a name="input_image"></a> [image](#input\_image) | The image for slurm daemon | `string` | n/a | yes |
3537
| <a name="input_instance_templates"></a> [instance\_templates](#input\_instance\_templates) | The URLs of Instance Templates | `list(string)` | n/a | yes |
38+
| <a name="input_network_storage"></a> [network\_storage](#input\_network\_storage) | An array of network attached storage mounts to be configured on nodes. | <pre>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> | n/a | yes |
3639
| <a name="input_node_count_static"></a> [node\_count\_static](#input\_node\_count\_static) | The number of static nodes in node-pool | `number` | n/a | yes |
3740
| <a name="input_node_pool_names"></a> [node\_pool\_names](#input\_node\_pool\_names) | If set to true. The node group VMs will have a random public IP assigned to it. Ignored if access\_config is set. | `list(string)` | n/a | yes |
3841
| <a name="input_nodeset_name"></a> [nodeset\_name](#input\_nodeset\_name) | The nodeset name | `string` | `"gkenodeset"` | no |
3942
| <a name="input_project_id"></a> [project\_id](#input\_project\_id) | The project ID to host the cluster in. | `string` | n/a | yes |
40-
| <a name="input_pvc_name"></a> [pvc\_name](#input\_pvc\_name) | An object that describes a k8s PVC created by this module. | `string` | n/a | yes |
4143
| <a name="input_slurm_bucket"></a> [slurm\_bucket](#input\_slurm\_bucket) | GCS Bucket of Slurm cluster file storage. | `any` | n/a | yes |
4244
| <a name="input_slurm_bucket_dir"></a> [slurm\_bucket\_dir](#input\_slurm\_bucket\_dir) | Path directory within `bucket_name` for Slurm cluster file storage. | `string` | n/a | yes |
4345
| <a name="input_slurm_cluster_name"></a> [slurm\_cluster\_name](#input\_slurm\_cluster\_name) | Cluster name, used in slurm controller | `string` | n/a | yes |

community/modules/compute/gke-nodeset/main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ module "kubectl_apply" {
3434
node_pool_name = var.node_pool_names[0],
3535
node_count = var.node_count_static,
3636
image = var.image,
37-
home_pvc = var.pvc_name,
37+
home_pvc = module.home_pv.pvc_name
38+
slurm_key_pvc = module.slurm_key_pv.pvc_name
3839
}
3940
}]
4041
}

community/modules/compute/gke-nodeset/slurm_key.tf renamed to community/modules/compute/gke-nodeset/persistent_volumes.tf

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
# limitations under the License.
1414

1515
locals {
16-
network_storage = {
16+
slurm_key_storage = {
1717
server_ip = var.slurm_controller_instance.network_interface[0].network_ip
1818
remote_mount = "/slurm/key_distribution" # defined in /community/modules/scheduler/schedmd-slurm-gcp-v6-controller/modules/slurm_files/scripts/util.py
1919
client_install_runner = {}
@@ -31,7 +31,20 @@ module "slurm_key_pv" {
3131
cluster_id = var.cluster_id
3232
filestore_id = "projects/empty/locations/empty/instances/empty" # this does not apply since this NFS is not a filestore
3333
namespace = var.slurm_namespace
34-
network_storage = local.network_storage
34+
network_storage = local.slurm_key_storage
3535
pv_name = "slurm-key-pv"
3636
pvc_name = "slurm-key-pvc"
3737
}
38+
39+
# Assume the var.network_storage[0] will be home and only one home pv is accepted for now.
40+
module "home_pv" {
41+
source = "../../../../modules/file-system/gke-persistent-volume"
42+
labels = {}
43+
capacity_gib = 1024
44+
cluster_id = var.cluster_id
45+
filestore_id = var.filestore_id
46+
network_storage = var.network_storage
47+
namespace = var.slurm_namespace
48+
pv_name = "home-pv"
49+
pvc_name = "home-pvc"
50+
}

community/modules/compute/gke-nodeset/templates/nodeset-general.yaml.tftpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ spec:
187187
name: run
188188
- name: slurm-config
189189
persistentVolumeClaim:
190-
claimName: slurm-key-pvc
190+
claimName: ${slurm_key_pvc}
191191
- emptyDir:
192192
medium: Memory
193193
name: slurm-spool

community/modules/compute/gke-nodeset/variables.tf

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,6 @@ variable "nodeset_name" {
7171
default = "gkenodeset"
7272
}
7373

74-
variable "pvc_name" {
75-
description = "An object that describes a k8s PVC created by this module."
76-
type = string
77-
}
78-
7974
variable "slurm_bucket_dir" {
8075
description = "Path directory within `bucket_name` for Slurm cluster file storage."
8176
type = string
@@ -93,3 +88,21 @@ variable "instance_templates" {
9388
type = list(string)
9489
nullable = false
9590
}
91+
92+
variable "network_storage" {
93+
description = "An array of network attached storage mounts to be configured on nodes."
94+
type = object({
95+
server_ip = string,
96+
remote_mount = string,
97+
local_mount = string,
98+
fs_type = string,
99+
mount_options = string,
100+
client_install_runner = map(string)
101+
mount_runner = map(string)
102+
})
103+
}
104+
105+
variable "filestore_id" {
106+
description = "An array of identifier for a filestore with the format `projects/{{project}}/locations/{{location}}/instances/{{name}}`."
107+
type = string
108+
}

0 commit comments

Comments
 (0)