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

Use GCP selflink for tracking instances throughout #8

Merged
merged 2 commits into from
Jan 5, 2024

Conversation

Nashluffy
Copy link
Collaborator

@Nashluffy Nashluffy commented Jan 5, 2024

When the compute API is first queried, the self link is used to form a resource ID that is put in the cache. After formatting, that looks like

projects/mock-project/zones/europe-west1-c/instances/fake-resource

but when creation events are received, the resource name uses the project ID instead of the number, which looks like

projects/12345678/zones/europe-west1-c/instances/fake-resource

This leads to two types of resource IDs being stored in the cache. To fix this, compute resource IDs are stored in the form

projects/mock-project/zones/europe-west1-c/instances/fake-resource

which is formed from the self link.

Additionally, preemption events do not contain a self link, but the format of the resource ID matches what we stored in the cache.

This also fixes a small bug where an instance would be tracked even if parsing the pubsub message failed

mauriceyap
mauriceyap previously approved these changes Jan 5, 2024
toastwaffle
toastwaffle previously approved these changes Jan 5, 2024
@Nashluffy Nashluffy dismissed stale reviews from toastwaffle and mauriceyap via 9755157 January 5, 2024 11:30
@Nashluffy Nashluffy merged commit 0b233ec into master Jan 5, 2024
2 checks passed
@Nashluffy Nashluffy deleted the use-self-link-throughout branch January 5, 2024 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants