Skip to content

Version 2.14 - MongoDB Atlas scheme #5760

@lsteinberg-r7

Description

@lsteinberg-r7

Report

I'm trying to use the latest version's feature of MongoDB Atlas scheme support (mongodb+srv), and getting conflicting requirements -

Keda scale-handler requires a port to be given, otherwise it's failing with:
failed to parsing mongoDB metadata, because of missing required field in scaler config: no port given

But if I'm supplying a port, MongoDB driver itself is failing with the following message:
URI with srv must not include a port number
which comes from this piece of code -

if t.pollingRequired {
// sanity check before passing the hostname to resolver
if len(t.hosts) != 1 {
return fmt.Errorf("URI with SRV must include one and only one hostname")
}
_, _, err = net.SplitHostPort(t.hosts[0])
if err == nil {
// we were able to successfully extract a port from the host,
// but should not be able to when using SRV
return fmt.Errorf("URI with srv must not include a port number")
}
go t.pollSRVRecords(t.hosts[0])
t.pollingwg.Add(1)
}

Expected Behavior

Scaler defined with the +srv scheme should not require a port number.

Actual Behavior

Scaler defined with the +srv scheme requires a port number, even though it conflicts with the driver's requirements.

Steps to Reproduce the Problem

  1. Define a real Atlas host
  2. Define a scaler that uses the host, with a port number
  3. See the error event in the scaler definition in k8s.

Logs from KEDA operator

example

KEDA Version

2.14.0

Kubernetes Version

None

Platform

Google Cloud

Scaler Details

MongoDB

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomershelp wantedLooking for support from community

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions