From c9af126bed4e7706e62fa296e8b386411a6b3545 Mon Sep 17 00:00:00 2001 From: yetone Date: Wed, 6 Jul 2022 10:56:02 +0000 Subject: [PATCH] fix: s3 in cluster scheme --- api-server/services/organization.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/api-server/services/organization.go b/api-server/services/organization.go index f6185bd8..fdf8dfd1 100644 --- a/api-server/services/organization.go +++ b/api-server/services/organization.go @@ -416,6 +416,8 @@ func (s *organizationService) GetS3Config(ctx context.Context, org *models.Organ scheme = "https" } + inClusterScheme := scheme + if endpointInCluster == "" { svcCli := cliset.CoreV1().Services(consts.KubeNamespaceYataiComponents) var svc *corev1.Service @@ -430,6 +432,7 @@ func (s *organizationService) GetS3Config(ctx context.Context, org *models.Organ endpointInCluster = endpoint } else { endpointInCluster = fmt.Sprintf("%s.%s", svc.Name, svc.Namespace) + inClusterScheme = "http" } } @@ -437,7 +440,7 @@ func (s *organizationService) GetS3Config(ctx context.Context, org *models.Organ Endpoint: endpoint, EndpointInCluster: endpointInCluster, EndpointWithScheme: fmt.Sprintf("%s://%s", scheme, endpoint), - EndpointWithSchemeInCluster: fmt.Sprintf("%s://%s", scheme, endpointInCluster), + EndpointWithSchemeInCluster: fmt.Sprintf("%s://%s", inClusterScheme, endpointInCluster), AccessKey: string(accessKey), SecretKey: string(secretKey), Secure: secure,