Skip to content

Instantly share code, notes, and snippets.

@lemon-li
Forked from zhiguangwang/README.md
Created November 16, 2020 01:39
Show Gist options
  • Save lemon-li/d8929830a9bc5a3c5199193caf816f75 to your computer and use it in GitHub Desktop.
Save lemon-li/d8929830a9bc5a3c5199193caf816f75 to your computer and use it in GitHub Desktop.
Use Nomad "spread" Scheduler

Read Scheduler Config

curl -s --header "X-Nomad-Token: $NOMAD_TOKEN" "$NOMAD_ADDR/v1/operator/scheduler/configuration" | jq

Sample Output

{
  "SchedulerConfig": {
    "SchedulerAlgorithm": "binpack",
    "PreemptionConfig": {
      "SystemSchedulerEnabled": true,
      "BatchSchedulerEnabled": false,
      "ServiceSchedulerEnabled": false
    },
    "CreateIndex": 5,
    "ModifyIndex": 5
  },
  "Index": 5,
  "LastContact": 0,
  "KnownLeader": true
}

Update Scheduler Config

curl -X POST --header "X-Nomad-Token: $NOMAD_TOKEN" "$NOMAD_ADDR/v1/operator/scheduler/configuration" --data \
'{
  "SchedulerAlgorithm": "spread",
  "PreemptionConfig": {
    "SystemSchedulerEnabled": true,
    "BatchSchedulerEnabled": false,
    "ServiceSchedulerEnabled": false
  }
}'

Sample Output

{
  "SchedulerConfig": {
    "SchedulerAlgorithm": "spread",
    "PreemptionConfig": {
      "SystemSchedulerEnabled": true,
      "BatchSchedulerEnabled": false,
      "ServiceSchedulerEnabled": false
    },
    "CreateIndex": 5,
    "ModifyIndex": 12335
  },
  "Index": 12335,
  "LastContact": 0,
  "KnownLeader": true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment