Skip to content
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

Fix gcp resource detection when using workload identity #10486

Merged
merged 1 commit into from
Jun 2, 2022

Conversation

dashpole
Copy link
Contributor

@dashpole dashpole commented Jun 1, 2022

Description:

I was testing #10347, which updated gcp resource detection, and got this error on clusters with workload identity: failed to detect resource {"kind": "processor", "name": "resourcedetection", "pipeline": "logs", "error": "metadata: GCE metadata \"instance/name\" not defined"}. It turns out that on GKE, only instance/hostname is available, not instance/name. Hostname is an fqdn, not the name of the instance. E.g. gke-wi-collector-test-default-pool-5a7b28f7-nxwt.c.my-project.internal, so we shouldn't use that as the hostname. It would be nice to have the instance name, but that might need to be obtained through the downward API instead of the GKE metadata server...

Testing:

Fixed unit tests, and manually tested.

@dashpole dashpole added bug Something isn't working comp:google Google Cloud components labels Jun 1, 2022
@dashpole dashpole requested a review from a team June 1, 2022 15:39
@pmm-sumo
Copy link
Contributor

pmm-sumo commented Jun 2, 2022

Should we perhaps just trim the content after the first dot? So gke-wi-collector-test-default-pool-5a7b28f7-nxwt.c.my-project.internal would become gke-wi-collector-test-default-pool-5a7b28f7-nxwt?

@dashpole
Copy link
Contributor Author

dashpole commented Jun 2, 2022

We could try that, since the default hostname is the instance name. But it is possible for users to override the hostname of their VMs, so it isn't guaranteed to work correctly. Given that node.name is available through the downward API, is guaranteed to be correct, and we have other things we need to get through the downward API, I'm inclined to start with that approach.

@bogdandrutu bogdandrutu merged commit a2297d4 into open-telemetry:main Jun 2, 2022
@dashpole dashpole deleted the fix_workload_identity branch June 6, 2022 13:29
kentquirk pushed a commit to McSick/opentelemetry-collector-contrib that referenced this pull request Jun 14, 2022
…ry#10486)

fix gcp resource detection when using workload identity
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working comp:google Google Cloud components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants