Skip to content

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

@ovidiubuligan

Description

@ovidiubuligan

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:[email protected]: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:[email protected]: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:[email protected]: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:[email protected]: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:[email protected]: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:[email protected]: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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Ready To Ship

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions