<@U030PPM9T6C> terraform documentation (<see work ...
# pacc-jan-28-29-2025
b
@Dev Dasgupta terraform documentation (see work pool resource creation)
thank you 1
Here is how you can add a nodeSelector variable to your k8s work pool base job template. Define a template variable definition for
node_selector
trough the "Advanced" tab when creating/editing your work pool:
Copy code
"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:
Copy code
"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.