Skip to content

Commit

Permalink
rename for clarification
Browse files Browse the repository at this point in the history
  • Loading branch information
ybelMekk committed Sep 21, 2021
1 parent 762e296 commit 527055e
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 25 deletions.
24 changes: 13 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,19 +131,19 @@ After Successful `nais` command a set of files will be available in `current` fo
- client-keystore.p12
- client-truststore.jks
- kafka-ca.pem
- kafka-certificate.crt
- kafka-private-key.pem
- kafka-client-certificate.crt
- kafka-client-private-key.pem
- kafka-secret.env

##### kafka-secret.env

```Properties
KAFKA_BROKERS:brokerurl.aivencloud.com:26484
KAFKA_PRIVATE_KEY=/path/to/kafka-private-key.pem
KAFKA_PRIVATE_KEY=/path/to/kafka-client-private-key.pem
client.keystore.p12=/path/to/client-keystore.p12
client.truststore.jks=/path/to/.envs/client-truststore.jks
KAFKA_CA=/path/to/.envs/kafka-ca.pem
KAFKA_CERTIFICATE=/path/to/.envs/kafka-certificate.crt
KAFKA_CERTIFICATE=/path/to/.envs/kafka-client-certificate.crt
KAFKA_CREDSTORE_PASSWORD=password
KAFKA_SCHEMA_REGISTRY=https://registry-url.aivencloud.com:26487
KAFKA_SCHEMA_REGISTRY_PASSWORD=password
Expand All @@ -153,29 +153,31 @@ KAFKA_SCHEMA_REGISTRY_USER=my-user
##### kcat

- kafka-ca.pem
- kafka-certificate.crt
- kafka-private-key.pem
- kafka-client-certificate.crt
- kafka-client-private-key.pem
- kcat.conf

##### kcat.conf

```Properties
# nais 2021-09-01 15:26:00
# kcat -F kcat.conf -t namespace.your.topic
ssl.key.location=/path/to/current/folder/creds/my-username-kafka-private-key.pem
ssl.certificate.location=/path/to/current/folder/creds/my-username-kafka-certificate.crt
ssl.key.location=/path/to/current/folder/creds/kafka-client-private-key.pem
ssl.certificate.location=/path/to/current/folder/creds/kafka-client-certificate.crt
bootstrap.servers=https://boostrap-server.aivencloud.com:26484
ssl.ca.location=/path/to/current/folder/creds/my-user-kafka-ca.pem
ssl.ca.location=/path/to/current/folder/creds/kafka-ca.pem
security.protocol=ssl
```

more about properties configuration in [kcat.conf](https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md)

##### All

- client-keystore.p12
- client-truststore.jks
- kafka-ca.pem
- kafka-certificate.crt
- kafka-private-key.pem
- kafka-client-certificate.crt
- kafka-client-private-key.pem
- kafka-secret.env
- kcat.conf

Expand Down
8 changes: 4 additions & 4 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ const (
)

var KCatEnvToFileMap = map[string]string{
consts.KafkaCertificate: consts.KafkaCertificateCrtFile,
consts.KafkaPrivateKey: consts.KafkaPrivateKeyPemFile,
consts.KafkaCertificate: consts.KafkaClientCertificateCrtFile,
consts.KafkaPrivateKey: consts.KafkaClientPrivateKeyPemFile,
consts.KafkaCa: consts.KafkaCACrtFile,
}

var KafkaConfigEnvToFileMap = map[string]string{
consts.KafkaCertificate: consts.KafkaCertificateCrtFile,
consts.KafkaPrivateKey: consts.KafkaPrivateKeyPemFile,
consts.KafkaCertificate: consts.KafkaClientCertificateCrtFile,
consts.KafkaPrivateKey: consts.KafkaClientPrivateKeyPemFile,
consts.KafkaCa: consts.KafkaCACrtFile,
consts.KafkaClientKeystoreP12: consts.KafkaClientKeyStoreP12File,
consts.KafkaClientTruststoreJks: consts.KafkaClientTruststoreJksFile,
Expand Down
6 changes: 3 additions & 3 deletions pkg/config/kcat.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ func NewKCatConfig(secret *v1.Secret, envToFileMap map[string]string, dest strin
PrefixPath: dest,
RequiredFiles: envToFileMap,
RequiredLocation: map[string]string{
consts.KafkaCertificateCrtFile: KafkaCatSslCertificateLocation,
consts.KafkaPrivateKeyPemFile: KafkaCatSslKeyLocation,
consts.KafkaCACrtFile: KafkaCatSslCaLocation,
consts.KafkaClientCertificateCrtFile: KafkaCatSslCertificateLocation,
consts.KafkaClientPrivateKeyPemFile: KafkaCatSslKeyLocation,
consts.KafkaCACrtFile: KafkaCatSslCaLocation,
},
}
}
Expand Down
10 changes: 5 additions & 5 deletions pkg/consts/const.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package consts

const (
KafkaCertificateCrtFile = "kafka-certificate.crt"
KafkaPrivateKeyPemFile = "kafka-private-key.pem"
KafkaCACrtFile = "kafka-ca.pem"
KafkaClientKeyStoreP12File = "client-keystore.p12"
KafkaClientTruststoreJksFile = "client-truststore.jks"
KafkaClientCertificateCrtFile = "kafka-client-certificate.crt"
KafkaClientPrivateKeyPemFile = "kafka-client-private-key.pem"
KafkaCACrtFile = "kafka-ca.pem"
KafkaClientKeyStoreP12File = "client-keystore.p12"
KafkaClientTruststoreJksFile = "client-truststore.jks"

KafkaCertificate = "KAFKA_CERTIFICATE"
KafkaPrivateKey = "KAFKA_PRIVATE_KEY"
Expand Down
4 changes: 2 additions & 2 deletions pkg/secret/secret_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ func TestGeneratedFilesAndSecretConfiguration(t *testing.T) {
assert.True(t, strings.Contains(kafkaEnvData, "client.keystore.p12"))

var fileKeys = []string{
consts.KafkaCertificateCrtFile,
consts.KafkaClientCertificateCrtFile,
consts.KafkaCACrtFile,
consts.KafkaPrivateKeyPemFile,
consts.KafkaClientPrivateKeyPemFile,
consts.KafkaClientKeyStoreP12File,
consts.KafkaClientTruststoreJksFile,
}
Expand Down

0 comments on commit 527055e

Please sign in to comment.