Skip to content

Commit e448a4a

Browse files
Merge pull request #45 from barkhachoithani/feature/CLD-568
CLD-568: Use Random Password for Admin in Helm Chart Deployment
2 parents 4a03482 + 2997e37 commit e448a4a

File tree

2 files changed

+51
-2
lines changed

2 files changed

+51
-2
lines changed

README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,44 @@ helm install my-release marklogic/marklogic --version=1.0.0-ea1 \
221221

222222
We recommend that you use the `values.yaml` file for configuring your installation.
223223

224+
## Setting MarkLogic admin password
225+
226+
By default, a randomly generated aphanumeric value will be set for MarkLogic admin password. This value is stored in Kuberenetes secrets.
227+
User can also set a custom password by setting a value for adminPassword in the values.yaml file or using the `--set` flag.
228+
To retrieve the randomly generated admin password, use the following commands:
229+
230+
1. List the secrets for helm deployment:
231+
```
232+
kubectl get secrets
233+
```
234+
The output will be similar to:
235+
236+
| NAME | TYPE | DATA | AGE |
237+
| :--- | :---: | ---: | ---: |
238+
| dnode-group-marklogic | kubernetes.io/basic-auth | 2 | 33s |
239+
240+
2. Get the encoded value for admin password:
241+
```
242+
kubectl get secret dnode-group-marklogic -o jsonpath='{.data}'
243+
```
244+
The output will be similar to:
245+
```
246+
{"password":"R0JYaWxzR2c=","username":"YWRtaW4="}
247+
```
248+
3. Decode the password secret:
249+
```
250+
echo 'R0JYaWxzR2c=' | base64 --decode
251+
```
252+
The output will be similar to:
253+
```
254+
GBXilsGg
255+
```
256+
257+
To upgrade the helm charts or deploy new helm charts for multi-node cluster, use the encoded value for admin password from the output of step 2.
258+
259+
To access the MarkLogic cluster use the decode value for admin password from the output of step 3.
260+
261+
224262
### Log Collection
225263

226264
To enable log collection for all Marklogic logs set logCollection.enabled to true. Set each option in logCollection.files to true of false depending on if you want to track each type of Marklogic log file.

charts/templates/secret.yaml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
{{- $adminPassword := (randAlphaNum 10) | b64enc | quote }}
2+
{{- $secret := (lookup "v1" "Secret" .Release.Namespace .Release.Name ) }}
3+
{{- if $secret }}
4+
{{- $adminPassword = index $secret.data "password" }}
5+
{{- end -}}
6+
17
apiVersion: v1
28
kind: Secret
39
metadata:
@@ -6,6 +12,11 @@ metadata:
612
labels:
713
{{- include "marklogic.labels" . | nindent 4 }}
814
type: kubernetes.io/basic-auth
15+
data:
16+
{{- if .Values.auth.adminPassword }}
17+
password: {{ .Values.auth.adminPassword | b64enc | quote }}
18+
{{- else }}
19+
password: {{ $adminPassword }}
20+
{{- end }}
921
stringData:
10-
username: {{ .Values.auth.adminUsername}}
11-
password: {{ .Values.auth.adminPassword}}
22+
username: {{ .Values.auth.adminUsername }}

0 commit comments

Comments
 (0)