Bianca Hoch
01/29/2025, 5:55 PMBianca Hoch
01/29/2025, 5:59 PMnode_selector
trough the "Advanced" tab when creating/editing your work pool:
"variables": {
"type": "object",
"properties": {
"node_selector": {
"type": "object",
"title": "Node Selector",
"description": "A selector which must be true for the pod to fit on a node. Selector which must match a node's labels for the pod to be scheduled on that node. More info: <https://kubernetes.io/docs/concepts/configuration/assign-pod-node/>"
},
... # other variables
Then create a nodeSelector
with the jinja template value in spec
part of the job manifest:
"spec": {
"containers": [
{
"env": "{{ env }}",
"args": "{{ command }}",
"name": "prefect-job",
"image": "{{ image }}",
"resources": "{{ resources }}",
"imagePullPolicy": "{{ image_pull_policy }}"
}
],
"completions": 1,
"parallelism": 1,
"nodeSelector": "{{ node_selector }}", # <--- added here
"restartPolicy": "Never",
"serviceAccountName": "{{ service_account_name }}"
}
Once you update template, the Node Selector
variable will appear on the "Defaults" page when you go to edit your work pool.