kedacore / keda

KEDA is a Kubernetes-based Event Driven Autoscaling component. It provides event driven scale for any container running in Kubernetes
https://keda.sh
Apache License 2.0
8.27k stars 1.05k forks source link

Add option to provide custom datadog sites #5978

Open nishalshettigar opened 1 month ago

nishalshettigar commented 1 month ago

Proposal

We are using an enterprise version of datadog in my company and we have a separate custom site for our datadog instance (<org-name>.datadoghq.com). We were trying to implement keda autoscaling using the datadog scaler, but were facing an issue while doing so. We passed our datadog site in the datadogSite parameter under TriggerAuthentication object.

When we did that we got the following error:

error establishing Datadog connection: error connecting to Datadog API endpoint: The variable site in the server URL has invalid value <org-name>.datadoghq.com. Must be [datadoghq.com us3.datadoghq.com us5.datadoghq.com datadoghq.eu ddog-gov.com]

Hence, we need a mechanism to pass these custom datadog site instances to keda as well.

Use-Case

It will allow teams having their own DD subdomain (<org-name>.datadoghq.com) to be able to integrate keda with their datadog instance

Is this a feature you are interested in implementing yourself?

Yes

Anything else?

I had a brief look at the datadog scaler code and could see that the datadogSite parameter is mapped to the site parameter in the datadog API, which only accepts the values [datadoghq.com us3.datadoghq.com us5.datadoghq.com datadoghq.eu ddog-gov.com]. I also noticed that there is another argument called subdomain in the datadog API and hence I would propose to add another subdomain parameter under the trigger authentication object and pass that along to the datadog API while creating the DatadogConnection object.

arapulido commented 1 month ago

Hello @nishalshettigar ! I don't think this is needed, even if you have a custom URL, your organization is hosted in one of our regions, so adding just the Datadog region you are (datadoghq.com, us3.datadoghq.com, us5.datadoghq.com, datadoghq.eu or ddog-gov.com) and a correct API and APP keys that should work.

Can you try that and let me know, please? Thanks!

nishalshettigar commented 1 month ago

Hi @arapulido, I tried without the site parameter, and I'm getting the following error in the scaled object:

error establishing Datadog connection: error connecting to Datadog API endpoint: 403 Forbidden

Not able to verify which URL it is trying to connect to, but I'm guessing it's not connecting to the org URL.

nishalshettigar commented 1 month ago

So I was checking our open telemetry integration with datadog and I noticed that it is working without the site parameter. So, I'm guessing that API token might not have read access (it is working with open telemetry) and that might be reason for that 403 error. I'll just try to verify that and update here.

arapulido commented 1 month ago

@nishalshettigar yes, I confirmed that the subdomain is not required when connecting to the API, so it has to be something related to your permissions