|
2 | 2 | set -e |
3 | 3 | set +x |
4 | 4 |
|
5 | | -# Prepare hostname - for StrimziPodSets we use the Pod DNS name assigned through the headless service |
6 | | -ADVERTISED_HOSTNAME=$(hostname -f | cut -d "." -f1-4) |
7 | | -export ADVERTISED_HOSTNAME |
| 5 | +# Clean-up /tmp directory from files which might have remained from previous container restart |
| 6 | +# We ignore any errors which might be caused by files injected by different agents which we do not have the rights to delete |
| 7 | +rm -rfv /tmp/* || true |
8 | 8 |
|
9 | | -# Create dir where keystores and truststores will be stored |
10 | | -mkdir -p /tmp/kafka |
11 | | - |
12 | | -# Generate and print the config file |
13 | | -echo "Starting Kafka Connect with configuration:" |
14 | | -tee /tmp/strimzi-connect.properties < "/opt/kafka/custom-config/kafka-connect.properties" | sed -e 's/sasl.jaas.config=.*/sasl.jaas.config=[hidden]/g' |
15 | | -echo "" |
16 | | - |
17 | | -# Disable Kafka's GC logging (which logs to a file)... |
18 | | -export GC_LOG_ENABLED="false" |
19 | | - |
20 | | -if [ -z "$KAFKA_LOG4J_OPTS" ]; then |
21 | | - export KAFKA_LOG4J_OPTS="-Dlog4j2.configurationFile=$KAFKA_HOME/custom-config/log4j2.properties" |
22 | | -fi |
23 | | - |
24 | | -# We don't need LOG_DIR because we write no log files, but setting it to a |
25 | | -# directory avoids trying to create it (and logging a permission denied error) |
26 | | -export LOG_DIR="$KAFKA_HOME" |
27 | | - |
28 | | -# Enable Prometheus JMX Exporter as Java agent |
29 | | -if [ "$KAFKA_CONNECT_JMX_EXPORTER_ENABLED" = "true" ]; then |
30 | | - KAFKA_OPTS="${KAFKA_OPTS} -javaagent:$(ls "$JMX_EXPORTER_HOME"/jmx_prometheus_javaagent*.jar)=9404:$KAFKA_HOME/custom-config/metrics-config.json" |
31 | | - export KAFKA_OPTS |
32 | | -fi |
33 | | - |
34 | | -. ./set_kafka_jmx_options.sh "${STRIMZI_JMX_ENABLED}" "${STRIMZI_JMX_USERNAME}" "${STRIMZI_JMX_PASSWORD}" |
35 | | - |
36 | | -# Enable Tracing agent (initializes tracing) as Java agent |
37 | | -if [ "$STRIMZI_TRACING" = "jaeger" ] || [ "$STRIMZI_TRACING" = "opentelemetry" ]; then |
38 | | - KAFKA_OPTS="$KAFKA_OPTS -javaagent:$(ls "$KAFKA_HOME"/libs/tracing-agent*.jar)=$STRIMZI_TRACING" |
39 | | - export KAFKA_OPTS |
40 | | - if [ "$STRIMZI_TRACING" = "opentelemetry" ] && [ -z "$OTEL_TRACES_EXPORTER" ]; then |
41 | | - # auto-set OTLP exporter |
42 | | - export OTEL_TRACES_EXPORTER="otlp" |
43 | | - fi |
44 | | -fi |
45 | | - |
46 | | -if [ -n "$STRIMZI_JAVA_SYSTEM_PROPERTIES" ]; then |
47 | | - export KAFKA_OPTS="${KAFKA_OPTS} ${STRIMZI_JAVA_SYSTEM_PROPERTIES}" |
48 | | -fi |
49 | | - |
50 | | -# Disable FIPS if needed |
51 | | -if [ "$FIPS_MODE" = "disabled" ]; then |
52 | | - export KAFKA_OPTS="${KAFKA_OPTS} -Dcom.redhat.fips=false" |
53 | | -fi |
54 | | - |
55 | | -# Configure heap based on the available resources if needed |
56 | | -. ./dynamic_resources.sh |
57 | | - |
58 | | -# Configure Garbage Collection logging |
59 | | -. ./set_kafka_gc_options.sh |
60 | | - |
61 | | -set -x |
62 | | - |
63 | | -# starting Kafka server with final configuration |
64 | | -exec /usr/bin/tini -w -e 143 -- "${KAFKA_HOME}/bin/connect-distributed.sh" /tmp/strimzi-connect.properties |
| 9 | +# Run the script shared between Connect and MirrorMaker 2 |
| 10 | +exec ./kafka_connect_mm2_shared_run.sh |
0 commit comments