diff --git a/config/crd/bases/awx.ansible.com_awxs.yaml b/config/crd/bases/awx.ansible.com_awxs.yaml index 31e92c4f7..89e4fc1cb 100644 --- a/config/crd/bases/awx.ansible.com_awxs.yaml +++ b/config/crd/bases/awx.ansible.com_awxs.yaml @@ -165,6 +165,12 @@ spec: topology_spread_constraints: description: topology rule(s) for the pods type: string + task_topology_spread_constraints: + description: topology rule(s) for the task pods + type: string + web_topology_spread_constraints: + description: topology rule(s) for the web pods + type: string annotations: description: annotations for the pods type: string diff --git a/roles/installer/defaults/main.yml b/roles/installer/defaults/main.yml index e5a3ff12f..a6d5656d0 100644 --- a/roles/installer/defaults/main.yml +++ b/roles/installer/defaults/main.yml @@ -99,6 +99,28 @@ task_node_selector: '' # app.kubernetes.io/name: "" topology_spread_constraints: '' +# Add a topologySpreadConstraints for the task pods. +# Specify as literal block. E.g.: +# task_topology_spread_constraints: | +# - maxSkew: 100 +# topologyKey: "topology.kubernetes.io/zone" +# whenUnsatisfiable: "ScheduleAnyway" +# labelSelector: +# matchLabels: +# app.kubernetes.io/name: """ +task_topology_spread_constraints: '' + +# Add a topologySpreadConstraints for the web pods. +# Specify as literal block. E.g.: +# web_topology_spread_constraints: | +# - maxSkew: 100 +# topologyKey: "topology.kubernetes.io/zone" +# whenUnsatisfiable: "ScheduleAnyway" +# labelSelector: +# matchLabels: +# app.kubernetes.io/name: "" +web_topology_spread_constraints: '' + # Add node tolerations for the AWX pods. Specify as literal block. E.g.: # tolerations: | # - key: "dedicated" diff --git a/roles/installer/templates/deployments/task.yaml.j2 b/roles/installer/templates/deployments/task.yaml.j2 index 509b9592c..66338e276 100644 --- a/roles/installer/templates/deployments/task.yaml.j2 +++ b/roles/installer/templates/deployments/task.yaml.j2 @@ -372,7 +372,10 @@ spec: nodeSelector: {{ node_selector | indent(width=8) }} {% endif %} -{% if topology_spread_constraints %} +{% if task_topology_spread_constraints %} + topologySpreadConstraints: + {{ task_topology_spread_constraints | indent(width=8) }} +{% elif topology_spread_constraints %} topologySpreadConstraints: {{ topology_spread_constraints | indent(width=8) }} {% endif %} diff --git a/roles/installer/templates/deployments/web.yaml.j2 b/roles/installer/templates/deployments/web.yaml.j2 index 855861cd0..eaa19082a 100644 --- a/roles/installer/templates/deployments/web.yaml.j2 +++ b/roles/installer/templates/deployments/web.yaml.j2 @@ -234,6 +234,13 @@ spec: nodeSelector: {{ node_selector | indent(width=8) }} {% endif %} +{% if web_topology_spread_constraints %} + topologySpreadConstraints: + {{ web_topology_spread_constraints | indent(width=8) }} +{% elif topology_spread_constraints %} + topologySpreadConstraints: + {{ topology_spread_constraints | indent(width=8) }} +{% endif %} {% if web_tolerations %} tolerations: {{ web_tolerations| indent(width=8) }}