Skip to content
This repository has been archived by the owner on Mar 31, 2023. It is now read-only.

[Scalability] Enable Horizontal Pod Autoscaler (HPA) for Alcor deployment #679

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions kubernetes/services/api-gateway.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ spec:
- image: api_gateway:v1.0
name: apimanager-web
imagePullPolicy: IfNotPresent
# The value is determined according to the actual situation, the following value is for the deployment on AWS
resources:
limits:
cpu: 500m
requests:
cpu: 200m
command: ["java", "-jar", "/app/AlcorApiGateway-0.1.0.jar", "--spring.config.location=/etc/api/application.properties"]
ports:
- containerPort: 8080
Expand Down
79 changes: 79 additions & 0 deletions kubernetes/services/api-gateway_hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: apimanager-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: apimanager
# if minReplicas is less than Deployment replicas value, it may cause scale down
minReplicas: 5
maxReplicas: 10
behavior:
scaleDown:
# Indicates that the stability window considers the expected state of the past (here within 300 sec) to prevent expansion and contraction
stabilizationWindowSeconds: 300
policies:
- type: Percent
value: 100
periodSeconds: 15
# The autoscaler will choose the strategy that affects the minimum number of Pods
selectPolicy: Min
scaleUp:
stabilizationWindowSeconds: 0
policies:
- type: Percent
value: 100
periodSeconds: 15
- type: Pods
value: 4
periodSeconds: 15
selectPolicy: Max
metrics:
# Set the average usage rate of the cpu, scale up if it exceeds 50
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 50
# The average data volume per second reaches 1000 for scaling up
# - type: Pods
# pods:
# metric:
# name: packets-per-second
# target:
# type: AverageValue
# averageValue: 1k

# The value is derived from Ingress "main-route", scale up when the number of requests per second in Ingress reaches 2000
# - type: Object
# object:
# metric:
# name: requests-per-second
# describedObject:
# apiVersion: networking.k8s.io/v1beta1
# kind: Ingress
# name: main-route
# target:
# kind: Value
# value: 10k

# HPA's current status data
status:
currentReplicas: 1
desiredReplicas: 1
conditions:
- status: "True"
type: "True"
# - type: Object
# object:
# metric:
# name: requests-per-second
# describedObject:
# apiVersion: networking.k8s.io/v1beta1
# kind: Ingress
# name: main-route
# current:
# value: 10k
14 changes: 14 additions & 0 deletions kubernetes/services/deleteYaml.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,58 +51,72 @@ if [[ "$OSTYPE" == "linux-gnu" ]]; then
kubectl delete configmap sg-configmap
kubectl delete services sgmanager-service
kubectl delete deployment sgmanager
kubectl delete hpa sgmanager-hpa

kubectl delete configmap vpc-configmap
kubectl delete services vpcmanager-service
kubectl delete deployment vpcmanager
kubectl delete hpa vpcmanager-hpa

kubectl delete configmap subnet-configmap
kubectl delete services subnetmanager-service
kubectl delete deployment subnetmanager
kubectl delete hpa subnetmanager-hpa

kubectl delete configmap route-configmap
kubectl delete services routemanager-service
kubectl delete deployment routemanager
kubectl delete hpa routemanager-hpa

kubectl delete configmap mac-configmap
kubectl delete services macmanager-service
kubectl delete deployment macmanager
kubectl delete hpa macmanager-hpa

kubectl delete configmap ip-configmap
kubectl delete services ipmanager-service
kubectl delete deployment ipmanager
kubectl delete hpa ipmanager-hpa

kubectl delete configmap port-configmap
kubectl delete services portmanager-service
kubectl delete deployment portmanager
kubectl delete hpa portmanager-hpa

kubectl delete configmap quota-configmap
kubectl delete services quotamanager-service
kubectl delete deployment quotamanager
kubectl delete hpa quotamanager-hpa

kubectl delete configmap node-configmap
kubectl delete services nodemanager-service
kubectl delete deployment nodemanager
kubectl delete hpa nodemanager-hpa

kubectl delete configmap api-configmap
kubectl delete services apimanager-service
kubectl delete deployment apimanager
kubectl delete hpa apimanager-hpa

kubectl delete configmap dpm-configmap
kubectl delete services dataplanemanager-service
kubectl delete deployment dataplanemanager
kubectl delete hpa dataplanemanager-hpa

kubectl delete configmap eip-configmap
kubectl delete services eipmanager-service
kubectl delete deployment eipmanager
kubectl delete hpa eipmanager-hpa

kubectl delete configmap ncm-configmap
kubectl delete services netwconfigmanager-service
kubectl delete deployment netwconfigmanager
kubectl delete hpa netwconfigmanager-hpa

kubectl delete configmap gateway-configmap
kubectl delete services gatewaymanager-service
kubectl delete deployment gatewaymanager
kubectl delete hpa gatewaymanager-hpa


elif [[ "$OSTYPE" == "darwin"* ]]; then
Expand Down
6 changes: 6 additions & 0 deletions kubernetes/services/dpm_manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ spec:
#- image: fwnetworking/controller:dpm_manager-v0.3.0
name: dataplanemanager-web
imagePullPolicy: IfNotPresent
# The value is determined according to the actual situation, the following value is for the deployment on AWS
resources:
limits:
cpu: 500m
requests:
cpu: 200m
command: ["java", "-jar", "/app/AlcorDataPlaneManager-0.1.0.jar", "--spring.config.location=/etc/dpm/application.properties"]
ports:
- containerPort: 8080
Expand Down
79 changes: 79 additions & 0 deletions kubernetes/services/dpm_manager_hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: dataplanemanager-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: dataplanemanager
# if minReplicas is less than Deployment replicas value, it may cause scale down
minReplicas: 5
maxReplicas: 10
behavior:
scaleDown:
# Indicates that the stability window considers the expected state of the past (here within 300 sec) to prevent expansion and contraction
stabilizationWindowSeconds: 300
policies:
- type: Percent
value: 100
periodSeconds: 15
# The autoscaler will choose the strategy that affects the minimum number of Pods
selectPolicy: Min
scaleUp:
stabilizationWindowSeconds: 0
policies:
- type: Percent
value: 100
periodSeconds: 15
- type: Pods
value: 4
periodSeconds: 15
selectPolicy: Max
metrics:
# Set the average usage rate of the cpu, scale up if it exceeds 50
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 50
# The average data volume per second reaches 1000 for scaling up
# - type: Pods
# pods:
# metric:
# name: packets-per-second
# target:
# type: AverageValue
# averageValue: 1k

# The value is derived from Ingress "main-route", scale up when the number of requests per second in Ingress reaches 2000
# - type: Object
# object:
# metric:
# name: requests-per-second
# describedObject:
# apiVersion: networking.k8s.io/v1beta1
# kind: Ingress
# name: main-route
# target:
# kind: Value
# value: 10k

# HPA's current status data
status:
currentReplicas: 1
desiredReplicas: 1
conditions:
- status: "True"
type: "True"
# - type: Object
# object:
# metric:
# name: requests-per-second
# describedObject:
# apiVersion: networking.k8s.io/v1beta1
# kind: Ingress
# name: main-route
# current:
# value: 10k
6 changes: 6 additions & 0 deletions kubernetes/services/elastic_ip_manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ spec:
#- image: fwnetworking/controller:mac_manager-v0.3.0
name: eipmanager-web
imagePullPolicy: IfNotPresent
# The value is determined according to the actual situation, the following value is for the deployment on AWS
resources:
limits:
cpu: 500m
requests:
cpu: 200m
command: ["java", "-jar", "/app/AlcorElasticIpManager-0.1.0.jar", "--spring.config.location=/etc/eip/application.properties"]
ports:
- containerPort: 8080
Expand Down
79 changes: 79 additions & 0 deletions kubernetes/services/elastic_ip_manager_hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
name: eipmanager-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: eipmanager
# if minReplicas is less than Deployment replicas value, it may cause scale down
minReplicas: 5
maxReplicas: 10
behavior:
scaleDown:
# Indicates that the stability window considers the expected state of the past (here within 300 sec) to prevent expansion and contraction
stabilizationWindowSeconds: 300
policies:
- type: Percent
value: 100
periodSeconds: 15
# The autoscaler will choose the strategy that affects the minimum number of Pods
selectPolicy: Min
scaleUp:
stabilizationWindowSeconds: 0
policies:
- type: Percent
value: 100
periodSeconds: 15
- type: Pods
value: 4
periodSeconds: 15
selectPolicy: Max
metrics:
# Set the average usage rate of the cpu, scale up if it exceeds 50
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 50
# The average data volume per second reaches 1000 for scaling up
# - type: Pods
# pods:
# metric:
# name: packets-per-second
# target:
# type: AverageValue
# averageValue: 1k

# The value is derived from Ingress "main-route", scale up when the number of requests per second in Ingress reaches 2000
# - type: Object
# object:
# metric:
# name: requests-per-second
# describedObject:
# apiVersion: networking.k8s.io/v1beta1
# kind: Ingress
# name: main-route
# target:
# kind: Value
# value: 10k

# HPA's current status data
status:
currentReplicas: 1
desiredReplicas: 1
conditions:
- status: "True"
type: "True"
# - type: Object
# object:
# metric:
# name: requests-per-second
# describedObject:
# apiVersion: networking.k8s.io/v1beta1
# kind: Ingress
# name: main-route
# current:
# value: 10k
6 changes: 6 additions & 0 deletions kubernetes/services/gateway_manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ spec:
#- image: fwnetworking/controller:gateway_manager-v0.3.0
name: gatewaymanager-web
imagePullPolicy: IfNotPresent
# The value is determined according to the actual situation, the following value is for the deployment on AWS
resources:
limits:
cpu: 500m
requests:
cpu: 200m
command: ["java", "-jar", "/app/AlcorGatewayManager-0.1.0.jar", "--spring.config.location=/etc/app/application.properties"]
ports:
- containerPort: 8080
Expand Down
Loading