Skip to content

Commit 81a615b

Browse files
committed
Adjust logs per verbosity
1 parent f94c527 commit 81a615b

File tree

1 file changed

+9
-5
lines changed
  • pkg/cli/image/imagesource

1 file changed

+9
-5
lines changed

pkg/cli/image/imagesource/s3.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,16 +66,20 @@ func (d *s3Driver) newObject(server *url.URL, region string, insecure bool, secu
6666

6767
configOpts := []func(*config.LoadOptions) error{
6868
config.WithRegion(region),
69-
config.WithCredentialsProvider(&s3CredentialStore{store: d.Creds, url: securityDomain}),
69+
}
70+
71+
credStore := &s3CredentialStore{store: d.Creds, url: securityDomain}
72+
if _, err := credStore.Retrieve(ctx); err == nil {
73+
configOpts = append(configOpts, config.WithCredentialsProvider(credStore))
7074
}
7175

7276
switch {
7377
case klog.V(10).Enabled():
74-
configOpts = append(configOpts, config.WithClientLogMode(aws.LogSigning|aws.LogRetries|aws.LogRequest|aws.LogResponse))
78+
configOpts = append(configOpts, config.WithClientLogMode(aws.LogSigning|aws.LogRetries|aws.LogRequest|aws.LogResponse|aws.LogResponseWithBody|aws.LogDeprecatedUsage))
7579
case klog.V(8).Enabled():
76-
configOpts = append(configOpts, config.WithClientLogMode(aws.LogRetries|aws.LogRequest))
80+
configOpts = append(configOpts, config.WithClientLogMode(aws.LogRetries|aws.LogRequest|aws.LogResponse|aws.LogDeprecatedUsage))
7781
case klog.V(6).Enabled():
78-
configOpts = append(configOpts, config.WithClientLogMode(aws.LogRetries))
82+
configOpts = append(configOpts, config.WithClientLogMode(aws.LogRetries|aws.LogRequest|aws.LogDeprecatedUsage))
7983
}
8084

8185
cfg, err := config.LoadDefaultConfig(ctx, configOpts...)
@@ -88,7 +92,7 @@ func (d *s3Driver) newObject(server *url.URL, region string, insecure bool, secu
8892
o.EndpointOptions.DisableHTTPS = true
8993
}
9094
if d.UserAgent != "" {
91-
o.APIOptions = append(o.APIOptions, awsmiddleware.AddUserAgentKeyValue("oc", d.UserAgent))
95+
o.APIOptions = append(o.APIOptions, awsmiddleware.AddUserAgentKey(d.UserAgent))
9296
}
9397
})
9498

0 commit comments

Comments
 (0)