Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding support for publishing bundle to Minio Object Storage (#5395) #5757

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -312,4 +312,4 @@ require (
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.2 // indirect
sigs.k8s.io/yaml v1.4.0 // indirect
)
)
2 changes: 1 addition & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -2230,4 +2230,4 @@ sigs.k8s.io/structured-merge-diff/v4 v4.4.2/go.mod h1:N8f93tFZh9U6vpxwRArLiikrE5
sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E=
sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY=
software.sslmate.com/src/go-pkcs12 v0.4.0 h1:H2g08FrTvSFKUj+D309j1DPfk5APnIdAQAB8aEykJ5k=
software.sslmate.com/src/go-pkcs12 v0.4.0/go.mod h1:Qiz0EyvDRJjjxGyUQa2cCNZn/wMyzrRJ/qcDXOQazLI=
software.sslmate.com/src/go-pkcs12 v0.4.0/go.mod h1:Qiz0EyvDRJjjxGyUQa2cCNZn/wMyzrRJ/qcDXOQazLI=
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Newline missing.

1 change: 1 addition & 0 deletions pkg/server/plugin/bundlepublisher/awss3/awss3.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type Config struct {
Bucket string `hcl:"bucket" json:"bucket"`
ObjectKey string `hcl:"object_key" json:"object_key"`
Format string `hcl:"format" json:"format"`
Endpoint string `hcl:"endpoint" json:"endpoint"`

// bundleFormat is used to store the content of Format, parsed
// as bundleformat.Format.
Expand Down
15 changes: 13 additions & 2 deletions pkg/server/plugin/bundlepublisher/awss3/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package awss3

import (
"context"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that this is not goimports-ed

"github.com/aws/aws-sdk-go-v2/aws"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/credentials"
Expand All @@ -17,6 +16,7 @@ func newAWSConfig(ctx context.Context, c *Config) (aws.Config, error) {
cfg, err := config.LoadDefaultConfig(ctx,
config.WithRegion(c.Region),
)

if err != nil {
return aws.Config{}, err
}
Expand All @@ -25,9 +25,20 @@ func newAWSConfig(ctx context.Context, c *Config) (aws.Config, error) {
cfg.Credentials = credentials.NewStaticCredentialsProvider(c.AccessKeyID, c.SecretAccessKey, "")
}

if c.Endpoint != "" {
cfg.BaseEndpoint = aws.String(c.Endpoint)
}

return cfg, nil
}

func newS3Client(c aws.Config) (simpleStorageService, error) {
return s3.NewFromConfig(c), nil
options := func(options *s3.Options) {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer the use of var for zero value.

Suggested change
options := func(options *s3.Options) {}
var options func(options *s3.Options)

if c.BaseEndpoint != nil && *c.BaseEndpoint != "" {
options = func(options *s3.Options) {
options.UsePathStyle = true
options.BaseEndpoint = c.BaseEndpoint
}
}
return s3.NewFromConfig(c, options), nil
}