Skip to content

Commit 003c337

Browse files
authored
Merge pull request #19 from CDOT-CV/Feature/custom-kafka-connectors
Custom Kafka topics / Connectors
2 parents 8ce3a11 + 4e9c143 commit 003c337

8 files changed

+40
-2
lines changed

README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,8 @@ The following enviroment variables can be used to configure Kafka Topic creation
101101
| `KAFKA_TOPIC_CREATE_GEOJSONCONVERTER` | Whether to create topics for the GeoJSON Converter |
102102
| `KAFKA_TOPIC_CREATE_CONFLICTMONITOR` | Whether to create topics for the Conflict Monitor |
103103
| `KAFKA_TOPIC_CREATE_DEDUPLICATOR` | Whether to create topics for the Deduplicator |
104+
| `KAFKA_TOPIC_CREATE_OTHER` | Whether to create topics for other applications, this is only useful when you attach a custom `kafka-topics-values.yaml` file with other topics |
105+
| `KAFKA_TOPICS_VALUES_FILE` | Path to a custom `kafka-topics-values.yaml` file|
104106
| `KAFKA_TOPIC_PARTITIONS` | Number of partitions |
105107
| `KAFKA_TOPIC_REPLICAS` | Number of replicas |
106108
| `KAFKA_TOPIC_MIN_INSYNC_REPLICAS` | Minumum number of in-sync replicas (for use with ack=all) |
@@ -174,7 +176,9 @@ The following environment variables can be used to configure Kafka Connectors:
174176
| `CONNECT_CREATE_ODE` | Whether to create kafka connectors for the ODE |
175177
| `CONNECT_CREATE_GEOJSONCONVERTER` | Whether to create topics for the GeojsonConverter |
176178
| `CONNECT_CREATE_CONFLICTMONITOR` | Whether to create kafka connectors for the Conflict Monitor |
177-
| `CONNECT_CREATE_DEDUPLICATOR` | Whether to create topics for the Deduplicator |
179+
| `CONNECT_CREATE_DEDUPLICATOR` | Whether to create kafka connectors for the Deduplicator |
180+
| `CONNECT_KAFKA_CONNECTORS_VALUES_FILE` | Path to a custom `kafka-connectors-values.yaml` file |
181+
| `CONNECT_CREATE_OTHER` | Whether to create kafka connectors for other applications, this is only useful when you attach a custom `kafka-connectors-values.yaml` file with other connectors |
178182

179183
### Quick Run
180184

docker-compose-connect.yml

+5-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,11 @@ services:
8080
CONNECT_CREATE_CONFLICTMONITOR: ${CONNECT_CREATE_CONFLICTMONITOR}
8181
CONNECT_CREATE_DEDUPLICATOR: ${CONNECT_CREATE_DEDUPLICATOR}
8282
CONNECT_CREATE_MECDEPOSIT: ${CONNECT_CREATE_MECDEPOSIT}
83+
CONNECT_CREATE_OTHER: ${CONNECT_CREATE_OTHER}
84+
8385
MONGO_CONNECTOR_USERNAME: ${MONGO_ADMIN_DB_USER}
8486
MONGO_CONNECTOR_PASSWORD: ${MONGO_ADMIN_DB_PASS:?}
8587
MONGO_DB_IP: ${MONGO_IP}
86-
MONGO_DB_NAME: ${MONGO_DB_NAME}
88+
MONGO_DB_NAME: ${MONGO_DB_NAME}
89+
volumes:
90+
- ${CONNECT_KAFKA_CONNECTORS_VALUES_FILE:-./jikkou/kafka-connectors-values.yaml}:/kafka-connectors-values.yaml

docker-compose-kafka.yml

+4
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,13 @@ services:
7070
KAFKA_TOPIC_MIN_INSYNC_REPLICAS: ${KAFKA_TOPIC_MIN_INSYNC_REPLICAS}
7171
KAFKA_TOPIC_RETENTION_MS: ${KAFKA_TOPIC_RETENTION_MS}
7272
KAFKA_TOPIC_DELETE_RETENTION_MS: ${KAFKA_TOPIC_DELETE_RETENTION_MS}
73+
7374
KAFKA_TOPIC_CREATE_ODE: ${KAFKA_TOPIC_CREATE_ODE}
7475
KAFKA_TOPIC_CREATE_GEOJSONCONVERTER: ${KAFKA_TOPIC_CREATE_GEOJSONCONVERTER}
7576
KAFKA_TOPIC_CREATE_CONFLICTMONITOR: ${KAFKA_TOPIC_CREATE_CONFLICTMONITOR}
7677
KAFKA_TOPIC_CREATE_DEDUPLICATOR: ${KAFKA_TOPIC_CREATE_DEDUPLICATOR}
7778
KAFKA_TOPIC_CREATE_MECDEPOSIT: ${KAFKA_TOPIC_CREATE_MECDEPOSIT}
79+
KAFKA_TOPIC_CREATE_OTHER: ${KAFKA_TOPIC_CREATE_OTHER}
7880

7981
KAFKA_SECURITY_PROTOCOL: ${KAFKA_SECURITY_PROTOCOL:-PLAINTEXT}
8082
KAFKA_SASL_MECHANISM: ${KAFKA_SASL_MECHANISM}
@@ -84,6 +86,8 @@ services:
8486
options:
8587
max-size: "10m"
8688
max-file: "5"
89+
volumes:
90+
- ${KAFKA_TOPICS_VALUES_FILE:-./jikkou/kafka-topics-values.yaml}:/kafka-topics-values.yaml
8791

8892
kafka-schema-registry:
8993
profiles:

jikkou/kafka-connectors-template.jinja

+4
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,7 @@ spec:
7070
{% if system.env.CONNECT_CREATE_MECDEPOSIT %}
7171
{{ create_connector(values.apps.mecdeposit) }}
7272
{% endif %}
73+
74+
{% if system.env.CONNECT_CREATE_OTHER %}
75+
{{ create_connector(values.apps.other) }}
76+
{% endif %}

jikkou/kafka-connectors-values.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -370,3 +370,7 @@ apps:
370370
- topicName: topic.MecDepositMetrics
371371
collectionName: MecDepositMetrics
372372
generateTimestamp: true
373+
# Allow for custom connectors to be added - users can override this file and add other kafka connectors here
374+
other:
375+
name: other
376+
connectors:

jikkou/kafka-topics-template.jinja

+4
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,7 @@ spec:
7979
{% if system.env.KAFKA_TOPIC_CREATE_MECDEPOSIT %}
8080
{{ create_topics(values.apps.mecdeposit) }}
8181
{% endif %}
82+
83+
{% if system.env.KAFKA_TOPIC_CREATE_OTHER %}
84+
{{ create_topics(values.apps.other) }}
85+
{% endif %}

jikkou/kafka-topics-values.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -197,3 +197,8 @@ apps:
197197
- topic.MecDepositMetrics
198198
tableTopics: {}
199199
customTopics: {}
200+
other:
201+
name: other-topics
202+
streamTopics: {}
203+
tableTopics: {}
204+
customTopics: {}

sample.env

+9
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ KAFKA_TOPIC_CREATE_GEOJSONCONVERTER=true # Create topics for GeoJSON Converte
4949
KAFKA_TOPIC_CREATE_CONFLICTMONITOR=true # Create topics for Conflict Monitor
5050
KAFKA_TOPIC_CREATE_DEDUPLICATOR=false # Create topics for Deduplicator
5151
KAFKA_TOPIC_CREATE_MECDEPOSIT=false # Create topics for MecDeposit
52+
KAFKA_TOPIC_CREATE_OTHER=false # Create topics for other applications
53+
54+
# Relative path to the Kafka topics values file, upper level directories are supported
55+
KAFKA_TOPICS_VALUES_FILE="./jikkou/kafka-topics-values.yaml"
5256

5357
# Confluent Cloud Support
5458
KAFKA_SECURITY_PROTOCOL=PLAINTEXT
@@ -121,5 +125,10 @@ CONNECT_CREATE_GEOJSONCONVERTER=true # Create kafka connectors to MongoDB for
121125
CONNECT_CREATE_CONFLICTMONITOR=true # Create kafka connectors to MongoDB for Conflict Monitor
122126
CONNECT_CREATE_DEDUPLICATOR=false # Create kafka connectors to MongoDB for Deduplicator
123127
CONNECT_CREATE_MECDEPOSIT=false # Create kafka connectors to MongoDB for MecDeposit
128+
CONNECT_CREATE_OTHER=false # Create kafka connectors to MongoDB for other applications
129+
130+
# Relative path to the Kafka connect connectors values file, upper level directories are supported
131+
CONNECT_KAFKA_CONNECTORS_VALUES_FILE="./jikkou/kafka-connectors-values.yaml"
132+
124133

125134
### Kafka connect variables - END ###

0 commit comments

Comments
 (0)