# hpa.yaml
apiVersion: autoscaling/v2beta2
kind: HorizontalPodAutoscaler
metadata:
  name: php-apache
spec:
  minReplicas: 3
  maxReplicas: 1000 # 10 # 
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: php-apache

  metrics:
  - type: Resource
    resource:
      name: cpu
      target:
        type: Utilization
        averageUtilization: 50

  # - type: Pods
  #   pods:
  #     metric:
  #       name: packets-per-second
  #     target:
  #       type: AverageValue
  #       averageValue: 1k

  # - type: Object
  #   object:
  #     metric:
  #       name: requests-per-second
  #     describedObject:
  #       apiVersion: networking.k8s.io/v1beta1
  #       kind: Ingress
  #       name: main-route
  #     target:
  #       type: Value
  #       value: 10k

  # - type: External
  #   external:
  #     metric:
  #       name: queue_messages_ready
  #       selector: "queue=worker_tasks"
  #     target:
  #       type: AverageValue
  #       averageValue: 30
