apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
  name: v1-ingress-requests
spec:
  scaleTargetRef:
    kind:          Deployment                       # Optional. Default: Deployment
    name:          ms-demo                          # Mandatory. Must be in the same namespace as the ScaledObject
  pollingInterval:  5                               # Optional. Default: 30 seconds
  cooldownPeriod:   15                              # Optional. Default: 300 seconds
  minReplicaCount:  1                               # Optional. Default: 0
  maxReplicaCount:  5                               # Optional. Default: 100
  triggers:
    - type: prometheus
      metadata:
        serverAddress: http://prometheus-service.monitoring.svc:9090
        metricName: nginx_ingress_controller_nginx_process_requests_total
        threshold: '5'
        query: sum(rate(nginx_ingress_controller_requests{path="/fib"}[2m]))