1
1
/*
2
- Copyright 2020 The Kubernetes Authors.
2
+ Copyright 2025 The Kubernetes Authors.
3
3
4
4
Licensed under the Apache License, Version 2.0 (the "License");
5
5
you may not use this file except in compliance with the License.
@@ -25,6 +25,7 @@ import (
25
25
26
26
"github.com/aws/aws-sdk-go-v2/service/s3"
27
27
smithyendpoints "github.com/aws/smithy-go/endpoints"
28
+ "sigs.k8s.io/cluster-api-provider-aws/v2/pkg/logger"
28
29
)
29
30
30
31
var (
@@ -104,11 +105,15 @@ type S3EndpointResolver struct {
104
105
// ResolveEndpoint for S3.
105
106
func (s * S3EndpointResolver ) ResolveEndpoint (ctx context.Context , params s3.EndpointParameters ) (smithyendpoints.Endpoint , error ) {
106
107
// If custom endpoint not found, return default endpoint for the service
107
- if _ , ok := s .endpoints [s3 .ServiceID ]; ! ok {
108
+ log := logger .FromContext (ctx )
109
+ endpoint , ok := s .endpoints [s3 .ServiceID ]
110
+
111
+ if ! ok {
112
+ log .Debug ("Custom endpoint not found, using default endpoint" )
108
113
return s3 .NewDefaultEndpointResolverV2 ().ResolveEndpoint (ctx , params )
109
114
}
110
115
111
- endpoint := ServiceEndpointsMap [ s3 . ServiceID ]
116
+ log . Debug ( "Custom endpoint found, using custom endpoint" , "endpoint" , endpoint . URL )
112
117
params .Endpoint = & endpoint .URL
113
118
params .Region = & endpoint .SigningRegion
114
119
return s3 .NewDefaultEndpointResolverV2 ().ResolveEndpoint (ctx , params )
0 commit comments