Merge pull request #726 from Skaopap/feature_topology_constraints

Add topology constraints to AWX CRD
This commit is contained in:
Christian Adams
2022-01-13 21:16:23 -05:00
committed by GitHub
6 changed files with 40 additions and 8 deletions

View File

@@ -540,16 +540,18 @@ spec:
You can constrain the AWX pods created by the operator to run on a certain subset of nodes. `node_selector` and `postgres_selector` constrains You can constrain the AWX pods created by the operator to run on a certain subset of nodes. `node_selector` and `postgres_selector` constrains
the AWX pods to run only on the nodes that match all the specified key/value pairs. `tolerations` and `postgres_tolerations` allow the AWX the AWX pods to run only on the nodes that match all the specified key/value pairs. `tolerations` and `postgres_tolerations` allow the AWX
pods to be scheduled onto nodes with matching taints. pods to be scheduled onto nodes with matching taints.
The ability to specify topologySpreadConstraints is also allowed through `topology_spread_constraints`
| Name | Description | Default | | Name | Description | Default |
| -------------------------------| --------------------------- | ------- | | -------------------------------| ---------------------------------------- | ------- |
| postgres_image | Path of the image to pull | 12 | | postgres_image | Path of the image to pull | 12 |
| postgres_image_version | Image version to pull | 12 | | postgres_image_version | Image version to pull | 12 |
| node_selector | AWX pods' nodeSelector | '' | | node_selector | AWX pods' nodeSelector | '' |
| tolerations | AWX pods' tolerations | '' | | topology_spread_constraints | AWX pods' topologySpreadConstraints | '' |
| postgres_selector | Postgres pods' nodeSelector | '' | | tolerations | AWX pods' tolerations | '' |
| postgres_tolerations | Postgres pods' tolerations | '' | | postgres_selector | Postgres pods' nodeSelector | '' |
| postgres_tolerations | Postgres pods' tolerations | '' |
Example of customization could be: Example of customization could be:
@@ -561,6 +563,13 @@ spec:
disktype: ssd disktype: ssd
kubernetes.io/arch: amd64 kubernetes.io/arch: amd64
kubernetes.io/os: linux kubernetes.io/os: linux
topology_spread_constraints: |
- maxSkew: 100
topologyKey: "topology.kubernetes.io/zone"
whenUnsatisfiable: "ScheduleAnyway"
labelSelector:
matchLabels:
app.kubernetes.io/name: "<resourcename>"
tolerations: | tolerations: |
- key: "dedicated" - key: "dedicated"
operator: "Equal" operator: "Equal"

View File

@@ -134,6 +134,9 @@ spec:
node_selector: node_selector:
description: nodeSelector for the pods description: nodeSelector for the pods
type: string type: string
topology_spread_constraints:
description: topology rule(s) for the pods
type: string
service_labels: service_labels:
description: Additional labels to apply to the service description: Additional labels to apply to the service
type: string type: string

View File

@@ -511,6 +511,11 @@
x-descriptors: x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:advanced - urn:alm:descriptor:com.tectonic.ui:advanced
- urn:alm:descriptor:com.tectonic.ui:hidden - urn:alm:descriptor:com.tectonic.ui:hidden
- displayName: Topology Spread Constraints
path: topology_spread_constraints
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:advanced
- urn:alm:descriptor:com.tectonic.ui:hidden
- displayName: Service Labels - displayName: Service Labels
path: service_labels path: service_labels
x-descriptors: x-descriptors:

0
projects/.gitkeep Normal file → Executable file
View File

View File

@@ -64,6 +64,17 @@ hostname: ''
# kubernetes.io/os: linux # kubernetes.io/os: linux
node_selector: '' node_selector: ''
# Add a topologySpreadConstraints for the AWX pods.
# Specify as literal block. E.g.:
# topology_spread_constraints: |
# - maxSkew: 100
# topologyKey: "topology.kubernetes.io/zone"
# whenUnsatisfiable: "ScheduleAnyway"
# labelSelector:
# matchLabels:
# app.kubernetes.io/name: "<resourcename>"
topology_spread_constraints: ''
# Add node tolerations for the AWX pods. Specify as literal block. E.g.: # Add node tolerations for the AWX pods. Specify as literal block. E.g.:
# tolerations: | # tolerations: |
# - key: "dedicated" # - key: "dedicated"

View File

@@ -306,6 +306,10 @@ spec:
nodeSelector: nodeSelector:
{{ node_selector | indent(width=8) }} {{ node_selector | indent(width=8) }}
{% endif %} {% endif %}
{% if topology_spread_constraints %}
topologySpreadConstraints:
{{ topology_spread_constraints | indent(width=8) }}
{% endif %}
{% if tolerations %} {% if tolerations %}
tolerations: tolerations:
{{ tolerations | indent(width=8) }} {{ tolerations | indent(width=8) }}