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 scaler does not support custom metricName #1975

Closed
rtnpro opened this issue Jul 22, 2021 · 1 comment · Fixed by #1976 or kedacore/keda-docs#499
Closed

RabbitMQ scaler does not support custom metricName #1975

rtnpro opened this issue Jul 22, 2021 · 1 comment · Fixed by #1976 or kedacore/keda-docs#499
Labels
bug Something isn't working

Comments

@rtnpro
Copy link
Contributor

rtnpro commented Jul 22, 2021

Report

In our use case, workers consume from multiple RabbitMQ hosts on the same queue name, and failover if a host goes out of service. However, without support for custom metricName in TriggerMetadata like other scalers like postgresql, triggers on the same queue, mode but different RabbitMQ hosts create duplicate metricName in Keda, and hence there's an error during reconciling the ScaledObject.

# Add auth for host-1
apiVersion: keda.sh/v1alpha1
kind: TriggerAuthentication
metadata:
  name: worker-rabbitmq-trigger-auth-host-1
spec:
  secretTargetRef:
    - parameter: host
      name: keda-worker-secrets
      key: RABBITMQ_HOST_1
---
apiVersion: keda.sh/v1alpha1
kind: TriggerAuthentication
metadata:
  name: worker-rabbitmq-trigger-auth-host-2
spec:
  secretTargetRef:
    - parameter: host
      name: keda-worker-secrets
      key: RABBITMQ_HOST_2

---
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
  name: worker-scaleobject
spec:
  scaleTargetRef:
    name: some-worker
  triggers:
  - type: rabbitmq
    metadata:
      protocol: http
      queueName: somequeue
      mode: QueueLength
      value: "100"
    authenticationRef:
      name: rabbitmq-trigger-auth-host-1
  - type: rabbitmq
    metadata:
      protocol: http
      queueName: somequeue
      mode: QueueLength
      value: "100"
    authenticationRef:
      name: rabbitmq-trigger-auth-host-2

Expected Behavior

RabbitMQ Scaler should allow & parse custom metricName in TriggerMetadata, so that in the above reported use case, we can prevent duplicate metricNames in a ScaledObject by specifying custom metricName.

Actual Behavior

RabbitMQ scaler does not allow and parse metricName from TriggerMetadata.

Steps to Reproduce the Problem

  1. Create a ScaledObject for a Deployment with multiple triggers using the same mode, queue, but on different hosts, similar to the snippet shared in the report above.

Logs from KEDA operator

2021-07-21T07:54:50.558Z	ERROR	controller	Reconciler error	{"reconcilerGroup": "keda.sh", "reconcilerKind": "ScaledObject", "controller": "scaledobject", "name": "worker-scaleobject", "namespace": "********", "error": "metricName rabbitmq-somequeue defined multiple times in ScaledObject worker-scaleobject, please refer the documentation how to define metricName manually"}
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem
	/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.6.5/pkg/internal/controller/controller.go:218
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).worker
	/go/pkg/mod/sigs.k8s.io/controller-runtime@v0.6.5/pkg/internal/controller/controller.go:197
k8s.io/apimachinery/pkg/util/wait.BackoffUntil.func1
	/go/pkg/mod/k8s.io/apimachinery@v0.20.7/pkg/util/wait/wait.go:155
k8s.io/apimachinery/pkg/util/wait.BackoffUntil
	/go/pkg/mod/k8s.io/apimachinery@v0.20.7/pkg/util/wait/wait.go:156
k8s.io/apimachinery/pkg/util/wait.JitterUntil
	/go/pkg/mod/k8s.io/apimachinery@v0.20.7/pkg/util/wait/wait.go:133
k8s.io/apimachinery/pkg/util/wait.Until
	/go/pkg/mod/k8s.io/apimachinery@v0.20.7/pkg/util/wait/wait.go:90

KEDA Version

2.3.0

Kubernetes Version

1.17

Platform

Amazon Web Services

Scaler Details

RabbitMQ

Anything else?

No response

@rtnpro rtnpro added the bug Something isn't working label Jul 22, 2021
rtnpro added a commit to rtnpro/keda that referenced this issue Jul 22, 2021
rtnpro added a commit to rtnpro/keda that referenced this issue Jul 22, 2021
Fixes kedacore#1975

Signed-off-by: Ratnadeep Debnath <rtnpro@gmail.com>
rtnpro added a commit to rtnpro/keda that referenced this issue Aug 2, 2021
Fixes kedacore#1975

Signed-off-by: Ratnadeep Debnath <rtnpro@gmail.com>
rtnpro added a commit to rtnpro/keda that referenced this issue Aug 2, 2021
Fixes kedacore#1975

Signed-off-by: Ratnadeep Debnath <rtnpro@gmail.com>
@tomkerkhove
Copy link
Member

Thanks for your contribution on this @rtnpro!

rtnpro added a commit to rtnpro/keda that referenced this issue Aug 2, 2021
Fixes kedacore#1975

Signed-off-by: Ratnadeep Debnath <rtnpro@gmail.com>
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
None yet
2 participants