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

RabbitMQ api hosted in a subpath is truncated to http://host/api/ when it shouldbe http://host/subpath/api #2634

Closed
ovidiubuligan opened this issue Feb 14, 2022 · 11 comments · Fixed by #4584
Labels
bug Something isn't working

Comments

@ovidiubuligan
Copy link

ovidiubuligan commented Feb 14, 2022

Report

We are hosting rabbitmq with a subpath due to ingress exposed as a subpath .We do it with the following setting :

  management.path_prefix = /rabbit

in bitnami helm chart :

extraConfiguration: |-
  management.path_prefix = /rabbit

This causes the api to also be hosted at http://host/rabbit/api

Problem is this resset of Path parsedURL.Path = "" here : https://github.com/kedacore/keda/blob/v2.6.1/pkg/scalers/rabbitmq_scaler.go#L426

We are using this configuration in keda ScaledSecret :

  triggers:
  - type: rabbitmq
    metadata:
      host: http://user:pass@rabbitmq.rabbitmq.svc.cluster.local:15672/rabbit/
      mode: MessageRate
      protocol: auto
      queueName: My-queue
      value: "1"
      vhostName: /

Expected Behavior

Setting the host path is preserved and not truncated.

Actual Behavior

rabbitmq http subpath is truncated

Steps to Reproduce the Problem

  1. Install https://bitnami.com/stack/rabbitmq/helm with this configuration
extraConfiguration: |-
  management.path_prefix = /rabbit
  1. configure keda with rabbitmq MessageRate

Logs from KEDA operator

keda operator logs

github.com/kedacore/keda/v2/pkg/scaling.(*scaleHandler).startScaleLoop                                                                                   │
github.com/kedacore/keda/v2/pkg/scaling.(*scaleHandler).startScaleLoop
        /workspace/pkg/scaling/scale_handler.go:149
1.6448533659252813e+09  ERROR   scalehandler    Error getting scale decision    {"scaledobject.Name": "vbc-vbs-scaledobject", "scaledObject.Namespace": "dev", "scaleTarget.Name": "vbc-vbs-contrib", "error": "error inspecting rabbitMQ: error requesting rabbitMQ API status: 404 Not Found, response: {\"error\":\"Object Not Found\",\"reason\":\"Not Found\"}, from: http://user:password@rabbitmq.rabbitmq.svc.cluster.local:15672/api/queues/%!F(MISSING)/VBUS-req-queue"}
github.com/kedacore/keda/v2/pkg/scaling.(*scaleHandler).checkScalers
        /workspace/pkg/scaling/scale_handler.go:278
github.com/kedacore/keda/v2/pkg/scaling.(*scaleHandler).startScaleLoop
        /workspace/pkg/scaling/scale_handler.go:149
1.6448533959287195e+09  ERROR   scalehandler    Error getting scale decision    {"scaledobject.Name": "vbc-vbs-scaledobject", "scaledObject.Namespace": "dev", "scaleTarget.Name": "vbc-vbs-contrib", "error": "error inspecting rabbitMQ: error requesting rabbitMQ API status: 404 Not Found, response: {\"error\":\"Object Not Found\",\"reason\":\"Not Found\"}, from: http://user:password@rabbitmq.rabbitmq.svc.cluster.local:15672/api/queues/%!F(MISSING)/VBUS-req-queue"}
github.com/kedacore/keda/v2/pkg/scaling.(*scaleHandler).checkScalers
        /workspace/pkg/scaling/scale_handler.go:278
github.com/kedacore/keda/v2/pkg/scaling.(*scaleHandler).startScaleLoop
        /workspace/pkg/scaling/scale_handler.go:149

keda operator metrics pod logs:

E0214 15:44:00.029030       1 provider.go:124] keda_metrics_adapter/provider "msg"="error getting metric for scaler" "error"="error inspecting rabbitMQ: error requesting rabbitMQ API status: 404 Not Found, response: {\"error\":\"Object Not Found\",\"reason\":\"Not Found\"}, from: http://user:password@rabbitmq.rabbitmq.svc.cluster.local:15672/api/queues/%!F(MISSING)/VBUS-req-queue"  "scaledObject.Name"="vbc-vbs-scaledobject" "scaledObject.Namespace"="dev" "scaler"={}
E0214 15:44:00.029088       1 status.go:71] apiserver received an error that is not an metav1.Status: &errors.errorString{s:"no matching metrics found for s0-rabbitmq-vbus-req-queue"}: no matching metrics found for s0-rabbitmq-vbus-req-queue
E0214 15:44:15.052886       1 provider.go:124] keda_metrics_adapter/provider "msg"="error getting metric for scaler" "error"="error inspecting rabbitMQ: error requesting rabbitMQ API status: 404 Not Found, response: {\"error\":\"Object Not Found\",\"reason\":\"Not Found\"}, from: http://user:password@rabbitmq.rabbitmq.svc.cluster.local:15672/api/queues/%!F(MISSING)/VBUS-req-queue"  "scaledObject.Name"="vbc-vbs-scaledobject" "scaledObject.Namespace"="dev" "scaler"={}
E0214 15:44:15.052967       1 status.go:71] apiserver received an error that is not an metav1.Status: &errors.errorString{s:"no matching metrics found for s0-rabbitmq-vbus-req-queue"}: no matching metrics found for s0-rabbitmq-vbus-req-queue

ScaledObject k8s event message :

error inspecting rabbitMQ: error requesting rabbitMQ API status: 404 Not Found, response: {"error":"Object Not Found","reason":"Not ││  Found"}, from: http://user:password@rabbitmq.rabbitmq.svc.cluster.local:15672/api/queues/%!F(MISSING)/My-queue 

From the message we can clearly see that rabbit subpath is truncated

KEDA Version

2.6.1

Kubernetes Version

1.22

Platform

Microsoft Azure

Scaler Details

RabbitMQ

Anything else?

No response

@ovidiubuligan ovidiubuligan added the bug Something isn't working label Feb 14, 2022
@tomkerkhove tomkerkhove moved this to Proposed in Roadmap - KEDA Core Feb 14, 2022
@rtnpro
Copy link
Contributor

rtnpro commented Mar 4, 2022

I am triaging this issue.

@stale
Copy link

stale bot commented May 3, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale All issues that are marked as stale due to inactivity label May 3, 2022
@stale
Copy link

stale bot commented May 10, 2022

This issue has been automatically closed due to inactivity.

@stale stale bot closed this as completed May 10, 2022
Repository owner moved this from Proposed to Ready To Ship in Roadmap - KEDA Core May 10, 2022
@tomkerkhove tomkerkhove moved this from Ready To Ship to Done in Roadmap - KEDA Core Aug 3, 2022
@shcherbak
Copy link

shcherbak commented May 17, 2023

@rtnpro @tomasgiden @ovidiubuligan the error persists
can we reopen this?
KEDA 2.9.2

@rtnpro
Copy link
Contributor

rtnpro commented May 24, 2023

@shcherbak Thanks for bringing this up.

@tomkerkhove @tomasgiden @ovidiubuligan I confirm that this issue still persists. I am working on a fix for it. Please reopen this issue.

@zroubalik zroubalik reopened this May 24, 2023
@github-project-automation github-project-automation bot moved this from Done to Proposed in Roadmap - KEDA Core May 24, 2023
@stale stale bot removed the stale All issues that are marked as stale due to inactivity label May 24, 2023
@rtnpro
Copy link
Contributor

rtnpro commented Jun 6, 2023

Great job on #4584, @AmorBielyi!

I wanted to express my support for the idea of including a separate boolean option to enable a subpath in the host value of the RabbitMQ scaler. However, I believe it might introduce some complexity to the current parsing of the RabbitMQ host path. I'm curious to know how you plan to handle situations where both vhost and subpath are specified in the host URL while allowSubpathsOnHost is set to True. In my recent approach in #4589, I utilized string operations to extract the subpath and vhost from the host path.

I strongly believe that we should carefully consider the developer experience (DX) when configuring the RabbitMQ Scaler and strive to minimize any potential confusion.

In my opinion, we have two possible approaches: either parse the host path URI to retrieve the subpath, vhost, and other necessary details, or alternatively, disallow the specification of vhost in the host path altogether and utilize the vhost scaler metadata instead.

@zroubalik @JorTurFer WDYT?

@AmorBielyi
Copy link
Contributor

AmorBielyi commented Jun 7, 2023

Great job on #4584, @AmorBielyi!

I wanted to express my support for the idea of including a separate boolean option to enable a subpath in the host value of the RabbitMQ scaler. However, I believe it might introduce some complexity to the current parsing of the RabbitMQ host path. I'm curious to know how you plan to handle situations where both vhost and subpath are specified in the host URL while allowSubpathsOnHost is set to True. In my recent approach in #4589, I utilized string operations to extract the subpath and vhost from the host path.

I strongly believe that we should carefully consider the developer experience (DX) when configuring the RabbitMQ Scaler and strive to minimize any potential confusion.

In my opinion, we have two possible approaches: either parse the host path URI to retrieve the subpath, vhost, and other necessary details, or alternatively, disallow the specification of vhost in the host path altogether and utilize the vhost scaler metadata instead.

@zroubalik @JorTurFer WDYT?

Hi @rtnpro @zroubalik @JorTurFer, thank you so much for your review and your attention.
Yes, I definitely agree with you, so please review my latest 2 commits in #4584 and kedacore/keda-docs#1146

@JorTurFer
Copy link
Member

There are already some comments to address in the PR 😄

@AmorBielyi
Copy link
Contributor

There are already some comments to address in the PR 😄

thanks, almost done

@stale
Copy link

stale bot commented Sep 3, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale All issues that are marked as stale due to inactivity label Sep 3, 2023
@JorTurFer
Copy link
Member

JorTurFer commented Sep 3, 2023

This isn't stale, just summer break has happened xD

@stale stale bot removed the stale All issues that are marked as stale due to inactivity label Sep 3, 2023
@github-project-automation github-project-automation bot moved this from Proposed to Ready To Ship in Roadmap - KEDA Core Sep 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
6 participants