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

Add additional logging for outpost arn handling #851

Merged
merged 1 commit into from
Apr 23, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion pkg/cloud/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ func NewMetadataService(svc EC2Metadata) (MetadataService, error) {
// it's guaranteed to be in the form `arn:<partition>:outposts:<region>:<account>:outpost/<outpost-id>`
// There's a case to be made here to ignore the error so a failure here wouldn't affect non-outpost calls.
if err != nil && !strings.Contains(err.Error(), "404") {
return nil, fmt.Errorf("something went wrong while getting EC2 outpost arn")
return nil, fmt.Errorf("something went wrong while getting EC2 outpost arn: %s", err.Error())
} else if err == nil {
klog.Infof("Running in an outpost environment with arn: %s", outpostArn)
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: can you set the log level to 5 for these two log statements.
Want to make every log explicitly set with a level, so later we can filter the log by their level.

}

metadata := Metadata{
Expand All @@ -119,6 +121,7 @@ func NewMetadataService(svc EC2Metadata) (MetadataService, error) {
if err != nil {
klog.Warningf("Failed to parse the outpost arn: %s", outpostArn)
} else {
klog.Infof("Using outpost arn: %v", parsedArn)
metadata.OutpostArn = parsedArn
}

Expand Down