Skip to content

Commit 414069e

Browse files
committed
Add initial K8s web HPA.
1 parent ca56873 commit 414069e

File tree

4 files changed

+41
-0
lines changed

4 files changed

+41
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../web-hpa.yaml.erb
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../web-hpa.yaml.erb

config/deploy/web-hpa.yaml.erb

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
apiVersion: autoscaling/v2
2+
kind: HorizontalPodAutoscaler
3+
metadata:
4+
name: web-hpa
5+
labels:
6+
app: web
7+
environment: <%= environment %>
8+
spec:
9+
scaleTargetRef:
10+
apiVersion: apps/v1
11+
kind: Deployment
12+
name: web
13+
minReplicas: 3
14+
maxReplicas: 10
15+
metrics:
16+
- type: Resource
17+
resource:
18+
name: cpu
19+
target:
20+
type: Utilization
21+
averageUtilization: 75
22+
behavior:
23+
scaleDown:
24+
stabilizationWindowSeconds: 300
25+
policies:
26+
- type: Percent
27+
value: 50
28+
periodSeconds: 60
29+
scaleUp:
30+
stabilizationWindowSeconds: 60
31+
policies:
32+
- type: Percent
33+
value: 100
34+
periodSeconds: 60
35+
- type: Pods
36+
value: 2
37+
periodSeconds: 60
38+
selectPolicy: Max

config/deploy/web.yaml.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ metadata:
55
annotations:
66
shipit.shopify.io/restart: 'true'
77
spec:
8+
replicas: <%= environment == 'production' ? 3 : 2 %>
89
strategy:
910
type: RollingUpdate
1011
rollingUpdate:

0 commit comments

Comments
 (0)