diff --git a/config/deploy/production/web-hpa.yaml.erb b/config/deploy/production/web-hpa.yaml.erb new file mode 120000 index 00000000000..f5f3c200bcf --- /dev/null +++ b/config/deploy/production/web-hpa.yaml.erb @@ -0,0 +1 @@ +../web-hpa.yaml.erb \ No newline at end of file diff --git a/config/deploy/staging/web-hpa.yaml.erb b/config/deploy/staging/web-hpa.yaml.erb new file mode 120000 index 00000000000..f5f3c200bcf --- /dev/null +++ b/config/deploy/staging/web-hpa.yaml.erb @@ -0,0 +1 @@ +../web-hpa.yaml.erb \ No newline at end of file diff --git a/config/deploy/web-hpa.yaml.erb b/config/deploy/web-hpa.yaml.erb new file mode 100644 index 00000000000..d9def7fc6f8 --- /dev/null +++ b/config/deploy/web-hpa.yaml.erb @@ -0,0 +1,38 @@ +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: web-hpa + labels: + app: web + environment: <%= environment %> +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: web + minReplicas: <%= environment == 'production' ? 3 : 2 %> + maxReplicas: <%= environment == 'production' ? 10 : 5 %> + metrics: + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: 75 + behavior: + scaleDown: + stabilizationWindowSeconds: 300 + policies: + - type: Percent + value: 50 + periodSeconds: 60 + scaleUp: + stabilizationWindowSeconds: 60 + policies: + - type: Percent + value: 100 + periodSeconds: 60 + - type: Pods + value: 2 + periodSeconds: 60 + selectPolicy: Max diff --git a/config/deploy/web.yaml.erb b/config/deploy/web.yaml.erb index 3c81247120f..3c839a790d2 100644 --- a/config/deploy/web.yaml.erb +++ b/config/deploy/web.yaml.erb @@ -5,6 +5,7 @@ metadata: annotations: shipit.shopify.io/restart: 'true' spec: + replicas: <%= environment == 'production' ? 3 : 2 %> strategy: type: RollingUpdate rollingUpdate: