apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
  name: leaflet-hpa
spec:
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: leaflet
  minReplicas: 1
  maxReplicas: 7
  behavior:
    scaleUp:
      policies:
      - type: Pods
        value: 1
        periodSeconds: 480
  metrics:
  - type: Object
    object:
      metric:
        name: connected_clients_by_pod
      describedObject:
        apiVersion: /v1
        kind: Service
        name: leaflet
      target:
        type: Value
        value: 75
  - type: Object
    object:
      metric:
        name: rpc_calls_last_minute_by_pod
      describedObject:
        apiVersion: /v1
        kind: Service
        name: leaflet
      target:
        type: Value
        value: 12
  - type: Resource
    resource:
      name: cpu
      target:
        type: Utilization
        averageUtilization: 70
  - type: Resource
    resource:
      name: memory
      target:
        type: Utilization
        averageUtilization: 80