apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
  name: v1-ingress-throughput
spec:
  scaleTargetRef:
    kind: Deployment                       # Optional. Default: Deployment
    name: hello-world-two                  # Mandatory. Must be in the same namespace as the ScaledObject
  pollingInterval: 300                              # Optional. Default: 30 seconds
  cooldownPeriod:   5                              # Optional. Default: 300 seconds
  minReplicaCount:  1                               # Optional. Default: 0
  #idleReplicaCount: 0
  maxReplicaCount:  10                               # Optional. Default: 100
  advanced:
     horizontalPodAutoscalerConfig:                   # Optional. Secti    on to specify HPA related options
     #name: {name-of-hpa-resource}                   # Optional. Defaul    t: keda-hpa-{scaled-object-name}
        behavior:                                      # Optional. Use t    o modify HPA's scaling behavior
           scaleDown:
              stabilizationWindowSeconds: 30
              policies:
              - type: Percent
                value: 100
                periodSeconds: 30

  triggers:
    - type: prometheus
      metadata:
        serverAddress: http://prometheus-service.monitoring.svc:9090
        metricName: nginx_ingress_controller_requests
        threshold: '9'
        query: sum(rate(nginx_ingress_controller_requests{path="/hello/(.*)"}[1m]))
        # activationThreshold: "0.025"

