hashicorp / nomad

Nomad is an easy-to-use, flexible, and performant workload orchestrator that can deploy a mix of microservice, batch, containerized, and non-containerized applications. Nomad is easy to operate and scale and has native Consul and Vault integrations.
https://www.nomadproject.io/
Other
14.83k stars 1.95k forks source link

QEMU CSI Support and Cloud Init as Task Configuration #17970

Open nottech-gmbh opened 1 year ago

nottech-gmbh commented 1 year ago

QEMU CSI Support: Please consider adding QEMU CSI support to Nomad. This integration would enable users to leverage a wider range of storage options and seamlessly integrate with different storage providers, enhancing deployment flexibility and workload configurations.

Cloud Init as Task Configuration: It would be beneficial to include support for Cloud Init as part of the task configuration in Nomad. This feature would allow users to specify custom cloud-init configurations for their tasks, automating the setup and initialization process of instances. This simplification would reduce operational overhead and facilitate easier provisioning and management of tasks. Thank you for considering these feature requests. I appreciate your team's dedication and look forward to witnessing the continued growth of Nomad. :)

schmichael commented 1 year ago

Thanks for filing this issue! We appreciate knowing what features users care about, and we've been hearing more and more about qemu lately. No firm roadmap plans yet, but it's good timing for us to be thinking about it.

tomiles commented 2 months ago

You can actually do cloud-init configuration already. To illustrate how, I wrote a small example config that mounts a samba/cifs volume inside a qemu instance.

Step 1. Create a user-data cloud-config in the NOMAD_TASK_DIR with a nomad template stanza: ( similarly you can also create meta_data.json and content/... to inject files, be careful to respect the proper config-drive directory structure )

template {
 data =<<-EOF
 #cloud-config
 package_update: true
 packages:
  - cifs-utils
 mounts:
  - [ "//your_smaba_server/volume", "/media/mountpoint", "cifs", "ro,dir_mode=0775,uid=REDACTED,gid=REDACTED,username=REDACTED,workgroup=REDACTED,password=REDACTED,noauto,cache=strict", "0", "0"]
 EOF
 destination = "local/config-drive/openstack/latest/user_data"
}

Step 2. Mount this config-drive directory as a virtual device by using the args property in the task config . It will detect the drive based on the config-2 label and process the cloud-config on boot.

args = [
  "-drive", "if=virtio,file=fat:ro:/var/lib/nomad/alloc/$${NOMAD_ALLOC_ID}/yourtaskname/local/config-drive/,file.label=config-2,format=raw,media=disk,readonly"
]