Skip to content

Commit 04af855

Browse files
release-0.5.0
SDK 0.5.0 Changes: - Remove certificate pinning for java sdk - Removing certificate pinning from docker sdk - Provide and option for custom groupid suffix in mirrormaker - Updated unittest stack - Updated ReadME for certificate pinning
1 parent 80204fa commit 04af855

35 files changed

+144
-2686
lines changed

README.md

Lines changed: 80 additions & 102 deletions
Large diffs are not rendered by default.

docker/Dockerfile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ COPY --from=builder /ncdssdk-client/target/ncdssdk-client.jar /home/kafka/app.ja
1818

1919
WORKDIR /home/kafka
2020

21-
RUN mkdir truststore
22-
23-
ENV JAVAX_NET_SSL_TRUSTSTORE=truststore/ncdsTrustStore.p12
24-
2521
ENTRYPOINT ["bash","docker/run-sdk-app.sh"]
2622

2723
CMD ["-opt", "TOPICS"]

docker/README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,21 @@ Replace example `bootstrap.servers` property in the file kafka.properties (https
66
Replace example `oauth.token.endpoint.uri` property in the file auth.properties (https://github.com/Nasdaq/CloudDataService/blob/master/docker/auth.properties) with provided values during on-boarding.
77

88
## Building
9-
Run docker build in project home directory
10-
9+
Run `docker build` in project home directory
10+
1111
```
1212
docker build -f docker/Dockerfile . -t sdk-app --no-cache
1313
```
14-
14+
1515
## Running Locally Built Images
1616

17-
Replace client id(`{clinet-id-value}`) and client secret(`{client-secret-value}`) provided during on-boarding from Nasdaq team. Also, provide the password (`{trsustore-pass}`) for java truststore.
17+
Replace client id(`{clinet-id-value}`) and client secret(`{client-secret-value}`) provided during on-boarding from Nasdaq team.
1818

1919
```
20-
docker run -e "OAUTH_CLIENT_ID={clinet-id-value}" -e "OAUTH_CLIENT_SECRET={client-secret-value} -e "JAVAX_NET_SSL_TRUSTSTOREPASSWORD={trsustore-pass}" sdk-app:latest
20+
docker run -e "OAUTH_CLIENT_ID={clinet-id-value}" -e "OAUTH_CLIENT_SECRET={client-secret-value} sdk-app:latest
2121
```
22-
23-
User can pass arguments to run the application with specific commands
22+
23+
User can pass arguments to run the application with specific commands
2424
```
2525
-opt -- Provide the operation you want to perform \n" +
2626
" * TOP - View the top nnn records in the Topic/Stream\n"+
@@ -34,11 +34,11 @@ docker run -e "OAUTH_CLIENT_ID={clinet-id-value}" -e "OAUTH_CLIENT_SECRET={clien
3434
"-n -- Provide number of messages to retrieve --- REQUIRED for TOP \n"+
3535
"-msgName -- Provide name of message based on schema --- REQUIRED for GETMSG \n"+
3636
```
37-
38-
Example to get `TOP 10` messages from GIDS stream
39-
37+
38+
Example to get `TOP 10` messages from GIDS stream
39+
4040
```
41-
docker run -e "OAUTH_CLIENT_ID={clinet-id-value}" -e "OAUTH_CLIENT_SECRET={client-secret-value} -e "JAVAX_NET_SSL_TRUSTSTOREPASSWORD={trsustore-pass}" sdk-app:latest -opt TOP -n 10 -topic GIDS
41+
docker run -e "OAUTH_CLIENT_ID={clinet-id-value}" -e "OAUTH_CLIENT_SECRET={client-secret-value} sdk-app:latest -opt TOP -n 10 -topic GIDS
4242
```
4343

4444
## Nasdaq Cloud Data Service - Kafka mirroring with MirrorMaker

docker/auth.properties

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
oauth.token.endpoint.uri=https://{auth_endpoint_url}/auth/realms/pro-realm/protocol/openid-connect/token
2-
oauth.username.claim=preferred_username
3-
javax.net.ssl.trustStoreType=PKCS12
2+
oauth.username.claim=preferred_username

docker/mirrormaker/README.md

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,53 @@
22
This tool uses a Kafka consumer to consume messages from the source cluster, and re-publishes those messages to the local (target) cluster using an embedded Kafka producer. (https://kafka.apache.org/documentation.html#basic_ops_mirror_maker)
33

44
## Running Mirror Maker on docker
5-
This example shows how to setup standalone Mirror Maker instance application.
5+
This example shows how to setup standalone Mirror Maker instance application.
66

77
#### Consumer Configuration (NCDS cluster)
8-
- Replace example `bootstrap.servers` property in the file kafka.properties (https://github.com/Nasdaq/CloudDataService/blob/master/docker/mirrormaker/consumer.properties) with provided values during on-boarding.
8+
- Replace example `bootstrap.servers` property in the kafka.properties file (https://github.com/Nasdaq/CloudDataService/blob/master/docker/mirrormaker/consumer.properties) with provided values during on-boarding.
99

1010
#### Producer Configuration (Target Cluster)
1111
- The producer is the part of Mirror Maker that uses the data read by the and replicates it to the destination cluster.
1212
- Update the producer.properties based target cluster. (https://github.com/Nasdaq/CloudDataService/tree/master/docker/mirrormaker/producer.properties)
1313
- Make sure the bootstrap.server IPs, truststore location if using SSL, and password are correct.
1414

15+
#### Group Id Suffix
16+
- User can customize the group id suffix (property name : `groupidsuffix`)
17+
- If custom suffix is reused then consumer will start where it left off on restart
18+
- If you don't pass a custom suffix, the SDK will create a new group id and start from the earliest message available on topic.
19+
1520
#### Creating docker build
16-
- Run docker build in the project home directory. (https://github.com/Nasdaq/CloudDataService)
21+
- Run `docker build` in the project home directory. (https://github.com/Nasdaq/CloudDataService)
1722

1823
```
1924
docker build -f docker/Dockerfile . -t sdk-app --no-cache
2025
```
2126

2227
#### Running mirror maker
2328
- Run mirror maker for given topics list.
24-
- Replace client id(`{client-id-value}`) and client secret(`{client-secret-value}`) provided during on-boarding from Nasdaq team. Also, provide the password (`{truststore-pass}`) for java truststore.
29+
- Replace client id(`{client-id-value}`) and client secret(`{client-secret-value}`) provided during on-boarding from Nasdaq team.
2530

2631
```
27-
docker run -e "OAUTH_CLIENT_ID={client-id-value}" -e "OAUTH_CLIENT_SECRET={client-secret-value} -e "JAVAX_NET_SSL_TRUSTSTOREPASSWORD={truststore-pass}" sdk-app:latest -opt mirrormaker -topics NLSUTP.stream
32+
docker run -e "OAUTH_CLIENT_ID={client-id-value}" -e "OAUTH_CLIENT_SECRET={client-secret-value}" sdk-app:latest -opt mirrormaker -topics NLSUTP.stream
33+
```
34+
35+
example with custom groupid suffix
36+
37+
```
38+
docker run -e "OAUTH_CLIENT_ID={client-id-value}" -e "OAUTH_CLIENT_SECRET={client-secret-value}" sdk-app:latest -opt mirrormaker -topics NLSUTP.stream -groupidsuffix mycustomsuffix
2839
```
2940

3041
## Deploying Kafka Mirror Maker on Strimzi kafka cluster
3142
Strimzi is an open source project that provides container images and operators for running Apache Kafka on Kubernetes.(https://github.com/strimzi/strimzi-kafka-operator)
32-
The Cluster Operator deploys one or more Kafka Mirror Maker replicas to replicate data between Kafka clusters.
43+
The Cluster Operator deploys one or more Kafka Mirror Maker replicas to replicate data between Kafka clusters.
3344

34-
### Prerequisites
45+
### Prerequisites
3546
- Before deploying Kafka Mirror Maker, the Cluster Operator must be deployed.
3647

3748
### Deploying mirror maker
38-
- Download kafka bootstrap server certificate from NCDS endpoint and add that to Kubernetes secret.
3949
- Create Kubernetes secret for Oauth Client Secret.
4050
- Update Oauth Client Id in kafka-mirror-maker.yaml.
4151
- Create a Kafka Mirror Maker cluster from the command-line:
42-
```kubectl apply -f mirrormaker/template/kafka-mirror-maker.yaml```
52+
```kubectl apply -f mirrormaker/template/kafka-mirror-maker.yaml```
4353

44-
Provided example script `install_mirror_maker.sh` to deploy the mirror maker in your cluster.
54+
Provided example script `install_mirror_maker.sh` to deploy the mirror maker in your cluster.
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
bootstrap.servers={streams_endpoint_url}:9094
2-
ssl.endpoint.identification.algorithm=
32
group.id=
43
security.protocol=SASL_SSL
54
sasl.mechanism=OAUTHBEARER
65
sasl.jaas.config=org.apache.kafka.common.security.oauthbearer.OAuthBearerLoginModule required;
76
sasl.login.callback.handler.class=io.strimzi.kafka.oauth.client.JaasClientOauthLoginCallbackHandler
8-
auto.offset.reset=earliest
7+
auto.offset.reset=earliest

docker/mirrormaker/run-mirror-maker.sh

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,14 @@ export OAUTH_TOKEN_ENDPOINT_URI="https://clouddataservice.auth.nasdaq.com/auth/r
44
export OAUTH_CLIENT_ID="$OAUTH_CLIENT_ID"
55
export OAUTH_CLIENT_SECRET=$OAUTH_CLIENT_SECRET
66
export OAUTH_USERNAME_CLAIM=preferred_username
7-
export KAFKA_OPTS=" \
8-
-Djavax.net.ssl.trustStore=/home/kafka/truststore/ncdsTrustStore.p12 \
9-
-Djavax.net.ssl.trustStorePassword=$JAVAX_NET_SSL_TRUSTSTOREPASSWORD \
10-
-Djavax.net.ssl.trustStoreType=PKCS12"
117

12-
uuid=$(uuidgen)
13-
groupid="$OAUTH_CLIENT_ID$uuid"
8+
topics=$1
9+
group_id_suffix=$2
10+
11+
groupid="$OAUTH_CLIENT_ID$group_id_suffix"
12+
echo $groupid
1413

1514
#update the client Id in consumer
1615
sed -i "s/group.id=/group.id=$groupid/" /home/kafka/docker/mirrormaker/consumer.properties
1716

18-
/opt/kafka/bin/kafka-mirror-maker.sh --consumer.config /home/kafka/docker/mirrormaker/consumer.properties --producer.config /home/kafka/docker/mirrormaker/producer.properties --num.streams 3 --whitelist $@
17+
/opt/kafka/bin/kafka-mirror-maker.sh --consumer.config /home/kafka/docker/mirrormaker/consumer.properties --producer.config /home/kafka/docker/mirrormaker/producer.properties --num.streams 3 --whitelist $topics

docker/run-sdk-app.sh

100644100755
Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,28 @@
11
#!/usr/bin/env sh
22

3-
file="/home/kafka/truststore/ncdsTrustStore.p12"
4-
5-
# Remove the existing truststore if exists
6-
if [ -f $file ] ; then
7-
rm $file
8-
fi
9-
103
OPT=$2
11-
124
#Function to get Topics
135
function get_topics {
14-
if [ $3 == "-topics" ]; then
6+
if [[ $3 == "-topics" ]]; then
157
TOPICS=$4
168
else
179
TOPICS='.*'
1810
fi
1911
}
2012

21-
# Install Trust Store
22-
java -jar app.jar -opt INSTALLCERTS -path /home/kafka/truststore -pass $JAVAX_NET_SSL_TRUSTSTOREPASSWORD &&
13+
function get_groupids_suffix {
14+
if [[ $5 == "-groupidsuffix" ]]; then
15+
group_id_suffix=$6
16+
else
17+
group_id_suffix=$(uuidgen)
18+
fi
19+
}
2320

24-
if [ $OPT == "mirrormaker" ]; then
21+
if [[ $OPT == "mirrormaker" ]]; then
2522
get_topics $@
26-
bash /home/kafka/docker/mirrormaker/run-mirror-maker.sh $TOPICS
23+
get_groupids_suffix $@
24+
bash /home/kafka/docker/mirrormaker/run-mirror-maker.sh $TOPICS $group_id_suffix
2725
else
2826
# Run the user command
29-
java -Djavax.net.ssl.trustStore="/home/kafka/truststore/ncdsTrustStore.p12" -Djavax.net.ssl.trustStorePassword=$JAVAX_NET_SSL_TRUSTSTOREPASSWORD -Doauth.client.id=$OAUTH_CLIENT_ID -Doauth.client.secret=$OAUTH_CLIENT_SECRET -jar app.jar -kafkaprops /home/kafka/docker/kafka.properties -authprops /home/kafka/docker/auth.properties $@
30-
fi
27+
java -Doauth.client.id=$OAUTH_CLIENT_ID -Doauth.client.secret=$OAUTH_CLIENT_SECRET -jar app.jar -kafkaprops /home/kafka/docker/kafka.properties -authprops /home/kafka/docker/auth.properties $@
28+
fi

ncds-sdk/pom.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
<parent>
88
<groupId>com.nasdaq.ncds</groupId>
99
<artifactId>ncds</artifactId>
10-
<version>0.4.0</version>
11-
<relativePath>../pom.xml</relativePath>
10+
<version>0.5.0</version>
1211
</parent>
1312

1413
<artifactId>ncds-sdk</artifactId>

ncds-sdk/src/main/java/com/nasdaq/ncdsclient/NCDSClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class NCDSClient {
3434
*/
3535
public NCDSClient(Properties securityCfg,Properties kafkaCfg) throws Exception {
3636
try {
37-
if (securityCfg != null && AuthenticationConfigLoader.validateSecurityConfig(securityCfg)) {
37+
if (securityCfg != null && AuthenticationConfigLoader.validateSecurityConfig(securityCfg, kafkaCfg)) {
3838
nasdaqKafkaAvroConsumer = new NasdaqKafkaAvroConsumer(securityCfg,kafkaCfg);
3939
}
4040
else if (IsItJunit.isJUnitTest()) {

0 commit comments

Comments
 (0)