11/*
2- Copyright 2020 The Kubernetes Authors.
2+ Copyright 2025 The Kubernetes Authors.
33
44Licensed under the Apache License, Version 2.0 (the "License");
55you may not use this file except in compliance with the License.
@@ -25,6 +25,8 @@ import (
2525
2626 "github.com/aws/aws-sdk-go-v2/service/s3"
2727 smithyendpoints "github.com/aws/smithy-go/endpoints"
28+
29+ "sigs.k8s.io/cluster-api-provider-aws/v2/pkg/logger"
2830)
2931
3032var (
@@ -104,11 +106,15 @@ type S3EndpointResolver struct {
104106// ResolveEndpoint for S3.
105107func (s * S3EndpointResolver ) ResolveEndpoint (ctx context.Context , params s3.EndpointParameters ) (smithyendpoints.Endpoint , error ) {
106108 // 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" )
108114 return s3 .NewDefaultEndpointResolverV2 ().ResolveEndpoint (ctx , params )
109115 }
110116
111- endpoint := ServiceEndpointsMap [ s3 . ServiceID ]
117+ log . Debug ( "Custom endpoint found, using custom endpoint" , "endpoint" , endpoint . URL )
112118 params .Endpoint = & endpoint .URL
113119 params .Region = & endpoint .SigningRegion
114120 return s3 .NewDefaultEndpointResolverV2 ().ResolveEndpoint (ctx , params )
0 commit comments