hashicorp / nomad-driver-exec2

An official Nomad task driver plugin for sandboxing workloads using native Linux kernel features
Mozilla Public License 2.0
9 stars 0 forks source link

plugin: make use of Topology object from driver fingerprint #60

Closed shoenig closed 1 month ago

shoenig commented 1 month ago

This PR fixes exec2 to make use of the Topology object created during driver fingerprinting for computation of CPU resources. This fixes cases where the naive detection being used before did not work, for example on ARM CPUs. (This is how docker/exec drivers already work).

Fixes #59

shoenig commented 1 month ago

Spot checking on EC2 arm instance

ubuntu@ip-172-31-26-226:~$ lscpu | head -n10
Architecture:                         aarch64
CPU op-mode(s):                       32-bit, 64-bit
Byte Order:                           Little Endian
CPU(s):                               4
On-line CPU(s) list:                  0-3
Vendor ID:                            ARM
Model name:                           Neoverse-N1
Model:                                1
Thread(s) per core:                   1
Core(s) per socket:                   4

task launches just fine

ubuntu@ip-172-31-26-226:~$ nomad alloc status 5f | grep Health
Deployment Health   = healthy

example job

job "bug" {

  group "group" {

    task "sleep" {
      driver = "exec2"

      config {
        command = "sleep"
        args = ["infinity"]
      }

      resources {
        cores = 2
        memory =128
      }
    }
  }
}