Skip to content

Latest commit

 

History

History
145 lines (112 loc) · 7.7 KB

File metadata and controls

145 lines (112 loc) · 7.7 KB

Description

This module creates a Network File Sharing (NFS) file system based on a VM instance and compute disk. This file system can share directories and files with other clients over a network. nfs-server can be used by vm-instance and SchedMD community modules that create compute VMs.

For more information on this and other network storage options in the Cloud HPC Toolkit, see the extended Network Storage documentation.

WARNING: This module has only been tested against the HPC centos7 OS disk image (the default). Using other images may work, but have not been verified.

Example

- id: homefs
  source: community/modules/file-system/nfs-server
  use: [network1]
  settings:
    auto_delete_disk: true

This creates a NFS on a virtual machine which allow other VMs to mount the volume as an external file system.

NOTE: auto_delete_disk is set to true in this example, which means that running terraform destroy also deletes the disk. To retain the disk after terraform destroy either set this to false or don't include the settings so it defaults to false. Note that with auto_delete_disk: false, you will need to manually delete the disk after destroying a deployment group with nfs-server.

Mounting

To mount the NFS Server you must first ensure that the NFS client has been installed the and then call the proper mount command.

Both of these steps are automatically handled with the use of the use command in a selection of HPC Toolkit modules. See the compatibility matrix in the network storage doc for a complete list of supported modules. See the hpc-centos-ss.yaml test config for an example of using this module with a vm-instance module.

If mounting is not automatically handled as described above, the nfs-server module outputs runners that can be used with the startup-script module to install the client and mount the file system. See the following example:

  - id: nfs
    source: community/modules/file-system/nfs-server
    use: [network1]
    settings: {local_mounts: [/mnt1]}

  - id: mount-at-startup
    source: modules/scripts/startup-script
    settings:
      runners:
      - $(nfs.install_nfs_client_runner)
      - $(nfs.mount_runner)

License

Copyright 2022 Google LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Requirements

Name Version
terraform >= 0.14.0
google >= 3.83
random ~> 3.0

Providers

Name Version
google >= 3.83
random ~> 3.0

Modules

No modules.

Resources

Name Type
google_compute_disk.attached_disk resource
google_compute_instance.compute_instance resource
random_id.resource_name_suffix resource
google_compute_default_service_account.default data source

Inputs

Name Description Type Default Required
auto_delete_disk Whether or not the nfs disk should be auto-deleted bool false no
deployment_name Name of the HPC deployment, used as name of the NFS instace if no name is specified. string n/a yes
disk_size Storage size gb number "100" no
image the VM image used by the nfs server string "cloud-hpc-image-public/hpc-centos-7" no
labels Labels to add to the NFS instance. Key-value pairs. map(string) n/a yes
local_mounts Mountpoint for this NFS compute instance list(string)
[
"/data"
]
no
machine_type Type of the VM instance to use string "n2d-standard-2" no
metadata Metadata, provided as a map map(string) {} no
name The resource name of the instance. string null no
network_self_link The self link of the network to attach the nfs VM. string "default" no
project_id Project in which the HPC deployment will be created string n/a yes
scopes Scopes to apply to the controller list(string)
[
"https://www.googleapis.com/auth/cloud-platform"
]
no
service_account Service Account for the NFS Server string null no
subnetwork_self_link The self link of the subnetwork to attach the nfs VM. string null no
type The service tier of the instance. string "pd-ssd" no
zone The zone name where the nfs instance located in. string n/a yes

Outputs

Name Description
install_nfs_client Script for installing NFS client
install_nfs_client_runner Runner to install NFS client using the startup-script module
mount_runner Runner to mount the file-system using an ansible playbook. The startup-script
module will automatically handle installation of ansible.
- id: example-startup-script
source: modules/scripts/startup-script
settings:
runners:
- $(your-fs-id.mount_runner)
...
network_storage export of all desired folder directories