UNCLASSIFIED
Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
Ironbank Containers
C
Confluent
Confluent Component Operator
cp-init-container-operator-6.1.1
Commits
276389bd
Commit
276389bd
authored
Aug 11, 2021
by
Scott Stroud
Browse files
script updates
parent
255cb537
Pipeline
#418821
passed with stages
in 27 minutes and 39 seconds
Changes
24
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
127 additions
and
10 deletions
+127
-10
scripts/confluentinc/zookeeper/bin/launch
scripts/confluentinc/zookeeper/bin/launch
+53
-0
scripts/confluentinc/zookeeper/bin/run
scripts/confluentinc/zookeeper/bin/run
+20
-0
scripts/parser.py
scripts/parser.py
+7
-2
scripts/startup.sh
scripts/startup.sh
+47
-8
No files found.
scripts/confluentinc/zookeeper/bin/launch
0 → 100755
View file @
276389bd
#!/usr/bin/env bash
#
# Copyright 2018 Confluent Inc.
#
set
-o
errexit
# Zookeeper myid
echo
"===> Printing
${
ZOOKEEPER_DATA_DIR
}
/myid:
$(
cat
"
${
ZOOKEEPER_DATA_DIR
}
/myid"
)
"
echo
"===> Configure log4j"
export
KAFKA_LOG4J_OPTS
=
"-Dlog4j.configuration=file:
${
CP_COMPONENT_SCRIPT_DIR
}
/log4j.properties"
##
## This condition is only required to work with older images
## TODO, this code needs to move removed as the metrics configurion
## is moved to the Operator code.
##
if
[
-d
/opt/confluent/etc
]
;
then
echo
"===> Configure disk usage agent"
export
EXTRA_ARGS
=
"
${
EXTRA_ARGS
}
-javaagent:/usr/share/java/cc-base/disk-usage-agent-
${
CONFLUENT_VERSION
}
.jar=
${
CP_COMPONENT_SCRIPT_DIR
}
/disk-usage-agent.properties"
echo
"===> Configure jolokia agent"
export
JOLOKIA_AGENT_PORT
=
${
JOLOKIA_AGENT_PORT
:-
7777
}
export
JOLOKIA_AGENT_HOST
=
${
JOLOKIA_AGENT_HOST
:-
"0.0.0.0"
}
if
[
-e
"
${
CP_COMPONENT_SCRIPT_DIR
}
/jolokia.config"
]
;
then
export
JOLOKIA_EXTRA_ARGS
=
",
$(
cat
<
"
${
CP_COMPONENT_SCRIPT_DIR
}
/jolokia.config"
)
"
fi
if
[
-e
"/opt/caas/lib/jolokia/jolokia-jvm-1.6.2-agent.jar"
]
;
then
export
EXTRA_ARGS
=
"
${
EXTRA_ARGS
}
-javaagent:/opt/caas/lib/jolokia/jolokia-jvm-1.6.2-agent.jar=port=
${
JOLOKIA_AGENT_PORT
}
,host=
${
JOLOKIA_AGENT_HOST
}${
JOLOKIA_EXTRA_ARGS
}
"
else
export
EXTRA_ARGS
=
"
${
EXTRA_ARGS
}
-javaagent:/opt/caas/lib/jolokia/jolokia-jvm-1.3.6-agent.jar=port=
${
JOLOKIA_AGENT_PORT
}
,host=
${
JOLOKIA_AGENT_HOST
}${
JOLOKIA_EXTRA_ARGS
}
"
fi
echo
"===> Configure prometheus JMX agent"
export
JMX_EXPORTER_AGENT_PORT
=
${
JMX_EXPORTER_AGENT_PORT
:-
7778
}
export
JMX_EXPORTER_AGENT_HOST
=
${
JMX_EXPORTER_AGENT_HOST
:-
"0.0.0.0"
}
export
EXTRA_ARGS
=
"
${
EXTRA_ARGS
}
-javaagent:/opt/caas/lib/jmx_prometheus_javaagent-0.14.0.jar=
${
JMX_EXPORTER_AGENT_PORT
}
:/mnt/config/shared/jmx-exporter.yaml"
## requires for now but have to remove in the future iterations
## we need to remove javaagent from the "${CP_COMPONENT_SCRIPT_DIR}/jvm.config" as Operator addes as part of
## new stack deployment
echo
"===> Configure JVM config..."
export
EXTRA_ARGS
=
"
$(
sed
'/-javaagent*/d'
"
${
CP_COMPONENT_SCRIPT_DIR
}
/jvm.config"
|
sed
'/^$/d'
|
tr
'\n'
' '
)
$EXTRA_ARGS
"
else
echo
"===> Configure JVM config..."
export
EXTRA_ARGS
=
"
$(
cat
<
"
${
CP_COMPONENT_SCRIPT_DIR
}
/jvm.config"
|
tr
'\n'
' '
)
${
EXTRA_ARGS
}
"
fi
# These ensure that the "if" sections for heap sizing and GC tuning in kafka launch script does not trigger.
export
KAFKA_HEAP_OPTS
=
' '
export
KAFKA_JVM_PERFORMANCE_OPTS
=
' '
echo
"===> Launching
${
CP_COMPONENT_NAME
}
..."
exec
zookeeper-server-start
"
${
CP_COMPONENT_SCRIPT_DIR
}
/zookeeper.properties"
scripts/confluentinc/zookeeper/bin/run
0 → 100755
View file @
276389bd
#!/usr/bin/env bash
#
# Copyright 2020 Confluent Inc.
#
set
-o
nounset
set
-o
errexit
export
CP_COMPONENT_NAME
=
zookeeper
export
CP_COMPONENT_SCRIPT_DIR
=
/opt/confluentinc/etc/
${
CP_COMPONENT_NAME
}
export
ZOOKEEPER_CONFIG_DIR
=
/mnt/config
export
ZOOKEEPER_DATA_DIR
=
/mnt/data/data
echo
"===> User"
id
export
OPERATOR_SCRIPT_DIR
=
/mnt/config/
${
CP_COMPONENT_NAME
}
echo
"===> Load
${
CP_COMPONENT_NAME
}
operator scripts from path
${
OPERATOR_SCRIPT_DIR
}
/bin"
"
${
OPERATOR_SCRIPT_DIR
}
"
/bin/configure
"
${
OPERATOR_SCRIPT_DIR
}
"
/bin/launch
scripts/parser.py
View file @
276389bd
...
@@ -13,9 +13,14 @@ def create_file(file_name, data):
...
@@ -13,9 +13,14 @@ def create_file(file_name, data):
'''
'''
with
open
(
file_name
,
'w'
)
as
out_file
:
with
open
(
file_name
,
'w'
)
as
out_file
:
for
key
,
value
in
data
.
items
():
for
key
,
value
in
data
.
items
():
if
isinstance
(
value
,
int
)
or
isinstance
(
value
,
float
)
:
if
isinstance
(
value
,
int
)
or
isinstance
(
value
,
float
):
value
=
str
(
value
)
value
=
str
(
value
)
out_file
.
write
(
key
+
"="
+
value
+
"
\n
"
)
if
isinstance
(
value
,
bool
):
value
=
str
(
value
).
lower
()
if
len
(
value
)
==
0
:
out_file
.
write
(
key
+
"
\n
"
)
else
:
out_file
.
write
(
key
+
"="
+
value
+
"
\n
"
)
def
read_file
(
file_name
):
def
read_file
(
file_name
):
'''
'''
...
...
scripts/startup.sh
View file @
276389bd
#!/usr/bin/env sh
#!/usr/bin/env sh
set
-ox
errexit
set
-ox
errexit
if
[[
-z
${
POD_NAME
}
]]
;
then
if
[[
-z
"
${
POD_NAME
}
"
]]
;
then
echo
"Environment variable POD_NAME not found..."
echo
"Environment variable POD_NAME not found..."
env
env
exit
exit
fi
fi
pod_id
=
${
POD_NAME
}
id
=
${
pod_id
##*-
}
;
pod_name
=
${
POD_NAME
}
pod_name
=
${
POD_NAME
%-*
}
id
=
${
pod_name
##*-
}
;
cat
/mnt/config/pod/
${
pod_name
}
/template.jsonnet |
base64
-d
>
/opt/template.jsonnet
component_name
=
${
POD_NAME
%-*
}
/usr/local/bin/jsonnet /opt/template.jsonnet
--ext-str
id
=
${
id
}
-o
/opt/
${
pod_name
}
.json
cat
/opt/
${
pod_name
}
.json
if
[
-e
"/mnt/config/pod/
${
component_name
}
/template.jsonnet"
]
;
then
/opt/parser.py
${
pod_name
}
/opt/
${
pod_name
}
.json /mnt/config
cat
< /mnt/config/pod/
"
${
component_name
}
"
/template.jsonnet |
base64
-d
>
/opt/template.jsonnet
/usr/local/bin/jsonnet /opt/template.jsonnet
--ext-str
id
=
"
${
id
}
"
-o
/opt/
"
${
component_name
}
"
.json
cat
/opt/
"
${
component_name
}
"
.json
/opt/parser.py
"
${
component_name
}
"
"/opt/
${
component_name
}
.json"
/mnt/config
elif
[
-e
"/mnt/config/init/template.jsonnet"
]
;
then
# new version of operator 2.0
cat
< /mnt/config/init/template.jsonnet |
base64
-d
>
/mnt/config/template.jsonnet
cat
< /mnt/config/init/data.json |
base64
-d
>
/mnt/config/data.json
/opt/config.py
"
${
pod_name
}
"
/mnt/config/data.json /mnt/config/template.jsonnet /mnt/config/
"
${
component_name
}
"
.json
cat
/mnt/config/
"
${
component_name
}
"
.json
/opt/parser.py
"
${
component_name
}
"
/mnt/config/
"
${
component_name
}
"
.json /mnt/config
# write to both locations to support image overrides
mkdir
-p
/mnt/config/pod/
"
${
pod_name
}
"
/opt/parser.py
"
${
component_name
}
"
/mnt/config/
"
${
component_name
}
"
.json /mnt/config/pod/
"
${
pod_name
}
"
# clean up excess output files
rm
/mnt/config/template.jsonnet /mnt/config/data.json /mnt/config/
"
${
component_name
}
"
.json
else
echo
"template.jsonnet not found in the path"
exit
1
fi
# load scripts accordingly
if
[
-n
"
${
OPERATOR_CP_TYPE
}
"
]
;
then
echo
"load script for CP type:
${
OPERATOR_CP_TYPE
}
"
if
[
"
${
OPERATOR_CP_TYPE
}
"
=
"zookeeper"
]
;
then
cp
-r
/opt/confluentinc/zookeeper/ /mnt/config/
elif
[
"
${
OPERATOR_CP_TYPE
}
"
=
"controlcenter"
]
;
then
cp
-r
/opt/confluentinc/controlcenter/ /mnt/config/
elif
[
"
${
OPERATOR_CP_TYPE
}
"
=
"kafka"
]
;
then
cp
-r
/opt/confluentinc/kafka/ /mnt/config/
elif
[
"
${
OPERATOR_CP_TYPE
}
"
=
"replicator"
]
;
then
cp
-r
/opt/confluentinc/replicator/ /mnt/config/
elif
[
"
${
OPERATOR_CP_TYPE
}
"
=
"connect"
]
;
then
cp
-r
/opt/confluentinc/connect/ /mnt/config/
elif
[
"
${
OPERATOR_CP_TYPE
}
"
=
"ksqldb"
]
;
then
cp
-r
/opt/confluentinc/ksqldb/ /mnt/config/
elif
[
"
${
OPERATOR_CP_TYPE
}
"
=
"schemaregistry"
]
;
then
cp
-r
/opt/confluentinc/schemaregistry/ /mnt/config/
fi
fi
Prev
1
2
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment