apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
  name: open-prediction-scaledobject
spec:
  minReplicaCount: 1
  maxReplicaCount: 10
  pollingInterval: 300  
  cooldownPeriod:  5 
  #idleReplicaCount: 0
  scaleTargetRef:
    kind: Deployment
    name: ms-demo
  advanced:
    horizontalPodAutoscalerConfig:                   # Optional. Section to specify HPA related options
    #name: {name-of-hpa-resource}                   # Optional. Default: keda-hpa-{scaled-object-name}
      behavior:                                      # Optional. Use to modify HPA's scaling behavior
        scaleDown:
          stabilizationWindowSeconds: 30
          policies:
          - type: Percent
            value: 100
            periodSeconds: 30
  triggers:
   - type: open-prediction
     metadata:
       history: "1d"
       stepDuration: "1m"
       verticalWindow: "1"
       horizontalWindow: "4"
       predictionServiceAddress: "10.10.10.80:50051"
       prometheusAddress: http://prometheus-service.monitoring.svc:9090
       query: sum(rate(nginx_ingress_controller_requests{path='/demo/(.*)'}[1m]))
       threshold: '9'
       #activationThreshold: "0.025"
