Files
seaweedfs/weed/cluster/cluster_lance_test.go
T
9fc8a6aec2 mount: read SSE-S3 objects through the S3 gateway (#12909)
* mount: read SSE-S3 objects through an authenticated S3 gateway

* mount: check each comma-joined mount option against -sseS3ReadEndpoint

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* mount: read a mounted version file by its object key and version id

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* mount: read a current null-version object without s3:GetObjectVersion

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* mount: declare -sseS3ReadEndpoint with the other mount options so weed fuse accepts it

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* mount: require the canonical bucket path as the root of an SSE-S3 read mount

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* mount: fall back to the null version when the current object is another version

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* master: list the S3 endpoint each S3 gateway advertises

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* s3: advertise the gateway's S3 endpoint to the master

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* mount: find the S3 gateway through the masters instead of -sseS3ReadEndpoint

-sseS3Read turns gateway reads on. The reader lists the S3 endpoints the
filer's masters have registered, prefers HTTPS, and picks another gateway
when the current one cannot be reached.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* mount: retry an unreachable S3 gateway read on a different gateway

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* mount: warn when -sseS3Read falls back to a plain-HTTP gateway

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* mount: do not retry an unreachable HTTPS gateway over plain HTTP

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* mount: tell HTTPS gateways apart by the parsed URL scheme

An S3 gateway advertised as HTTPS://host lost the HTTPS preference and
the plain-HTTP fallback guard, since the check matched the raw string.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Chris Lu <chrislusf@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 10:32:18 -08:00

30 lines
1.1 KiB
Go

package cluster
import (
"testing"
"github.com/seaweedfs/seaweedfs/weed/pb"
)
func TestSetLancePort(t *testing.T) {
c := NewCluster()
gateway := pb.ServerAddress("10.0.0.30:18333")
// Registered directly, so the test does not depend on AddClusterNode's arguments.
c.s3Groups.getGroupMembers("group", true).members[gateway] = &ClusterNode{Address: gateway}
c.SetLancePort("group", gateway, 9101)
c.SetS3Endpoint("group", gateway, "https://s3.example.com")
// A gateway of another group, or one that never registered, records nothing.
c.SetLancePort("", gateway, 9200)
c.SetLancePort("group", pb.ServerAddress("10.0.0.31:18333"), 9300)
c.SetS3Endpoint("", gateway, "http://other:8333")
nodes := c.ListClusterNode("group", S3Type)
if len(nodes) != 1 || nodes[0].LancePort.Load() != 9101 || nodes[0].GetS3Endpoint() != "https://s3.example.com" {
t.Fatalf("want the gateway listed with port 9101 and its S3 endpoint, got %d nodes", len(nodes))
}
if nodes := c.ListClusterNode("", S3Type); len(nodes) != 0 {
t.Fatalf("SetLancePort must not register a node, got %d", len(nodes))
}
}