Skip to content

Commit

Permalink
#2383 - Horizontal Autoscaler from replication controller to deployme…
Browse files Browse the repository at this point in the history
…nt config (#2485)

- [x] Horizontal autoscaler target needs to be changed from Replication
controller to deployment config.
- [x] Apply the Horizontal autoscaler for the pods, change the
deploy.yaml and apply them during the deployments.

Without HPA not properly assigned

![image](https://github.com/bcgov/SIMS/assets/62901416/d7ff567b-ade9-40b9-aba6-190989efca73)

With HPA properly assigned

![image](https://github.com/bcgov/SIMS/assets/62901416/8850a0f5-7f4f-4ddd-a2fe-ae9dd845a446)

![image](https://github.com/bcgov/SIMS/assets/62901416/7311bd5d-8a8c-4eb1-9ec7-5f1ad6c52678)

Formio Load testing
WIth 2 pods it scaled up to 6 pods for 400 Vu

![image](https://github.com/bcgov/SIMS/assets/62901416/ccfd451b-93dd-4995-ba6f-92bb6147b68f)

![image](https://github.com/bcgov/SIMS/assets/62901416/1a71abba-38c8-41b5-8eb1-d355600ea057)

![image](https://github.com/bcgov/SIMS/assets/62901416/41169ed5-7abd-4aca-bed1-b8ad8d7c3b94)

With 6 pods running the same sets of load for 400 Vu

![image](https://github.com/bcgov/SIMS/assets/62901416/ccfd451b-93dd-4995-ba6f-92bb6147b68f)

![image](https://github.com/bcgov/SIMS/assets/62901416/88e6fc79-a97d-4b34-99a4-d8acef9e6ad0)

![image](https://github.com/bcgov/SIMS/assets/62901416/2999d6ff-49f4-42c0-b7dd-a3ddf00dc8f0)

With 6 pods running 300 Vu

![image](https://github.com/bcgov/SIMS/assets/62901416/b5cd961b-6463-47d6-baa1-1a2b81815295)

![image](https://github.com/bcgov/SIMS/assets/62901416/33fd9d48-221d-4325-b637-036b9daab424)

![image](https://github.com/bcgov/SIMS/assets/62901416/e88d0ee9-1b7a-41a8-b5a6-f66dfb5a140a)

With 6 pods running 200 Vu

![image](https://github.com/bcgov/SIMS/assets/62901416/da0b7087-1d61-4c45-8a50-4ce473b47c40)

![image](https://github.com/bcgov/SIMS/assets/62901416/b81725b7-b4b4-4d51-bf74-d134a0627dbc)

![image](https://github.com/bcgov/SIMS/assets/62901416/c9bf5cce-becf-4df1-b782-c775fa140b94)

With 6 pods running 100 Vu

![image](https://github.com/bcgov/SIMS/assets/62901416/1d2ab980-0c33-4a87-91a5-6586e70292b1)

![image](https://github.com/bcgov/SIMS/assets/62901416/f7a85be7-dc38-4a55-8406-8795e2d39ed0)

![image](https://github.com/bcgov/SIMS/assets/62901416/40d2e7b0-b866-4cc3-91d4-83cf875bfa5f)

With 2 pods running 100 Vu it started the 3rd pod

![image](https://github.com/bcgov/SIMS/assets/62901416/1d2ab980-0c33-4a87-91a5-6586e70292b1)

![image](https://github.com/bcgov/SIMS/assets/62901416/048a8e8f-1e08-4777-a714-216da35e19ba)

![image](https://github.com/bcgov/SIMS/assets/62901416/2791fe9f-5068-4f25-aa59-f1c93903f4b2)
  • Loading branch information
guru-aot authored Nov 15, 2023
1 parent d2d3cb4 commit 31e5983
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 22 deletions.
22 changes: 17 additions & 5 deletions devops/openshift/api-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -225,18 +225,30 @@ objects:
to:
kind: Service
name: ${NAME}
- apiVersion: autoscaling/v1
- apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: ${NAME}-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: ReplicationController
name: ${NAME}-rc
apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
name: ${NAME}
minReplicas: "${{REPLICAS}}"
maxReplicas: 10
targetCPUUtilizationPercentage: 80
metrics:
- type: Resource
resource:
name: cpu
target:
type: AverageValue
averageValue: "0.18"
- type: Resource
resource:
name: memory
target:
type: AverageValue
averageValue: "230M"
- apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
Expand Down
16 changes: 14 additions & 2 deletions devops/openshift/forms-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ objects:
termination: edge
insecureEdgeTerminationPolicy: Redirect
wildcardPolicy: None
- apiVersion: autoscaling/v1
- apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
labels:
Expand All @@ -170,7 +170,19 @@ objects:
name: ${NAME}
minReplicas: "${{REPLICAS}}"
maxReplicas: 6
targetCPUUtilizationPercentage: 50
metrics:
- type: Resource
resource:
name: cpu
target:
type: AverageValue
averageValue: "0.8"
- type: Resource
resource:
name: memory
target:
type: AverageValue
averageValue: "1Gi"
- apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
Expand Down
22 changes: 17 additions & 5 deletions devops/openshift/queue-consumers-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -236,18 +236,30 @@ objects:
to:
kind: Service
name: ${NAME}
- apiVersion: autoscaling/v1
- apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: ${NAME}-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: ReplicationController
name: ${NAME}-rc
apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
name: ${NAME}
minReplicas: "${{REPLICAS}}"
maxReplicas: 10
targetCPUUtilizationPercentage: 80
metrics:
- type: Resource
resource:
name: cpu
target:
type: AverageValue
averageValue: "0.18"
- type: Resource
resource:
name: memory
target:
type: AverageValue
averageValue: "230M"
- apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
Expand Down
22 changes: 17 additions & 5 deletions devops/openshift/web-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,30 @@ objects:
to:
kind: Service
name: ${NAME}
- apiVersion: autoscaling/v1
- apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: ${NAME}-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: ReplicationController
name: ${NAME}-rc
apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
name: ${NAME}
minReplicas: "${{REPLICAS}}"
maxReplicas: 10
targetCPUUtilizationPercentage: 80
metrics:
- type: Resource
resource:
name: cpu
target:
type: AverageValue
averageValue: "0.18"
- type: Resource
resource:
name: memory
target:
type: AverageValue
averageValue: "230M"
- apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
Expand Down
22 changes: 17 additions & 5 deletions devops/openshift/workers-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,30 @@ objects:
requests:
cpu: ${CPU_REQUEST}
memory: ${MEMORY_REQUEST}
- apiVersion: autoscaling/v1
- apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: ${NAME}-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: ReplicationController
name: ${NAME}-rc
apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
name: ${NAME}
minReplicas: "${{REPLICAS}}"
maxReplicas: 10
targetCPUUtilizationPercentage: 80
metrics:
- type: Resource
resource:
name: cpu
target:
type: AverageValue
averageValue: "0.18"
- type: Resource
resource:
name: memory
target:
type: AverageValue
averageValue: "230M"
- apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
Expand Down

0 comments on commit 31e5983

Please sign in to comment.