diff --git a/cmd/ecr-credential-provider/main.go b/cmd/ecr-credential-provider/main.go index d6b745e572..1e60298dd7 100644 --- a/cmd/ecr-credential-provider/main.go +++ b/cmd/ecr-credential-provider/main.go @@ -62,8 +62,9 @@ type ecrPlugin struct { func defaultECRProvider(region string) (*ecr.ECR, error) { cfg := aws.Config{} if region != "" { - klog.Warningf("No region found in the image reference, the default region will be used. Please refer to AWS SDK documentation for configuration purpose.") cfg.Region = aws.String(region) + } else { + klog.Warningf("No region found in the image reference, the default region will be used. Please refer to AWS SDK documentation for configuration purpose.") } sess, err := session.NewSessionWithOptions(session.Options{ Config: cfg,