apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: bookdash-web-hpa
  namespace: bookdash
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: bookdash-web
  minReplicas: 3
  maxReplicas: 50
  metrics:
    - type: Resource
      resource:
        name: cpu
        target:
          type: Utilization
          averageUtilization: 70
    - type: Resource
      resource:
        name: memory
        target:
          type: Utilization
          averageUtilization: 80
  behavior:
    scaleUp:
      stabilizationWindowSeconds: 60
      policies:
        - type: Percent
          value: 50
          periodSeconds: 60
    scaleDown:
      stabilizationWindowSeconds: 300
      policies:
        - type: Percent
          value: 25
          periodSeconds: 120
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
  name: bookdash-horizon-hpa
  namespace: bookdash
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: bookdash-horizon
  minReplicas: 1
  maxReplicas: 5
  metrics:
    - type: Resource
      resource:
        name: cpu
        target:
          type: Utilization
          averageUtilization: 80
