mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-09-08 15:41:15 +02:00
Explicit IAM gRPC APIs for S3 Server (#8126)
* Update IAM and S3 protobuf definitions for explicit IAM gRPC APIs * Refactor s3api: Extract generic ExecuteAction method for IAM operations * Implement explicit IAM gRPC APIs in S3 server * iam: remove deprecated GetConfiguration and PutConfiguration RPCs * iamapi: refactor handlers to use CredentialManager directly * s3api: refactor embedded IAM to use CredentialManager directly * server: remove deprecated configuration gRPC handlers * credential/grpc: refactor configuration calls to return error * shell: update s3.configure to list users instead of full config * s3api: fix CreateServiceAccount gRPC handler to map required fields * s3api: fix UpdateServiceAccount gRPC handler to map fields and safe status * s3api: enforce UserName in embedded IAM ListAccessKeys * test: fix test_config.json structure to match proto definition * Revert "credential/grpc: refactor configuration calls to return error" This reverts commitcde707dd8b. * Revert "server: remove deprecated configuration gRPC handlers" This reverts commit7307e205a0. * Revert "s3api: enforce UserName in embedded IAM ListAccessKeys" This reverts commitadf727ba52. * Revert "s3api: fix UpdateServiceAccount gRPC handler to map fields and safe status" This reverts commit6a4be3314d. * Revert "s3api: fix CreateServiceAccount gRPC handler to map required fields" This reverts commit9bb4425f07. * Revert "shell: update s3.configure to list users instead of full config" This reverts commitf3304ead53. * Revert "s3api: refactor embedded IAM to use CredentialManager directly" This reverts commit9012f27af8. * Revert "iamapi: refactor handlers to use CredentialManager directly" This reverts commit3a14821223. * Revert "iam: remove deprecated GetConfiguration and PutConfiguration RPCs" This reverts commite16e08aa00. * s3api: address IAM code review comments (error handling, logging, gRPC response mapping) * s3api: add robustness to startup by retrying KEK and IAM config loading from Filer * s3api: address IAM gRPC code review comments (safety, validation, status logic) * fix return
This commit is contained in:
@@ -3,6 +3,7 @@ package s3api
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"os"
|
||||
@@ -346,7 +347,23 @@ func (iam *IdentityAccessManagement) loadEnvironmentVariableCredentials() {
|
||||
}
|
||||
}
|
||||
|
||||
func (iam *IdentityAccessManagement) loadS3ApiConfigurationFromFiler(option *S3ApiServerOption) error {
|
||||
func (iam *IdentityAccessManagement) loadS3ApiConfigurationFromFiler(option *S3ApiServerOption) (err error) {
|
||||
// Try to load configuration with retries to handle transient connectivity issues during startup
|
||||
for i := 0; i < 10; i++ {
|
||||
err = iam.doLoadS3ApiConfigurationFromFiler(option)
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
if errors.Is(err, filer_pb.ErrNotFound) {
|
||||
return err
|
||||
}
|
||||
glog.Warningf("fail to load config from filer (attempt %d/10): %v", i+1, err)
|
||||
time.Sleep(2 * time.Second)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func (iam *IdentityAccessManagement) doLoadS3ApiConfigurationFromFiler(option *S3ApiServerOption) error {
|
||||
return iam.LoadS3ApiConfigurationFromCredentialManager()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user