apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
  name: sbe-worker-face
spec:
  minReplicas: 1
  maxReplicas: 2
  metrics:
  - type: Resource
    resource:
      name: cpu
      targetAverageUtilization: 100      
  - external:
      metricName: pubsub.googleapis.com|subscription|num_undelivered_messages
      metricSelector:
        matchLabels:
          resource.labels.subscription_id: face-recognition
      targetAverageValue: "500"
    type: External
  scaleTargetRef:
    apiVersion: apps/v1
    kind: Deployment
    name: sbe-worker-face