apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
  name: podinfo-scaledobject
  namespace: podinfo
  labels:
    deploymentName: podinfo
spec:
  maxReplicaCount: 2
  minReplicaCount: 0
  pollingInterval: 3 # Optional. Default: 30 seconds
  cooldownPeriod: 5 # Optional. Default: 300 seconds
  scaleTargetRef:
    name: podinfo
  triggers:
  - type: prometheus
    metadata:
      serverAddress: http://kube-prometheus-stack-prometheus.monitoring:9090
      metricName: nginx_ingress_controller_request_duration_seconds_count
      threshold: "0.5"
      query: max(irate(nginx_ingress_controller_request_duration_seconds_count{host="podinfo.home.wugi.info"}[5m]))
