Skip to content
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
21 changes: 19 additions & 2 deletions historyserver/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ require (
github.com/alibabacloud-go/tea v1.3.11
github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible
github.com/aliyun/credentials-go v1.4.7
github.com/aws/aws-sdk-go v1.55.8
github.com/aws/aws-sdk-go-v2 v1.41.1
github.com/aws/aws-sdk-go-v2/config v1.32.7
github.com/aws/aws-sdk-go-v2/credentials v1.19.7
github.com/aws/aws-sdk-go-v2/service/s3 v1.95.1
github.com/aws/smithy-go v1.24.0
github.com/emicklei/go-restful/v3 v3.13.0
github.com/fsnotify/fsnotify v1.9.0
github.com/onsi/gomega v1.38.2
Expand All @@ -20,6 +24,19 @@ require (
require (
github.com/Masterminds/semver/v3 v3.4.0 // indirect
github.com/alibabacloud-go/debug v1.0.1 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.4 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.17 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.17 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.17 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.17 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.4 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.8 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.17 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.17 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.30.9 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.13 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.41.6 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
Expand All @@ -38,7 +55,6 @@ require (
github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.9.0 // indirect
Expand Down Expand Up @@ -84,6 +100,7 @@ require (
)

require (
github.com/aws/aws-sdk-go-v2/service/signin v1.0.5 // indirect
github.com/moby/spdystream v0.5.0 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/stretchr/testify v1.11.1 // indirect
Expand Down
46 changes: 38 additions & 8 deletions historyserver/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

63 changes: 44 additions & 19 deletions historyserver/pkg/storage/s3/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@ package s3

import (
"os"
"strconv"

"github.com/aws/aws-sdk-go/aws"
"github.com/sirupsen/logrus"

"github.com/ray-project/kuberay/historyserver/pkg/collector/types"
)

const DefaultS3Bucket = "ray-historyserver"

type config struct {
S3ForcePathStyle *bool
DisableSSL *bool
S3ForcePathStyle bool
DisableSSL bool
Comment on lines +15 to +16
Copy link
Contributor

Choose a reason for hiding this comment

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

Reasonable to use bool rather than *bool to handle the zero value!

I'm thinking if it would be better to use UsePathStyle and DisableHTTPS provided in v2.

S3Endpoint string
S3Bucket string
S3Region string
Expand All @@ -39,12 +40,8 @@ func (c *config) complete(rcc *types.RayCollectorConfig, jd map[string]interface
if len(jd) == 0 {
c.S3Endpoint = os.Getenv("S3_ENDPOINT")
c.S3Region = os.Getenv("S3_REGION")
if os.Getenv("S3FORCE_PATH_STYLE") != "" {
c.S3ForcePathStyle = aws.Bool(os.Getenv("S3FORCE_PATH_STYLE") == "true")
}
if os.Getenv("S3DISABLE_SSL") != "" {
c.DisableSSL = aws.Bool(os.Getenv("S3DISABLE_SSL") == "true")
}
setBoolFromEnv("S3FORCE_PATH_STYLE", &c.S3ForcePathStyle)
setBoolFromEnv("S3DISABLE_SSL", &c.DisableSSL)
} else {
if bucket, ok := jd["s3Bucket"]; ok {
c.S3Bucket = bucket.(string)
Expand All @@ -56,10 +53,10 @@ func (c *config) complete(rcc *types.RayCollectorConfig, jd map[string]interface
c.S3Region = region.(string)
}
if forcePathStyle, ok := jd["s3ForcePathStyle"]; ok {
c.S3ForcePathStyle = aws.Bool(forcePathStyle.(string) == "true")
setBoolFromValue("s3ForcePathStyle", forcePathStyle, &c.S3ForcePathStyle)
}
if s3disableSSL, ok := jd["s3DisableSSL"]; ok {
c.DisableSSL = aws.Bool(s3disableSSL.(string) == "true")
setBoolFromValue("s3DisableSSL", s3disableSSL, &c.DisableSSL)
}
}
}
Expand All @@ -75,12 +72,8 @@ func (c *config) completeHSConfig(rcc *types.RayHistoryServerConfig, jd map[stri
if len(jd) == 0 {
c.S3Endpoint = os.Getenv("S3_ENDPOINT")
c.S3Region = os.Getenv("S3_REGION")
if os.Getenv("S3FORCE_PATH_STYLE") != "" {
c.S3ForcePathStyle = aws.Bool(os.Getenv("S3FORCE_PATH_STYLE") == "true")
}
if os.Getenv("S3DISABLE_SSL") != "" {
c.DisableSSL = aws.Bool(os.Getenv("S3DISABLE_SSL") == "true")
}
setBoolFromEnv("S3FORCE_PATH_STYLE", &c.S3ForcePathStyle)
setBoolFromEnv("S3DISABLE_SSL", &c.DisableSSL)
} else {
if bucket, ok := jd["s3Bucket"]; ok {
c.S3Bucket = bucket.(string)
Expand All @@ -92,10 +85,42 @@ func (c *config) completeHSConfig(rcc *types.RayHistoryServerConfig, jd map[stri
c.S3Region = region.(string)
}
if forcePathStyle, ok := jd["s3ForcePathStyle"]; ok {
c.S3ForcePathStyle = aws.Bool(forcePathStyle.(string) == "true")
setBoolFromValue("s3ForcePathStyle", forcePathStyle, &c.S3ForcePathStyle)
}
if s3disableSSL, ok := jd["s3DisableSSL"]; ok {
c.DisableSSL = aws.Bool(s3disableSSL.(string) == "true")
setBoolFromValue("s3DisableSSL", s3disableSSL, &c.DisableSSL)
}
}
}

func setBoolFromEnv(envKey string, target *bool) {
value := os.Getenv(envKey)
if value == "" {
return
}
parsed, err := strconv.ParseBool(value)
if err != nil {
logrus.Warnf("Invalid boolean value %q for %s", value, envKey)
return
}
*target = parsed
}

func setBoolFromValue(name string, value interface{}, target *bool) {
if value == nil {
return
}
switch v := value.(type) {
case bool:
*target = v
case string:
parsed, err := strconv.ParseBool(v)
if err != nil {
logrus.Warnf("Invalid boolean value %q for %s", v, name)
return
}
*target = parsed
default:
logrus.Warnf("Invalid boolean type %T for %s", value, name)
}
}
Loading
Loading