Merge pull request #140 from mstg/dualstack-yumrepofs

Enable dual stack for yumrepofs s3
This commit is contained in:
resf-prow[bot] 2023-07-18 15:06:57 +00:00 committed by GitHub
commit 1adc5d0b93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -19,6 +19,7 @@ go_library(
"//utils", "//utils",
"//vendor/github.com/aws/aws-sdk-go/aws", "//vendor/github.com/aws/aws-sdk-go/aws",
"//vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds", "//vendor/github.com/aws/aws-sdk-go/aws/credentials/stscreds",
"//vendor/github.com/aws/aws-sdk-go/aws/endpoints",
"//vendor/github.com/aws/aws-sdk-go/aws/session", "//vendor/github.com/aws/aws-sdk-go/aws/session",
"//vendor/github.com/aws/aws-sdk-go/service/s3", "//vendor/github.com/aws/aws-sdk-go/service/s3",
"//vendor/github.com/go-git/go-billy/v5/osfs", "//vendor/github.com/go-git/go-billy/v5/osfs",

View File

@ -34,6 +34,7 @@ import (
"context" "context"
"github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials/stscreds" "github.com/aws/aws-sdk-go/aws/credentials/stscreds"
"github.com/aws/aws-sdk-go/aws/endpoints"
"github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/aws/session"
awss3 "github.com/aws/aws-sdk-go/service/s3" awss3 "github.com/aws/aws-sdk-go/service/s3"
"github.com/go-git/go-billy/v5/osfs" "github.com/go-git/go-billy/v5/osfs"
@ -66,7 +67,9 @@ func NewServer(db peridotdb.Access, session *session.Session) (*Server, error) {
return nil, err return nil, err
} }
cfg := &aws.Config{} cfg := &aws.Config{
UseDualStackEndpoint: endpoints.DualStackEndpointStateEnabled,
}
if assumeRole := viper.GetString("s3-assume-role"); assumeRole != "" { if assumeRole := viper.GetString("s3-assume-role"); assumeRole != "" {
cfg.Credentials = stscreds.NewCredentials(session, assumeRole) cfg.Credentials = stscreds.NewCredentials(session, assumeRole)
} }