-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Creating a 'cloudproviders' package #9738
Conversation
7d4de55
to
659bb42
Compare
pkg/util/hostname.go
Outdated
@@ -179,7 +179,7 @@ func GetHostnameData(ctx context.Context) (HostnameData, error) { | |||
configHostnameFilepath := config.Datadog.GetString("hostname_file") | |||
if configHostnameFilepath != "" { | |||
log.Debug("GetHostname trying `hostname_file` config option...") | |||
if fileHostnameProvider, found := hostname.ProviderCatalog["file"]; found { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to move this file to pkg/util/hostname?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would very much so. I started looking into it and the change was massive. I'll open another PR dedicated to this.
659bb42
to
7538b9a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hush-hush 2 tiny nits but LGTM. Great improvements all around!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mind adding a note in Describe how to test your changes
about testing cluster name detection as well? thanks!
This includes for now Azure, Tencent and Alibaba providers. The goal is to encapsulate all the cloud provider logic spread out in the util package.
7538b9a
to
d1ee9ac
Compare
I'll rebase this shortly. The conflict is with one of my PRs (and Maxime is away). |
It looks like the
|
The goal is to encapsulate all the cloud provider logic spread out in the util package. Co-authored-by: Dustin J. Mitchell <dustin.mitchell@datadoghq.com>
What does this PR do?
The logic around cloudproviders is spread out all over the
util
package. This PR create a dedicatedcloudproviders
package.Motivation
Make it easier to add new cloudproviders.
Additional Notes
Describe how to test your changes
Install the agent on different cloudproviders and test that tags and hostname are still well reported.
Ensure that cluster name detection is working, too.
Also test that the metadata payload (printed in the logs in debug log level) is the same.
Checklist
changelog/no-changelog
label has been applied.need-change/operator
andneed-change/helm
labels has been applied if applicable.team/..
label has been applied, if known.Triage
milestone is set.Note: Adding GitHub labels is only possible for contributors with write access.