apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
  name: inventory-scaled
  namespace: skills
spec:
  scaleTargetRef:
    name: inventory-deploy
  minReplicaCount: 2
  maxReplicaCount: 4
  pollingInterval: 15
  cooldownPeriod: 300
  advanced:
    horizontalPodAutoscalerConfig:
      behavior:
        scaleUp:
          stabilizationWindowSeconds: 0
          policies:
          - type: Pods
            value: 2
            periodSeconds: 15
        scaleDown:
          stabilizationWindowSeconds: 300
          policies:
          - type: Pods
            value: 1
            periodSeconds: 60
  triggers:
    - type: aws-cloudwatch
      metadata:
        namespace: AWS/ApplicationELB
        expression: SELECT SUM(RequestCount) FROM SCHEMA("AWS/ApplicationELB", LoadBalancer,TargetGroup) WHERE LoadBalancer = 'app/gmst-alb/3e1045f08c674294' AND TargetGroup = 'targetgroup/k8s-skills-inventor-3a21027477/c72db935e8058662'
        metricName: RequestCount
        targetMetricValue: '400'
        minMetricValue: '0'
        awsRegion: "ap-northeast-2"
        identityOwner: pod
        metricCollectionTime: '60'
        metricStat: Sum          
        metricStatPeriod: '60'
        metricUnit: Count
      authenticationRef:
        name: keda-trigger-auth-aws-credentials