DataDog / datadog-agent

Main repository for Datadog Agent
https://docs.datadoghq.com/
Apache License 2.0
2.73k stars 1.17k forks source link

fix(config): Use the right source instead of SourceAgentRuntime #27169

Open BaptisteFoy opened 4 days ago

BaptisteFoy commented 4 days ago

What does this PR do?

Before this PR is merged, take any agent in staging in Fleet Automation and go to the configuration tab, runtime overrides layer: it has a lot of entries. But the runtime overrides layer is for configuration that is set by the agent depending on its environment, and not explicitly set by customers (such as check_runners for instance).

This is not the case for what we see today in staging, as it contains the api_key or other additional endpoints that take their key from the secrets backend. They are set by the user and don't fit in the runtime overrides layer.

This PR fixes it by replacing where needed SourceAgentRuntime by config.GetSource so we don't change the config entry's layer.

Motivation

Cleaner layers

Additional Notes

Possible Drawbacks / Trade-offs

Describe how to test/QA your changes

Alternatively, check if agents on a deployed build have the additional_endpoints in the Runtime Override layer (they shouldn't)

pr-commenter[bot] commented 4 days ago

Test changes on VM

Use this command from test-infra-definitions to manually test this PR changes on a VM:

inv create-vm --pipeline-id=37906484 --os-family=ubuntu

Note: This applies to commit c87d9451