@@ -28,15 +28,15 @@ spec:
28
28
- name : configure-group
29
29
image : " {{ .Values.initContainerImage.repository }}:{{ .Values.initContainerImage.tag }}"
30
30
volumeMounts :
31
- - name : admin-creds
32
- mountPath : " /run/secrets/creds "
33
- readOnly : false
31
+ - name : mladmin-secrets
32
+ mountPath : /run/secrets/ml-secrets
33
+ readOnly : true
34
34
command :
35
35
- sh
36
36
- ' -c'
37
37
- |
38
- MARKLOGIC_ADMIN_USERNAME="$(< /run/secrets/creds /username)"
39
- MARKLOGIC_ADMIN_PASSWORD="$(< /run/secrets/creds /password)"
38
+ MARKLOGIC_ADMIN_USERNAME="$(< /run/secrets/ml-secrets /username)"
39
+ MARKLOGIC_ADMIN_PASSWORD="$(< /run/secrets/ml-secrets /password)"
40
40
log () {
41
41
local TIMESTAMP=$(date +"%Y-%m-%d %T.%3N")
42
42
echo "${TIMESTAMP} $@"
76
76
fi
77
77
env :
78
78
- name : MARKLOGIC_ADMIN_USERNAME_FILE
79
- value : " creds /username"
79
+ value : " ml-secrets /username"
80
80
- name : MARKLOGIC_ADMIN_PASSWORD_FILE
81
- value : " creds /password"
81
+ value : " ml-secrets /password"
82
82
- name : POD_NAME
83
83
valueFrom :
84
84
fieldRef :
92
92
image : " {{ .Values.image.repository }}:{{ .Values.image.tag }}"
93
93
imagePullPolicy : {{ .Values.image.pullPolicy}}
94
94
volumeMounts :
95
- - name : admin-creds
96
- mountPath : " /run/secrets/creds "
95
+ - name : mladmin-secrets
96
+ mountPath : " /run/secrets/ml-secrets "
97
97
readOnly : false
98
98
- name : datadir
99
99
mountPath : {{ .Values.persistence.mountPath }}
@@ -102,9 +102,9 @@ spec:
102
102
{{- end }}
103
103
env :
104
104
- name : MARKLOGIC_ADMIN_USERNAME_FILE
105
- value : " creds /username"
105
+ value : " ml-secrets /username"
106
106
- name : MARKLOGIC_ADMIN_PASSWORD_FILE
107
- value : " creds /password"
107
+ value : " ml-secrets /password"
108
108
- name : POD_NAME
109
109
valueFrom :
110
110
fieldRef :
@@ -136,89 +136,89 @@ spec:
136
136
- bash
137
137
- ' -c'
138
138
- |
139
- MARKLOGIC_ADMIN_USERNAME="$(< /run/secrets/creds /username)"
140
- MARKLOGIC_ADMIN_PASSWORD="$(< /run/secrets/creds /password)"
139
+ MARKLOGIC_ADMIN_USERNAME="$(< /run/secrets/ml-secrets /username)"
140
+ MARKLOGIC_ADMIN_PASSWORD="$(< /run/secrets/ml-secrets /password)"
141
141
142
- pid=$(pgrep start.marklogic)
142
+ pid=$(pgrep start.marklogic)
143
143
144
- log () {
145
- local TIMESTAMP=$(date +"%Y-%m-%d %T.%3N")
146
- # Check to make sure pod doesn't terminate if PID value is empty for any reason
147
- # If PID value is empty postStart hook logs are not recorded
148
- if [ -n "$pid" ]; then
149
- echo "${TIMESTAMP} $@" > /proc/$pid/fd/1
150
- fi
151
- }
152
- log "Info: [poststart] Begin Poststart Hook Execution"
153
- if [[ $POD_NAME != *-0 ]]; then
154
- log "Info: [poststart] Skipping group configuration."
155
- else
156
- while [ ! -f /var/opt/MarkLogic/ready ]; do
157
- log "[poststart] wait for marklogic server to be ready"
158
- sleep 5s
159
- done
160
- sleep 10s
161
- GROUP_CFG_TEMPLATE='{"group-name":"%s", "xdqp-ssl-enabled":"%s"}'
162
- GROUP_CFG=$(printf "$GROUP_CFG_TEMPLATE" "$MARKLOGIC_GROUP" "$XDQP_SSL_ENABLED")
163
- log "Info: [poststart] Updating group configuration: ${GROUP_CFG}"
164
- curl --anyauth -m 20 -X PUT -H "Content-type: application/json" -d "${GROUP_CFG}" http://${MARKLOGIC_BOOTSTRAP_HOST}:8002/manage/v2/groups/Default/properties --user ${MARKLOGIC_ADMIN_USERNAME}:${MARKLOGIC_ADMIN_PASSWORD}
165
- sleep 2s
144
+ log () {
145
+ local TIMESTAMP=$(date +"%Y-%m-%d %T.%3N")
146
+ # Check to make sure pod doesn't terminate if PID value is empty for any reason
147
+ # If PID value is empty postStart hook logs are not recorded
148
+ if [ -n "$pid" ]; then
149
+ echo "${TIMESTAMP} $@" > /proc/$pid/fd/1
166
150
fi
167
- log "Info: [poststart] Poststart Hook Execution Completed"
151
+ }
152
+ log "Info: [poststart] Begin Poststart Hook Execution"
153
+ if [[ $POD_NAME != *-0 ]]; then
154
+ log "Info: [poststart] Skipping group configuration."
155
+ else
156
+ while [ ! -f /var/opt/MarkLogic/ready ]; do
157
+ log "[poststart] wait for marklogic server to be ready"
158
+ sleep 5s
159
+ done
160
+ sleep 10s
161
+ GROUP_CFG_TEMPLATE='{"group-name":"%s", "xdqp-ssl-enabled":"%s"}'
162
+ GROUP_CFG=$(printf "$GROUP_CFG_TEMPLATE" "$MARKLOGIC_GROUP" "$XDQP_SSL_ENABLED")
163
+ log "Info: [poststart] Updating group configuration: ${GROUP_CFG}"
164
+ curl --anyauth -m 20 -X PUT -H "Content-type: application/json" -d "${GROUP_CFG}" http://${MARKLOGIC_BOOTSTRAP_HOST}:8002/manage/v2/groups/Default/properties --user ${MARKLOGIC_ADMIN_USERNAME}:${MARKLOGIC_ADMIN_PASSWORD}
165
+ sleep 2s
166
+ fi
167
+ log "Info: [poststart] Poststart Hook Execution Completed"
168
168
{{- end }}
169
169
preStop :
170
170
exec :
171
171
command :
172
172
- bash
173
173
- ' -c'
174
174
- |
175
- MARKLOGIC_ADMIN_USERNAME="$(< /run/secrets/creds /username)"
176
- MARKLOGIC_ADMIN_PASSWORD="$(< /run/secrets/creds /password)"
175
+ MARKLOGIC_ADMIN_USERNAME="$(< /run/secrets/ml-secrets /username)"
176
+ MARKLOGIC_ADMIN_PASSWORD="$(< /run/secrets/ml-secrets /password)"
177
177
178
- log () {
179
- local TIMESTAMP=$(date +"%Y-%m-%d %T.%3N")
180
- # Check to make sure pod doesn't terminate if PID value is empty for any reason
181
- # If PID value is empty preStart hook logs are not recorded
182
- if [ -n "$pid" ]; then
183
- echo "${TIMESTAMP} $@" > /proc/$pid/fd/1
184
- fi
185
- }
178
+ log () {
179
+ local TIMESTAMP=$(date +"%Y-%m-%d %T.%3N")
180
+ # Check to make sure pod doesn't terminate if PID value is empty for any reason
181
+ # If PID value is empty preStart hook logs are not recorded
182
+ if [ -n "$pid" ]; then
183
+ echo "${TIMESTAMP} $@" > /proc/$pid/fd/1
184
+ fi
185
+ }
186
186
187
- pid=$(pgrep start.marklogic)
188
- log "Info: [prestop] Prestop Hook Execution"
187
+ pid=$(pgrep start.marklogic)
188
+ log "Info: [prestop] Prestop Hook Execution"
189
189
190
- my_host=$(hostname -f)
190
+ my_host=$(hostname -f)
191
191
192
- log "Info: [prestop] MarkLogic Pod Hostname: "$my_host
192
+ log "Info: [prestop] MarkLogic Pod Hostname: "$my_host
193
193
194
- for ((i = 0; i < 5; i = i + 1)); do
195
- res_code=$(curl --anyauth --user $MARKLOGIC_ADMIN_USERNAME:$MARKLOGIC_ADMIN_PASSWORD \
196
- -o /dev/null -m 10 -s -w %{http_code} \
197
- -i -X POST --data "state=shutdown&failover=true" \
198
- -H "Content-type: application/x-www-form-urlencoded" \
199
- http://localhost:8002/manage/v2/hosts/$my_host?format=json)
194
+ for ((i = 0; i < 5; i = i + 1)); do
195
+ res_code=$(curl --anyauth --user $MARKLOGIC_ADMIN_USERNAME:$MARKLOGIC_ADMIN_PASSWORD \
196
+ -o /dev/null -m 10 -s -w %{http_code} \
197
+ -i -X POST --data "state=shutdown&failover=true" \
198
+ -H "Content-type: application/x-www-form-urlencoded" \
199
+ http://localhost:8002/manage/v2/hosts/$my_host?format=json)
200
200
201
- if [[ ${res_code} -eq 202 ]]; then
202
- log "Info: [prestop] Host shut down response code: "$res_code
201
+ if [[ ${res_code} -eq 202 ]]; then
202
+ log "Info: [prestop] Host shut down response code: "$res_code
203
203
204
- while (true)
205
- do
206
- ml_status=$(service MarkLogic status)
207
- log "Info: [prestop] MarkLogic Status: "$ml_status
208
- if [[ "$ml_status" =~ "running" ]]; then
209
- sleep 5s
210
- continue
211
- else
212
- break
213
- fi
214
- done
215
- break
216
- else
217
- log "ERROR: [prestop] Retry Attempt: "$i
218
- log "ERROR: [prestop] Host shut down expected response code 202, got "$res_code
219
- sleep 10s
220
- fi
221
- done
204
+ while (true)
205
+ do
206
+ ml_status=$(service MarkLogic status)
207
+ log "Info: [prestop] MarkLogic Status: "$ml_status
208
+ if [[ "$ml_status" =~ "running" ]]; then
209
+ sleep 5s
210
+ continue
211
+ else
212
+ break
213
+ fi
214
+ done
215
+ break
216
+ else
217
+ log "ERROR: [prestop] Retry Attempt: "$i
218
+ log "ERROR: [prestop] Host shut down expected response code 202, got "$res_code
219
+ sleep 10s
220
+ fi
221
+ done
222
222
{{- if .Values.containerSecurityContext.enabled }}
223
223
securityContext : {{- omit .Values.containerSecurityContext "enabled" | toYaml | nindent 12 }}
224
224
{{- end }}
@@ -291,7 +291,7 @@ spec:
291
291
searches :
292
292
- {{ include "marklogic.headlessURL" . }}
293
293
volumes :
294
- - name : admin-creds
294
+ - name : mladmin-secrets
295
295
secret :
296
296
secretName : {{ include "marklogic.fullname" . }}-admin
297
297
{{- if .Values.logCollection.enabled }}
0 commit comments