Labels

Labels works as node selector and static service discovery in maand.


Labels are defined in the workers.json file and matched to jobs for allocations.

Viewing Labels

List all workers and their labels:

$ maand cat workers

Example Output:

worker_id                             worker_ip      detained  labels
------------------------------------  -------------  --------  -------------------------------------
1117262b-c412-4c28-8724-e22a3c194947  10.27.221.181  0         worker
25d833a2-a7da-450f-81a6-11ecd1ef4632  10.27.221.144  0         worker
94dfe46b-2326-46d5-8956-971a774af8d2  10.27.221.170  0         worker

Default Label


Assigning Labels

Edit workers.json Add labels to workers under the labels key:

[
 {
   "host": "10.27.221.181",
   "labels": ["prometheus"]
 },
 {
   "host": "10.27.221.144"
 },
 {
   "host": "10.27.221.170"
 }
]

Build Configuration Apply the changes by running:

$ maand build

Verify Labels Check label assignments:

$ maand cat workers

Example Output:

worker_id                             worker_ip      detained  labels
------------------------------------  -------------  --------  -------------------------------------
1117262b-c412-4c28-8724-e22a3c194947  10.27.221.181  0         worker,prometheus
25d833a2-a7da-450f-81a6-11ecd1ef4632  10.27.221.144  0         worker
94dfe46b-2326-46d5-8956-971a774af8d2  10.27.221.170  0         worker