mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-08-18 21:26:56 +00:00
Fix IAM manager initialization: remove code duplication, add TODO for HA
Addresses review comment on s3api_server.go:145 Changes: - Remove duplicate code for getting first filer address - Extract filerAddr variable once and reuse - Add TODO comment documenting the HA limitation for IAM manager - Document that loadIAMManagerFromConfig and NewS3IAMIntegration need updates to support multiple filers for full HA Note: This is a known limitation when using filer-backed IAM stores. The interfaces need to be updated to accept multiple filer addresses. For now, documenting this limitation clearly.
This commit is contained in:
@@ -123,22 +123,21 @@ func NewS3ApiServerWithStore(router *mux.Router, option *S3ApiServerOption, expl
|
||||
if option.IamConfig != "" {
|
||||
glog.V(1).Infof("Loading advanced IAM configuration from: %s", option.IamConfig)
|
||||
|
||||
// Note: IAM manager and S3IAMIntegration currently use only the first filer address
|
||||
// TODO: Update loadIAMManagerFromConfig and NewS3IAMIntegration to support multiple filers
|
||||
// for full HA. This is a known limitation for filer-backed IAM stores.
|
||||
filerAddr := ""
|
||||
if len(option.Filers) > 0 {
|
||||
filerAddr = string(option.Filers[0])
|
||||
}
|
||||
|
||||
iamManager, err := loadIAMManagerFromConfig(option.IamConfig, func() string {
|
||||
// Use the first filer address for IAM
|
||||
if len(option.Filers) > 0 {
|
||||
return string(option.Filers[0])
|
||||
}
|
||||
return ""
|
||||
return filerAddr
|
||||
})
|
||||
if err != nil {
|
||||
glog.Errorf("Failed to load IAM configuration: %v", err)
|
||||
} else {
|
||||
// Create S3 IAM integration with the loaded IAM manager
|
||||
// Use the first filer address for IAM
|
||||
filerAddr := ""
|
||||
if len(option.Filers) > 0 {
|
||||
filerAddr = string(option.Filers[0])
|
||||
}
|
||||
s3iam := NewS3IAMIntegration(iamManager, filerAddr)
|
||||
|
||||
// Set IAM integration in server
|
||||
|
||||
Reference in New Issue
Block a user