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

Make metadata logging best-effort #1028

Merged
merged 2 commits into from
Sep 27, 2024

Conversation

sjenning
Copy link
Contributor

@sjenning sjenning commented Sep 24, 2024

Fixes #1027

/kind bug

Fixes an issue introduced in v1.31.0 where a fatal error occurs when AWS_EC2_METADATA_DISABLED is true`

@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Sep 24, 2024
@k8s-ci-robot
Copy link
Contributor

This issue is currently awaiting triage.

If cloud-provider-aws contributors determine this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 24, 2024
GetInstanceIdentityDocument returns a fatal error when AWS_EC2_METADATA_DISABLED is true.
Make the logging best-effort and ignore errors from GetInstanceIdentityDocument.
@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/invalid-commit-message Indicates that a PR should not merge because it has an invalid commit message. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Sep 24, 2024
@dims
Copy link
Member

dims commented Sep 24, 2024

@sjenning looks good to me! looks like there may be unrelated reasons for the ci failures though :(

@sjenning
Copy link
Contributor Author

/test pull-cloud-provider-aws-e2e

@sjenning
Copy link
Contributor Author

@dims tests are green now. Can you approve/lgtm?

@@ -211,18 +211,17 @@ func (p *awsSDKProvider) Metadata() (config.EC2Metadata, error) {
p.addAPILoggingHandlers(&client.Handlers)

identity, err := client.GetInstanceIdentityDocument()
if err != nil {
return nil, fmt.Errorf("unable to get instance identity document: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add a log line for this error?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review!

The line would be logged for every invocation of the function and it would basically be a log line that says "I wanted to log something useful but the call failed so I'm logging the fact that I couldn't log something useful".

How often is this function called?

Copy link
Contributor

Choose a reason for hiding this comment

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

Calls to IMDS can fail for reasons other than AWS_EC2_METADATA_DISABLED, so I think its worth logging. It's only called once in an init():

metadata, err := newAWSSDKProvider(nil, cfg).Metadata()

@kmala
Copy link
Member

kmala commented Sep 25, 2024

we also need to update the go version to update to 1.22.7 for the govulncheck to succeed. Can you do it if possible else i can make a new PR for it?

@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 25, 2024
@cartermckinnon
Copy link
Contributor

/retest

@ialidzhikov
Copy link
Contributor

Can we proceed with merging this PR?

@cartermckinnon
Copy link
Contributor

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 27, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cartermckinnon

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 27, 2024
@k8s-ci-robot k8s-ci-robot merged commit d12b519 into kubernetes:master Sep 27, 2024
13 checks passed
k8s-ci-robot added a commit that referenced this pull request Sep 30, 2024
…028-origin-release-1.31

Automated cherry pick of #1028: Make metadata logging best-effort
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fatal error when AWS_EC2_METADATA_DISABLED is true
6 participants