Skip to content

Commit

Permalink
fix: s3 in cluster scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
yetone committed Jul 6, 2022
1 parent af6f648 commit c9af126
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion api-server/services/organization.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -430,14 +432,15 @@ func (s *organizationService) GetS3Config(ctx context.Context, org *models.Organ
endpointInCluster = endpoint
} else {
endpointInCluster = fmt.Sprintf("%s.%s", svc.Name, svc.Namespace)
inClusterScheme = "http"
}
}

conf = &S3Config{
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,
Expand Down

0 comments on commit c9af126

Please sign in to comment.