Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[web/task split] Add web and task replicas to the CRD #1227

Merged

Conversation

thedoubl3j
Copy link
Member

@thedoubl3j thedoubl3j commented Feb 8, 2023

SUMMARY

Add the ability to toggle replica count for web and task separately with web_replica task_replica or set the count as the same with replicas

Portion of #1182

ISSUE TYPE
  • New or Enhanced Feature
TESTING

The expectation of how the changes should work is that if desired, the user should be able to scale the numbers web and task replicas independently from each other or scale all replicas across all pods at the same rate.

test case 1: 1 task replica and 2 web replicas
CRD change:

  replicas: 1 
  web_replicas: 2

result

➜  awx-operator git:(add_replicas) ✗ kubectl get pods -w
NAME                                               READY   STATUS    RESTARTS   AGE
awx-operator-controller-manager-6ddd8c4bf7-bvnfq   2/2     Running   0          3m29s
awx-postgres-13-0                                  1/1     Running   0          4m21s
awx-task-9896478bd-qzwrc                           4/4     Running   0          4m22s
awx-web-56966cb4d5-bcbf6                           3/3     Running   0          12s
awx-web-56966cb4d5-hk78m                           3/3     Running   0          4m22s

test case 2: 2 task replicas and 1 web replica
CRD change:

  replicas: 1 
  task_replicas: 2

result

➜  awx-operator git:(add_replicas) ✗ kubectl get pods
NAME                                               READY   STATUS    RESTARTS   AGE
awx-operator-controller-manager-6ddd8c4bf7-bvnfq   2/2     Running   0          11m
awx-postgres-13-0                                  1/1     Running   0          12m
awx-task-9896478bd-mqs5d                           4/4     Running   0          15s
awx-task-9896478bd-qzwrc                           4/4     Running   0          12m
awx-web-56966cb4d5-hk78m                           3/3     Running   0          12m

test case 3: all replicas scaled to 3
CRD change:

  replicas: 3

result

➜  awx-operator git:(add_replicas) ✗ kubectl get pods
NAME                                               READY   STATUS    RESTARTS   AGE
awx-operator-controller-manager-6ddd8c4bf7-bvnfq   2/2     Running   0          17m
awx-postgres-13-0                                  1/1     Running   0          18m
awx-task-9896478bd-mqs5d                           4/4     Running   0          6m42s
awx-task-9896478bd-qzwrc                           4/4     Running   0          18m
awx-task-9896478bd-r9rjc                           4/4     Running   0          33s
awx-web-56966cb4d5-7dwr6                           3/3     Running   0          39s
awx-web-56966cb4d5-hk78m                           3/3     Running   0          18m
awx-web-56966cb4d5-mv6dk                           3/3     Running   0          39s

test case 4: set replicas to 0 to test default behavior
CRD change:

replicas: 0

result

➜  awx-operator git:(add_replicas) ✗ kubectl get pods
NAME                                               READY   STATUS    RESTARTS   AGE
awx-operator-controller-manager-697d47bcdb-x5bzb   2/2     Running   0          12m
awx-postgres-13-0                                  1/1     Running   0          8m27s
awx-task-9896478bd-g8h8k                           4/4     Running   0          7m41s
awx-web-56966cb4d5-5xk9w                           3/3     Running   0          8m7s

@thedoubl3j thedoubl3j requested review from relrod, jessicamack, TheRealHaoLiu and djyasin and removed request for relrod February 8, 2023 20:48
@TheRealHaoLiu
Copy link
Member

TheRealHaoLiu commented Feb 9, 2023

@thedoubl3j have you tested this?

replicas:
description: Number of instance replicas
type: integer
default: 1
format: int32
web_replicas:
description: Number of web instance replicas
type: integer
default: 1
format: int32
task_replicas:
description: Number of task instance replicas
type: integer
default: 1
format: int32

i dont think this would work since there's also default in the crd

which means that replicas will never have any effect

@thedoubl3j
Copy link
Member Author

@TheRealHaoLiu yes but I did it buy over riding the default and removing them. those have been removed by default

@thedoubl3j thedoubl3j requested a review from gamuniz February 9, 2023 20:04
@gamuniz
Copy link

gamuniz commented Feb 9, 2023

just for grins, did you also try passing the spec without any replicas?

@thedoubl3j
Copy link
Member Author

@gamuniz yes, default persisted and replicas remained at 1. the CRD does still reflect 0 but still have

➜  awx-operator git:(add_replicas) ✗ kubectl get pods
NAME                                               READY   STATUS    RESTARTS   AGE
awx-operator-controller-manager-697d47bcdb-x5bzb   2/2     Running   0          12m
awx-postgres-13-0                                  1/1     Running   0          8m27s
awx-task-9896478bd-g8h8k                           4/4     Running   0          7m41s
awx-web-56966cb4d5-5xk9w                           3/3     Running   0          8m7s

Copy link

@gamuniz gamuniz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@TheRealHaoLiu TheRealHaoLiu merged commit 1590c46 into ansible:feature_web-task-split Feb 9, 2023
@thedoubl3j thedoubl3j changed the title Add web and task replicas to the CRD [web/task split] Add web and task replicas to the CRD Feb 13, 2023
TheRealHaoLiu added a commit that referenced this pull request Mar 2, 2023
add web_replicas and task_replicas

Co-Authored-By: Jake Jackson  <[email protected]>
TheRealHaoLiu added a commit that referenced this pull request Mar 15, 2023
add web_replicas and task_replicas

Co-Authored-By: Jake Jackson  <[email protected]>
TheRealHaoLiu added a commit that referenced this pull request Mar 28, 2023
add web_replicas and task_replicas

Co-Authored-By: Jake Jackson  <[email protected]>
TheRealHaoLiu added a commit that referenced this pull request Mar 30, 2023
add web_replicas and task_replicas

Co-Authored-By: Jake Jackson  <[email protected]>
TheRealHaoLiu added a commit that referenced this pull request Mar 30, 2023
add web_replicas and task_replicas

Co-Authored-By: Jake Jackson  <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants