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,8 @@ import (
25
25
26
26
"github.com/aws/aws-sdk-go-v2/service/s3"
27
27
smithyendpoints "github.com/aws/smithy-go/endpoints"
28
+
29
+ "sigs.k8s.io/cluster-api-provider-aws/v2/pkg/logger"
28
30
)
29
31
30
32
var (
@@ -104,11 +106,15 @@ type S3EndpointResolver struct {
104
106
// ResolveEndpoint for S3.
105
107
func (s * S3EndpointResolver ) ResolveEndpoint (ctx context.Context , params s3.EndpointParameters ) (smithyendpoints.Endpoint , error ) {
106
108
// If custom endpoint not found, return default endpoint for the service
107
- if _ , ok := s .endpoints [s3 .ServiceID ]; ! ok {
109
+ log := logger .FromContext (ctx )
110
+ endpoint , ok := s .endpoints [s3 .ServiceID ]
111
+
112
+ if ! ok {
113
+ log .Debug ("Custom endpoint not found, using default endpoint" )
108
114
return s3 .NewDefaultEndpointResolverV2 ().ResolveEndpoint (ctx , params )
109
115
}
110
116
111
- endpoint := ServiceEndpointsMap [ s3 . ServiceID ]
117
+ log . Debug ( "Custom endpoint found, using custom endpoint" , "endpoint" , endpoint . URL )
112
118
params .Endpoint = & endpoint .URL
113
119
params .Region = & endpoint .SigningRegion
114
120
return s3 .NewDefaultEndpointResolverV2 ().ResolveEndpoint (ctx , params )
0 commit comments