diff --git a/config/crd/bases/awx.ansible.com_awxs.yaml b/config/crd/bases/awx.ansible.com_awxs.yaml index e3387b26e..7c51aa8fc 100644 --- a/config/crd/bases/awx.ansible.com_awxs.yaml +++ b/config/crd/bases/awx.ansible.com_awxs.yaml @@ -1567,10 +1567,18 @@ spec: description: Number of web instance replicas type: integer format: int32 + web_unmanage_replicas: + description: Disables operator control of replica count for the web deployment when set to 'true' + type: boolean + default: false task_replicas: description: Number of task instance replicas type: integer format: int32 + task_unmanage_replicas: + description: Disables operator control of replica count for the task deployment when set to 'true' + type: boolean + default: false garbage_collect_secrets: description: Whether or not to remove secrets upon instance removal default: false diff --git a/docs/user-guide/advanced-configuration/horizontal-pod-autoscaler.md b/docs/user-guide/advanced-configuration/horizontal-pod-autoscaler.md new file mode 100644 index 000000000..f5470f6a5 --- /dev/null +++ b/docs/user-guide/advanced-configuration/horizontal-pod-autoscaler.md @@ -0,0 +1,30 @@ +### Horizontal Pod Autoscaler (HPA) + +Horizontal Pod Autoscaler allows Kubernetes to scale the number of replicas of +deployments in response to configured metrics. + +This feature conflicts with the operators ability to manage the number of static +replicas to create for each deployment. + +The use of the settings below will tell the operator to not manage the replicas +field on the identified deployments even if a replicas count has been set for those +properties in the operator resource. + + +| Name | Description | Default | +| -----------------------| ----------------------------------------- | ------- | +| web_unmanage_replicas | Disables operator control of replica | false | +| | count for the web deployment when set | | +| | to 'true' | | +| task_unmanage_replicas | Disables operator control of replica | false | +| | count for the task deployment when set | | +| | to 'true' | | + + +#### Recommended Settings for HPA + +Please see the Kubernetes documentation on how to configure the horizontal pod +autoscaler. + +The values for optimal HPA are cluster and need specific so general guidelines +are not available at this time. diff --git a/docs/user-guide/advanced-configuration/scaling-the-web-and-task-pods-independently.md b/docs/user-guide/advanced-configuration/scaling-the-web-and-task-pods-independently.md index 1dc9c3440..37b7f9416 100644 --- a/docs/user-guide/advanced-configuration/scaling-the-web-and-task-pods-independently.md +++ b/docs/user-guide/advanced-configuration/scaling-the-web-and-task-pods-independently.md @@ -1,8 +1,13 @@ -#### Scaling the Web and Task Pods independently +#### Scaling the Web and Task Pods independently You can scale replicas up or down for each deployment by using the `web_replicas` or `task_replicas` respectively. You can scale all pods across both deployments by using `replicas` as well. The logic behind these CRD keys acts as such: -- If you specify the `replicas` field, the key passed will scale both the `web` and `task` replicas to the same number. +- If you specify the `replicas` field, the key passed will scale both the `web` and `task` replicas to the same number. - If `web_replicas` or `task_replicas` is ever passed, it will override the existing `replicas` field on the specific deployment with the new key value. -These new replicas can be constrained in a similar manner to previous single deployments by appending the particular deployment name in front of the constraint used. More about those new constraints can be found in the [Assigning AWX pods to specific nodes](./assigning-awx-pods-to-specific-nodes.md) page. +These new replicas can be constrained in a similar manner to previous single deployments by appending the particular deployment name in front of the constraint used. More about those new constraints can be found in the [Assigning AWX pods to specific nodes](./assigning-awx-pods-to-specific-nodes.md) page. + +##### Horizontal Pod Autoscaling + +The operator is capable of working with Kubernete's HPA capabilities. See [Horizontal Pod Autoscaler](./horizontal-pod-autoscaler.md) +documentation for more information. \ No newline at end of file diff --git a/roles/installer/templates/deployments/task.yaml.j2 b/roles/installer/templates/deployments/task.yaml.j2 index cb57fbd13..81b28bee8 100644 --- a/roles/installer/templates/deployments/task.yaml.j2 +++ b/roles/installer/templates/deployments/task.yaml.j2 @@ -8,9 +8,9 @@ metadata: {{ lookup("template", "../common/templates/labels/common.yaml.j2") | indent(width=4) | trim }} {{ lookup("template", "../common/templates/labels/version.yaml.j2") | indent(width=4) | trim }} spec: -{% if task_replicas != '' %} +{% if task_replicas != '' and task_unmanage_replicas is not true %} replicas: {{ task_replicas }} -{% elif replicas != '' %} +{% elif replicas != '' and task_unmanage_replicas is not true %} replicas: {{ replicas }} {% endif %} selector: diff --git a/roles/installer/templates/deployments/web.yaml.j2 b/roles/installer/templates/deployments/web.yaml.j2 index 1a7318348..63e904fc9 100644 --- a/roles/installer/templates/deployments/web.yaml.j2 +++ b/roles/installer/templates/deployments/web.yaml.j2 @@ -9,9 +9,9 @@ metadata: {{ lookup("template", "../common/templates/labels/common.yaml.j2") | indent(width=4) | trim }} {{ lookup("template", "../common/templates/labels/version.yaml.j2") | indent(width=4) | trim }} spec: -{% if web_replicas != '' %} +{% if web_replicas != '' and web_unmanage_replicas is not true %} replicas: {{ web_replicas }} -{% elif replicas != '' %} +{% elif replicas != '' and web_unmanage_replicas is not true %} replicas: {{ replicas }} {% endif %} selector: