@@ -29,24 +29,28 @@ spec:
29
29
- sh
30
30
- ' -c'
31
31
- |
32
- echo '### Begin configuring group ###'
33
-
34
- 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}`
35
- if [[ ${HOST_RESP_CODE} -eq 200 ]]; then
36
- GROUP_CFG_TEMPLATE='{"group-name":"%s"}'
37
- GROUP_CFG=$(printf "$GROUP_CFG_TEMPLATE" "$MARKLOGIC_GROUP")
38
- 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}`
39
-
40
- if [[ ${GROUP_RESP_CODE} -eq 200 ]]; then
41
- echo "Group $MARKLOGIC_GROUP is already configured on the MarkLogic cluster."
42
- else
43
- echo "Group $MARKLOGIC_GROUP does not exist, creating $MARKLOGIC_GROUP on the MarkLogic cluster"
44
- 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
45
- fi
32
+ echo '### Begin init container execution ###'
33
+ if [[ $POD_NAME != *-0 ]]; then
34
+ echo "This is not a first host in this cluster, not configuring group."
46
35
else
47
- echo "Bootstrap host not found"
36
+ 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
+ if [[ ${HOST_RESP_CODE} -ne 200 ]]; then
38
+ echo "Bootstrap host not found."
39
+ else
40
+ echo "Configuring group on the MarkLogic cluster."
41
+ GROUP_CFG_TEMPLATE='{"group-name":"%s"}'
42
+ GROUP_CFG=$(printf "$GROUP_CFG_TEMPLATE" "$MARKLOGIC_GROUP")
43
+ 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
+
45
+ if [[ ${GROUP_RESP_CODE} -eq 200 ]]; then
46
+ echo "Group $MARKLOGIC_GROUP is already configured on the MarkLogic cluster."
47
+ else
48
+ echo "Group $MARKLOGIC_GROUP does not exist, creating $MARKLOGIC_GROUP on the MarkLogic cluster"
49
+ 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
+ fi
51
+ fi
48
52
fi
49
- echo '### init container execution completed ###'
53
+ echo '### Init container execution completed ###'
50
54
env :
51
55
- name : MARKLOGIC_GROUP
52
56
value : {{ .Values.group.name }}
60
64
secretKeyRef :
61
65
name : {{ include "marklogic.fullname" . }}
62
66
key : password
67
+ - name : POD_NAME
68
+ valueFrom :
69
+ fieldRef :
70
+ fieldPath : metadata.name
63
71
envFrom :
64
72
- configMapRef :
65
73
name : {{ include "marklogic.fullname" . }}
0 commit comments