Skip to content
Merged
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
1 change: 1 addition & 0 deletions openviking/agfs_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ def _generate_config(self) -> Path:
"endpoint": self.s3_config.endpoint,
"prefix": self.s3_config.prefix,
"disable_ssl": not self.s3_config.use_ssl,
"use_path_style": self.s3_config.use_path_style,
},
}
elif self.backend == "memory":
Expand Down
5 changes: 5 additions & 0 deletions openviking_cli/utils/config/agfs_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ class S3Config(BaseModel):
description="Enable/Disable SSL (HTTPS) for S3 connections. Set to False for local testing without HTTPS.",
)

use_path_style: bool = Field(
default=True,
description="true represent UsePathStyle for MinIO and some S3-compatible services; false represent VirtualHostStyle for TOS and some S3-compatible services.",
)

model_config = {"extra": "forbid"}

def validate_config(self):
Expand Down
1 change: 1 addition & 0 deletions third_party/agfs/agfs-server/config.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ plugins:
# access_key_id: key_id
# secret_access_key: secret
# prefix: agfs/ # Optional: all keys will be prefixed with "agfs/"
# use_path_style: true # Optional: enable path-style addressing (required for MinIO etc.)
#
# # ============================================================================
# # HTTPFS - HTTP File Server (Multiple Instances)
Expand Down
7 changes: 5 additions & 2 deletions third_party/agfs/agfs-server/pkg/plugins/s3fs/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type S3Config struct {
Endpoint string // Optional custom endpoint (for S3-compatible services)
Prefix string // Optional prefix for all keys
DisableSSL bool // For testing with local S3
UsePathStyle bool // Whether to use path-style addressing (true) or virtual-host-style (false)
}

// NewS3Client creates a new S3 client
Expand Down Expand Up @@ -63,11 +64,13 @@ func NewS3Client(cfg S3Config) (*S3Client, error) {
// Create S3 client options
clientOpts := []func(*s3.Options){}

// Set custom endpoint if provided (for MinIO, LocalStack, etc.)
// Set custom endpoint if provided (for MinIO, LocalStack, TOS, etc.)
if cfg.Endpoint != "" {
clientOpts = append(clientOpts, func(o *s3.Options) {
o.BaseEndpoint = aws.String(cfg.Endpoint)
o.UsePathStyle = true // Required for MinIO and some S3-compatible services
// true represent UsePathStyle for MinIO and some S3-compatible services
// false represent VirtualHostStyle for TOS and some S3-compatible services
o.UsePathStyle = cfg.UsePathStyle
})
}

Expand Down
15 changes: 14 additions & 1 deletion third_party/agfs/agfs-server/pkg/plugins/s3fs/s3fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ func (p *S3FSPlugin) Validate(cfg map[string]interface{}) error {
// Check for unknown parameters
allowedKeys := []string{
"bucket", "region", "access_key_id", "secret_access_key", "endpoint", "prefix", "disable_ssl", "mount_path",
"cache_enabled", "cache_ttl", "stat_cache_ttl", "cache_max_size",
"cache_enabled", "cache_ttl", "stat_cache_ttl", "cache_max_size", "use_path_style",
}
if err := config.ValidateOnlyKnownKeys(cfg, allowedKeys); err != nil {
return err
Expand All @@ -542,6 +542,11 @@ func (p *S3FSPlugin) Validate(cfg map[string]interface{}) error {
return err
}

// Validate use_path_style (optional boolean)
if err := config.ValidateBoolType(cfg, "use_path_style"); err != nil {
return err
}

// Validate cache_enabled (optional boolean)
if err := config.ValidateBoolType(cfg, "cache_enabled"); err != nil {
return err
Expand All @@ -562,6 +567,7 @@ func (p *S3FSPlugin) Initialize(config map[string]interface{}) error {
Endpoint: getStringConfig(config, "endpoint", ""),
Prefix: getStringConfig(config, "prefix", ""),
DisableSSL: getBoolConfig(config, "disable_ssl", false),
UsePathStyle: getBoolConfig(config, "use_path_style", true),
}

if cfg.Bucket == "" {
Expand Down Expand Up @@ -646,6 +652,13 @@ func (p *S3FSPlugin) GetConfigParams() []plugin.ConfigParameter {
Default: "false",
Description: "Disable SSL for S3 connections",
},
{
Name: "use_path_style",
Type: "bool",
Required: false,
Default: "true",
Description: "Whether to use path-style addressing (true) or virtual-host-style (false). Defaults to false for TOS, true for other services.",
},
{
Name: "cache_enabled",
Type: "bool",
Expand Down
Loading