@@ -29,28 +29,31 @@ spec:
29
29
- sh
30
30
- ' -c'
31
31
- |
32
- echo '### Begin init container execution ###'
32
+ log () {
33
+ local TIMESTAMP=$(date +"%Y-%m-%d %T.%3N")
34
+ echo "${TIMESTAMP} $@"
35
+ }
36
+ log "Info: [initContainer] Begin init container configure-group execution"
33
37
if [[ $POD_NAME != *-0 ]]; then
34
- echo "This is not a first host in this cluster, not configuring group."
38
+ log "Info: [initContainer] Skipping creation of group $MARKLOGIC_GROUP as $POD_NAME is not the first node in the group."
35
39
else
36
40
HOST_RESP_CODE=`curl --anyauth -m 20 -s -o /dev/null -w "%{http_code}" -X GET http://${MARKLOGIC_BOOTSTRAP_HOST}:8002/manage/v2/hosts --anyauth --user ${MARKLOGIC_ADMIN_USERNAME}:${MARKLOGIC_ADMIN_PASSWORD}`
37
41
if [[ ${HOST_RESP_CODE} -ne 200 ]]; then
38
- echo " Bootstrap host not found."
42
+ log "Error: [initContainer] Bootstrap host $MARKLOGIC_BOOTSTRAP_HOST not found."
39
43
else
40
- echo "Configuring group on the MarkLogic cluster."
41
44
GROUP_CFG_TEMPLATE='{"group-name":"%s"}'
42
45
GROUP_CFG=$(printf "$GROUP_CFG_TEMPLATE" "$MARKLOGIC_GROUP")
43
46
GROUP_RESP_CODE=`curl --anyauth -m 20 -s -o /dev/null -w "%{http_code}" -X GET http://${MARKLOGIC_BOOTSTRAP_HOST}:8002/manage/v2/groups/${MARKLOGIC_GROUP} --anyauth --user ${MARKLOGIC_ADMIN_USERNAME}:${MARKLOGIC_ADMIN_PASSWORD}`
44
47
45
48
if [[ ${GROUP_RESP_CODE} -eq 200 ]]; then
46
- echo "Group $MARKLOGIC_GROUP is already configured on the MarkLogic cluster."
49
+ log "Info: [initContainer] Skipping creation of group $MARKLOGIC_GROUP as it already exists on the MarkLogic cluster."
47
50
else
48
- echo " Group $MARKLOGIC_GROUP does not exist, creating $MARKLOGIC_GROUP on the MarkLogic cluster"
51
+ log "Info: [initContainer] Group $MARKLOGIC_GROUP does not exist, creating $MARKLOGIC_GROUP on the MarkLogic cluster. "
49
52
curl --anyauth --user ${MARKLOGIC_ADMIN_USERNAME}:${MARKLOGIC_ADMIN_PASSWORD} -m 20 -s -X POST -d "${GROUP_CFG}" -H "Content-type: application/json" http://${MARKLOGIC_BOOTSTRAP_HOST}:8002/manage/v2/groups
50
53
fi
51
54
fi
52
55
fi
53
- echo '### Init container execution completed ###'
56
+ log "Info: [initContainer] Init container execution completed"
54
57
env :
55
58
- name : MARKLOGIC_GROUP
56
59
value : {{ .Values.group.name }}
0 commit comments