Skip to content

Commit fb0c03f

Browse files
committed
feat: enhance Kafka TLS configuration and integrate example for Spark tests
- Updated `BigDataContainerFactory` to improve Kafka TLS setup with secret-based credential management. - Enhanced example configurations to include `kafkaTls` parameters for Spark tests. - Refactored filesystem bindings and environment variables for better TLS integration.
1 parent b947b8b commit fb0c03f

2 files changed

Lines changed: 16 additions & 4 deletions

File tree

core/src/main/kotlin/org/openprojectx/bigdata/test/core/container/BigDataContainerFactory.kt

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -702,13 +702,21 @@ internal class BigDataContainerFactory(
702702
sanDomains = listOf("kafka", "broker1.example.com"),
703703
)
704704
container
705-
.withFileSystemBind(keyStore.path.toString(), "/etc/kafka/tls/kafka.keystore.p12", BindMode.READ_ONLY)
706-
.withFileSystemBind(tlsMaterial.trustStorePath.toString(), "/etc/kafka/tls/kafka.truststore.p12", BindMode.READ_ONLY)
707-
.withEnv("KAFKA_SSL_KEYSTORE_LOCATION", "/etc/kafka/tls/kafka.keystore.p12")
705+
.withFileSystemBind(keyStore.path.toString(), "/etc/kafka/secrets/kafka.keystore.p12", BindMode.READ_ONLY)
706+
.withFileSystemBind(tlsMaterial.trustStorePath.toString(), "/etc/kafka/secrets/kafka.truststore.p12", BindMode.READ_ONLY)
707+
.withCopyToContainer(Transferable.of(keyStore.password), "/etc/kafka/secrets/kafka.key.credentials")
708+
.withCopyToContainer(Transferable.of(keyStore.password), "/etc/kafka/secrets/kafka.keystore.credentials")
709+
.withCopyToContainer(Transferable.of(tlsMaterial.trustStorePassword), "/etc/kafka/secrets/kafka.truststore.credentials")
710+
.withEnv("KAFKA_SSL_KEYSTORE_FILENAME", "kafka.keystore.p12")
711+
.withEnv("KAFKA_SSL_KEY_CREDENTIALS", "kafka.key.credentials")
712+
.withEnv("KAFKA_SSL_KEYSTORE_CREDENTIALS", "kafka.keystore.credentials")
713+
.withEnv("KAFKA_SSL_TRUSTSTORE_FILENAME", "kafka.truststore.p12")
714+
.withEnv("KAFKA_SSL_TRUSTSTORE_CREDENTIALS", "kafka.truststore.credentials")
715+
.withEnv("KAFKA_SSL_KEYSTORE_LOCATION", "/etc/kafka/secrets/kafka.keystore.p12")
708716
.withEnv("KAFKA_SSL_KEYSTORE_PASSWORD", keyStore.password)
709717
.withEnv("KAFKA_SSL_KEYSTORE_TYPE", keyStore.type)
710718
.withEnv("KAFKA_SSL_KEY_PASSWORD", keyStore.password)
711-
.withEnv("KAFKA_SSL_TRUSTSTORE_LOCATION", "/etc/kafka/tls/kafka.truststore.p12")
719+
.withEnv("KAFKA_SSL_TRUSTSTORE_LOCATION", "/etc/kafka/secrets/kafka.truststore.p12")
712720
.withEnv("KAFKA_SSL_TRUSTSTORE_PASSWORD", tlsMaterial.trustStorePassword)
713721
.withEnv("KAFKA_SSL_TRUSTSTORE_TYPE", "PKCS12")
714722

example/spark/src/test/resources/spark-bigdata-test-cloudera-hms-kerberos.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,7 @@ kafkaKerberos = true
55

66
[ports]
77
kafka = 19092
8+
9+
[kafkaTls]
10+
enabled = true
11+
domain = "localhost"

0 commit comments

Comments
 (0)