Skip to content

Commit

Permalink
Make metadata logging best-effort
Browse files Browse the repository at this point in the history
  • Loading branch information
sjenning committed Sep 24, 2024
1 parent d7e05d5 commit 6884171
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions pkg/providers/v1/aws_sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
klog.InfoS("instance metadata identity",
"region", identity.Region,
"availability-zone", identity.AvailabilityZone,
"instance-type", identity.InstanceType,
"architecture", identity.Architecture,
"instance-id", identity.InstanceID,
"private-ip", identity.PrivateIP,
"account-id", identity.AccountID,
"image-id", identity.ImageID)
if err == nil {
klog.InfoS("instance metadata identity",
"region", identity.Region,
"availability-zone", identity.AvailabilityZone,
"instance-type", identity.InstanceType,
"architecture", identity.Architecture,
"instance-id", identity.InstanceID,
"private-ip", identity.PrivateIP,
"account-id", identity.AccountID,
"image-id", identity.ImageID)
}
return client, nil
}

Expand Down

0 comments on commit 6884171

Please sign in to comment.