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 metadata service queries treating 404s as OK #2256
Conversation
Skipping CI for Draft Pull Request. |
23b7adf
to
6ff5fa9
Compare
When the Hegel metadata service doesn't have a Hardware record it returns 404. Our writefile Tinkerbell action treats the 404 as OK resulting in invalid metadata being written to disk and ultimately consumed by kubelet on launch, causing it to fail. This change treats non-200 responses as errors ensuring we move to query any additional metadata endpoints.
6ff5fa9
to
0cebfaf
Compare
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: chrisdoherty4 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
||
+ // Ensure non-200 responses are considered an error and move to the next metadata server. | ||
+ if resp.StatusCode != http.StatusOK { | ||
+ continue |
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.
How is it that we can use continue
here? Is this within some kind of loop? I'm not too familiar with the syntax in patches.
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.
yeah, exactly. its in a for loop. And i only know that because im familiar with the code base. Unfortunately, with the way we do patches you're not able to see this context in the PR. And to see the proper context, you'd have to apply all our patches first. I.e. clone this repo and run then make clone-repo
, make checkout-repo
, and make patch-repo
. :(
Fixes aws/eks-anywhere#5564
When the Hegel metadata service doesn't have a Hardware record it returns 404. Our writefile Tinkerbell action treats the 404 as OK resulting in invalid metadata being written to disk and ultimately consumed by kubelet on launch, causing it to fail.
This change treats non-200 responses as errors ensuring we move to query any additional metadata endpoints.