-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
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 -
keda/vendor/go.mongodb.org/mongo-driver/x/mongo/driver/topology/topology.go
Lines 390 to 403 in c55e306
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
- Define a real Atlas host
- Define a scaler that uses the host, with a port number
- 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