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

Wait for "forwarded-ip[v6]s" to be available from metadata server before reading value #267

Merged
merged 2 commits into from
Aug 5, 2024

Conversation

nkinkade
Copy link
Contributor

@nkinkade nkinkade commented Aug 1, 2024

I discovered this week that in some cases the metadata files /var/local/metadata/external-ip and /var/local/metadata/external-ipv6 container 404 error HTML documents instead of IP addresses. It appears that there is a race between the write-metadata.service running, and when GCP has fully populated the forwarded-ip[v6]s metadata fields. This PR adds a simple loop to the write-metadata.sh script, but only for the case where the instance is a MIG, since it seems that the other metadata fields are ready by the time write-metadata.sh runs.

This PR also adds a small modification to the write-metadata.service unit file, telling it to run before the kubelet.service. Since some of our k8s containers mount the metadata directory and use values within it, we want to be sure that this unit is complete before the kubelet starts and begins to launch containers.


This change is Reviewable

nkinkade added 2 commits July 30, 2024 15:24
There was a race between this script and whatever populates the
"forwarded-ip[v6]s" metadata values where sometimes the requests for the values
would return 404s, other times not. This adds a loop to be sure the values are
populated before continuing.
@nkinkade nkinkade requested a review from robertodauria August 1, 2024 21:20
Copy link
Contributor

@robertodauria robertodauria left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 2 of 2 files at r1, all commit messages.
Reviewable status: :shipit: complete! 1 of 1 approvals obtained

@nkinkade nkinkade merged commit 9dcd071 into main Aug 5, 2024
5 checks passed
@nkinkade nkinkade deleted the sandbox-kinkade branch August 5, 2024 14:52
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.

2 participants