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
5 changes: 5 additions & 0 deletions pkg/storage/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ func (s *S3) Connect(ctx context.Context) error {
)
// inherit IRSA and try assume role https://github.com/Altinity/clickhouse-backup/issues/1191
if s.Config.AssumeRoleARN != "" && s.Config.AssumeRoleARN != awsRoleARN {
awsConfig.Credentials = aws.NewCredentialsCache(awsConfig.Credentials)
stsClient = sts.NewFromConfig(awsConfig)
awsConfig.Credentials = stscreds.NewAssumeRoleProvider(stsClient, s.Config.AssumeRoleARN)
}
Expand All @@ -157,6 +158,10 @@ func (s *S3) Connect(ctx context.Context) error {
}
}

if awsConfig.Credentials != nil {
awsConfig.Credentials = aws.NewCredentialsCache(awsConfig.Credentials)
}

if s.Config.Debug {
awsConfig.Logger = newS3Logger(log.Logger)
awsConfig.ClientLogMode = aws.LogRetries | aws.LogRequest | aws.LogResponse
Expand Down
3 changes: 2 additions & 1 deletion test/integration/keeperTLS_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,11 @@ func TestKeeperTLS(t *testing.T) {
// clean and restore
r.NoError(env.dropDatabase(dbName, false))
env.queryWithNoError(r, fmt.Sprintf("DROP USER IF EXISTS %s %s", rbacUser, onCluster))
env.ch.Close()
env.DockerExecNoError(r, "clickhouse-backup", "clickhouse-backup", "-c", "/etc/clickhouse-backup/config-s3.yml", "restore", "--rbac", backupName)

// wait for restart after RBAC restore and check
env.connectWithWait(t, r, 500*time.Millisecond, 1*time.Second, 2*time.Minute)
env.connectWithWait(t, r, 5*time.Second, 1*time.Second, 2*time.Minute)
var rowCount, userCount uint64
r.NoError(env.ch.SelectSingleRowNoCtx(&rowCount, fmt.Sprintf("SELECT count() FROM %s.%s", dbName, tableName)))
r.Equal(uint64(100), rowCount)
Expand Down
Loading