From c1bbd85ea948f07c30f2207f5a7ca932b131bf54 Mon Sep 17 00:00:00 2001 From: Jake Jackson Date: Mon, 6 Feb 2023 16:44:17 -0500 Subject: [PATCH] add nodeSelector work (#1219) --- config/crd/bases/awx.ansible.com_awxs.yaml | 6 ++++++ roles/installer/defaults/main.yml | 16 ++++++++++++++++ .../installer/templates/deployments/task.yaml.j2 | 5 ++++- .../installer/templates/deployments/web.yaml.j2 | 7 +++++++ 4 files changed, 33 insertions(+), 1 deletion(-) diff --git a/config/crd/bases/awx.ansible.com_awxs.yaml b/config/crd/bases/awx.ansible.com_awxs.yaml index 53e3a5eb..c44143e2 100644 --- a/config/crd/bases/awx.ansible.com_awxs.yaml +++ b/config/crd/bases/awx.ansible.com_awxs.yaml @@ -160,6 +160,12 @@ spec: node_selector: description: nodeSelector for the pods type: string + web_node_selector: + description: nodeSelector for the web pods + type: string + task_node_selector: + description: nodeSelector for the task pods + type: string topology_spread_constraints: description: topology rule(s) for the pods type: string diff --git a/roles/installer/defaults/main.yml b/roles/installer/defaults/main.yml index 12107f25..f8620d71 100644 --- a/roles/installer/defaults/main.yml +++ b/roles/installer/defaults/main.yml @@ -72,6 +72,22 @@ hostname: '' # kubernetes.io/os: linux node_selector: '' +# Add a nodeSelector for the AWX pods. It must match a node's labels for the pod +# to be scheduled on that node. Specify as literal block. E.g.: +# node_selector: | +# disktype: ssd +# kubernetes.io/arch: amd64 +# kubernetes.io/os: linux +web_node_selector: '' + +# Add a nodeSelector for the AWX pods. It must match a node's labels for the pod +# to be scheduled on that node. Specify as literal block. E.g.: +# node_selector: | +# disktype: ssd +# kubernetes.io/arch: amd64 +# kubernetes.io/os: linux +task_node_selector: '' + # Add a topologySpreadConstraints for the AWX pods. # Specify as literal block. E.g.: # topology_spread_constraints: | diff --git a/roles/installer/templates/deployments/task.yaml.j2 b/roles/installer/templates/deployments/task.yaml.j2 index a17c7480..fa5f96bc 100644 --- a/roles/installer/templates/deployments/task.yaml.j2 +++ b/roles/installer/templates/deployments/task.yaml.j2 @@ -360,7 +360,10 @@ spec: - name: AWX_KUBE_DEVEL value: "1" {% endif %} -{% if node_selector %} +{% if task_node_selector %} + nodeSelector: + {{ task_node_selector | indent(width=8) }} +{% elif node_selector %} nodeSelector: {{ node_selector | indent(width=8) }} {% endif %} diff --git a/roles/installer/templates/deployments/web.yaml.j2 b/roles/installer/templates/deployments/web.yaml.j2 index 9ba84c89..2d05552b 100644 --- a/roles/installer/templates/deployments/web.yaml.j2 +++ b/roles/installer/templates/deployments/web.yaml.j2 @@ -223,6 +223,13 @@ spec: - name: AWX_KUBE_DEVEL value: "1" {% endif %} +{% if web_node_selector %} + nodeSelector: + {{ web_node_selector | indent(width=8) }} +{% elif node_selector %} + nodeSelector: + {{ node_selector | indent(width=8) }} +{% endif %} {% if web_tolerations %} tolerations: {{ web_tolerations| indent(width=8) }}