Skip to content

Commit 37b9147

Browse files
authored
Merge branch 'main' into add-akeyless-secretstore
2 parents a4fbb50 + 2390f7a commit 37b9147

File tree

7 files changed

+213
-3
lines changed

7 files changed

+213
-3
lines changed

.github/infrastructure/docker-compose-cassandra.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: '2'
22

33
services:
44
cassandra:
5-
image: docker.io/bitnami/cassandra:4.1
5+
image: docker.io/bitnamilegacy/cassandra:4.1
66
ports:
77
- '7000:7000'
88
- '9042:9042'

common/component/kafka/clients.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ func (k *Kafka) latestClients() (*clients, error) {
2222

2323
// case 1: use aws clients with refreshable tokens in the cfg
2424
case k.awsConfig != nil:
25+
if k.clients != nil {
26+
return k.clients, nil
27+
}
28+
2529
awsKafkaOpts := KafkaOptions{
2630
Config: k.config,
2731
ConsumerGroup: k.consumerGroup,
@@ -34,10 +38,12 @@ func (k *Kafka) latestClients() (*clients, error) {
3438
if err != nil {
3539
return nil, fmt.Errorf("failed to get AWS IAM Kafka clients: %w", err)
3640
}
37-
return &clients{
41+
42+
k.clients = &clients{
3843
consumerGroup: awsKafkaClients.ConsumerGroup,
3944
producer: awsKafkaClients.Producer,
40-
}, nil
45+
}
46+
return k.clients, nil
4147

4248
// case 2: normal static auth profile clients
4349
default:

common/component/kafka/kafka.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,12 @@ func (k *Kafka) Init(ctx context.Context, metadata map[string]string) error {
181181
if err != nil {
182182
return err
183183
}
184+
case oidcPrivateKeyJWTAuthType:
185+
k.logger.Info("Configuring SASL OAuth2/OIDC authentication with private key JWT")
186+
err = updateOidcPrivateKeyJWTAuthInfo(config, meta)
187+
if err != nil {
188+
return err
189+
}
184190
case passwordAuthType:
185191
k.logger.Info("Configuring SASL Password authentication")
186192
k.saslUsername = meta.SaslUsername
@@ -295,12 +301,16 @@ func (k *Kafka) ValidateAWS(metadata map[string]string) (awsAuth.Options, error)
295301
}
296302

297303
return awsAuth.Options{
304+
Logger: k.logger,
298305
Region: region,
299306
AccessKey: accessKey,
300307
SecretKey: secretKey,
301308
AssumeRoleArn: role,
302309
AssumeRoleSessionName: session,
303310
SessionToken: token,
311+
TrustAnchorArn: metadata["trustAnchorArn"],
312+
TrustProfileArn: metadata["trustProfileArn"],
313+
Properties: metadata,
304314
}, nil
305315
}
306316

common/component/kafka/kafka_test.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,14 @@ func TestValidateAWS(t *testing.T) {
520520
AssumeRoleArn: "testRoleArn",
521521
AssumeRoleSessionName: "testSessionName",
522522
SessionToken: "testSessionToken",
523+
Properties: map[string]string{
524+
"region": "us-east-1",
525+
"accessKey": "testAccessKey",
526+
"secretKey": "testSecretKey",
527+
"assumeRoleArn": "testRoleArn",
528+
"sessionName": "testSessionName",
529+
"sessionToken": "testSessionToken",
530+
},
523531
},
524532
err: nil,
525533
},
@@ -540,6 +548,14 @@ func TestValidateAWS(t *testing.T) {
540548
AssumeRoleArn: "awsRoleArn",
541549
AssumeRoleSessionName: "awsSessionName",
542550
SessionToken: "awsSessionToken",
551+
Properties: map[string]string{
552+
"awsRegion": "us-west-2",
553+
"awsAccessKey": "awsAccessKey",
554+
"awsSecretKey": "awsSecretKey",
555+
"awsIamRoleArn": "awsRoleArn",
556+
"awsStsSessionName": "awsSessionName",
557+
"awsSessionToken": "awsSessionToken",
558+
},
543559
},
544560
err: nil,
545561
},

common/proto/state/sqlserver/test.pb.go

Lines changed: 162 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
syntax = "proto3";
2+
3+
option go_package = "github.com/dapr/components-contrib/common/proto/state/sqlserver";
4+
5+
import "google/protobuf/timestamp.proto";
6+
7+
message TestEvent {
8+
int32 eventId = 1;
9+
google.protobuf.Timestamp timestamp = 2;
10+
}

state/redis/redis_test.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -561,3 +561,9 @@ func BenchmarkGetKeyVersion(b *testing.B) {
561561
}
562562
}
563563
}
564+
565+
func Test_KeyList(t *testing.T) {
566+
s := NewRedisStateStore(logger.NewLogger("test"))
567+
_, ok := s.(state.KeysLiker)
568+
require.True(t, ok)
569+
}

0 commit comments

Comments
 (0)