Skip to content

Commit

Permalink
add connection details for cluster.kafka
Browse files Browse the repository at this point in the history
  • Loading branch information
mbbush committed Aug 2, 2023
1 parent 55b0447 commit 3ef0bb5
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
34 changes: 34 additions & 0 deletions config/kafka/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,39 @@ func Configure(p *config.Provider) {
Type: "github.com/upbound/provider-aws/apis/ec2/v1beta1.SecurityGroup",
}
r.UseAsync = true
r.Sensitive.AdditionalConnectionDetailsFn = func(attr map[string]any) (map[string][]byte, error) {
conn := map[string][]byte{}
if a, ok := attr["bootstrap_brokers"].(string); ok {
conn["bootstrap_brokers"] = []byte(a)
}
if a, ok := attr["bootstrap_brokers_sasl_iam"].(string); ok {
conn["bootstrap_brokers_sasl_iam"] = []byte(a)
}
if a, ok := attr["bootstrap_brokers_sasl_scram"].(string); ok {
conn["bootstrap_brokers_sasl_scram"] = []byte(a)
}
if a, ok := attr["bootstrap_brokers_tls"].(string); ok {
conn["bootstrap_brokers_tls"] = []byte(a)
}
if a, ok := attr["bootstrap_brokers_public"].(string); ok {
conn["bootstrap_brokers_public"] = []byte(a)
}
if a, ok := attr["bootstrap_brokers_public_sasl_iam"].(string); ok {
conn["bootstrap_brokers_public_sasl_iam"] = []byte(a)
}
if a, ok := attr["bootstrap_brokers_public_sasl_scram"].(string); ok {
conn["bootstrap_brokers_public_sasl_scram"] = []byte(a)
}
if a, ok := attr["bootstrap_brokers_public_tls"].(string); ok {
conn["bootstrap_brokers_public_tls"] = []byte(a)
}
if a, ok := attr["zookeeper_connect_string"].(string); ok {
conn["zookeeper_connect_string"] = []byte(a)
}
if a, ok := attr["zookeeper_connect_string_tls"].(string); ok {
conn["zookeeper_connect_string_tls"] = []byte(a)
}
return conn, nil
}
})
}
3 changes: 3 additions & 0 deletions examples/kafka/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ spec:
region: us-west-1
tags:
foo: bar
writeConnectionSecretToRef:
name: example-msk-cluster
namespace: upbound-system

---

Expand Down

0 comments on commit 3ef0bb5

Please sign in to comment.