I have following autoscaler configuration:
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: pubsub
spec:
minReplicas: 1
maxReplicas: 5
metrics:
- external:
metricName: pubsub.googleapis.com|subscription|num_undelivered_messages
metricSelector:
matchLabels:
resource.labels.subscription_id: my-subscription-name
targetAverageValue: "2"
type: External
when I start my aplication I see following log event:
unable to get external metric my-namespace/pubsub.googleapis.com|subscription|num_undelivered_messages/&LabelSelector{MatchLabels:map[string]string{},MatchExpressions:[{resource.labels.subscription_id In [my-subscription]}],}: unable to fetch metrics from external metrics API: googleapi: Error 400: Field filter had an invalid value of "metric.type = "pubsub.googleapis.com/subscription/num_undelivered_messages" AND resource.labels.subscription_id = one_of("my-subscription")": Illegal function invocation in one_of(my-subscription); expected at least 2 arguments to one_of but got 1, badRequest
What could be wrong ? How correct it ?
P.S. It worked 2 days ago
It is became working after I added resource.type
metricSelector:
matchLabels:
resource.labels.subscription_id: my-subscription-name
resource.type: pubsub_subscription
looks like something was changed on GCP side