Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with GCP PubSub scaledObject #5093

Closed
JorTurFer opened this issue Oct 18, 2023 Discussed in #4751 · 4 comments · Fixed by #5099
Closed

Issue with GCP PubSub scaledObject #5093

JorTurFer opened this issue Oct 18, 2023 Discussed in #4751 · 4 comments · Fixed by #5099

Comments

@JorTurFer
Copy link
Member

Discussed in #4751

Originally posted by raghu-manne June 29, 2023
I am trying to test out keda with GCP pubsub andd the getting below error. Any insights where am i doing wrong?
2023-06-29T11:26:13Z ERROR Reconciler error {"controller": "scaledobject", "controllerGroup": "keda.sh", "controllerKind": "ScaledObject", "ScaledObject": {"name":"test","namespace":"default"}, "namespace": "default", "name": "test", "reconcileID": "5b54cc98-02bf-4dea-a270-125a70a957b5", "error": "HorizontalPodAutoscaler.autoscaling \"keda-hpa-test\" is invalid: spec.metrics[0].external.target.averageValue: Invalid value: resource.Quantity{i:resource.int64Amount{value:0, scale:0}, d:resource.infDecAmount{Dec:(*inf.Dec)(nil)}, s:\"0\", Format:\"DecimalSI\"}: must be positive"}
My scaledobject looks like this

apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
  name: pubsub-test
  namespace: default
spec:
  scaleTargetRef:
    name: consume-pubsub-messages #Target Workload Name
  triggers:
  - type: gcp-pubsub
    authenticationRef:
      name: test
    metadata:
      subscriptionName: "keda-test-subscription" # Required

Scaledobject events says this

Events:
  Type     Reason                   Age                    From           Message
  ----     ------                   ----                   ----           -------
  Warning  ScaledObjectCheckFailed  2m6s (x16 over 4m50s)  keda-operator  failed to ensure HPA is correctly created for ScaledObject
```</div>
@JorTurFer
Copy link
Member Author

I think that the solution in the code is just adding the default value during meta initializtion here:

func parsePubSubMetadata(config *ScalerConfig, logger logr.Logger) (*pubsubMetadata, error) {
// set subscription size to the default mode
meta := pubsubMetadata{mode: pubSubModeSubscriptionSize}
mode, modePresent := config.TriggerMetadata["mode"]
value, valuePresent := config.TriggerMetadata["value"]

jimgus added a commit to jimgus/keda that referenced this issue Oct 19, 2023
@tomkerkhove tomkerkhove moved this from To Triage to To Do in Roadmap - KEDA Core Oct 26, 2023
jimgus added a commit to jimgus/keda that referenced this issue Nov 1, 2023
@github-project-automation github-project-automation bot moved this from To Do to Ready To Ship in Roadmap - KEDA Core Nov 21, 2023
yoongon pushed a commit to yoongon/keda that referenced this issue Nov 24, 2023
@raghu-manne
Copy link

@JorTurFer I could see this has been fixed but i am getting the same error when i tried.

Events:
  Type     Reason                   Age                  From           Message
  ----     ------                   ----                 ----           -------
  Normal   KEDAScalersStarted       27m                  keda-operator  Scaler gcp-pubsub is built.
  Warning  ScaledObjectCheckFailed  6m1s (x19 over 27m)  keda-operator  failed to ensure HPA is correctly created for ScaledObject
k get apiservices.apiregistration.k8s.io

v1beta1.external.metrics.k8s.io        keda/keda-operator-metrics-apiserver   True        33m
v1beta1.metrics.k8s.io                 kube-system/metrics-server             True        36m
operator logs:

2023-12-09T13:03:46Z	ERROR	Reconciler error	{"controller": "scaledobject", "controllerGroup": "keda.sh", "controllerKind": "ScaledObject", "ScaledObject": {"name":"pubsub-test","namespace":"default"}, "namespace":  "default", "name": "pubsub-test", "reconcileID": "29855436-fd09-4aa3-ba95-626896b36e93", "error": "HorizontalPodAutoscaler.autoscaling \"keda-hpa-pubsub-test\" is invalid: spec.metrics[0].external.target.averageValue: Invalid value: resource.Quantity{i:resource.int64Amount{value:0, scale:0}, d:resource.infDecAmount{Dec:(*inf.Dec)(nil)}, s:\"0\", Format:\"DecimalSI\"}: must be positive"}

@JorTurFer
Copy link
Member Author

@JorTurFer I could see this has been fixed but i am getting the same error when i tried.

The fix is solved because the PR is merged, but it hasn't been released yet. You can check the first release where the PR is included, checking the PR directly:
image

And this other PR has a fix already released:
image

You can expect this fix released on Jan release

@raghu-manne
Copy link

Thanks for the information!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants