|
3 | 3 | apiVersion: batch/v1
|
4 | 4 | kind: Job
|
5 | 5 | metadata:
|
6 |
| - name: {{ template "nexus.name" . }}-initpwd-job |
| 6 | + name: {{ template "nexus.fullname" . }}-initpwd-job |
7 | 7 | annotations:
|
8 |
| - helm.sh/hook: post-install |
9 |
| - helm.sh/hook-delete-policy: "hook-succeeded,before-hook-creation" |
| 8 | + helm.sh/hook: "post-install" |
| 9 | + helm.sh/hook-weight: "10" |
| 10 | + helm.sh/hook-delete-policy: "before-hook-creation" |
10 | 11 | labels:
|
11 | 12 | {{ include "nexus.labels" . | indent 4 }}
|
12 | 13 | spec:
|
13 | 14 | backoffLimit: 5
|
14 | 15 | template:
|
15 | 16 | metadata:
|
16 |
| - name: {{ template "nexus.name" . }}-initpwd |
| 17 | + name: {{ template "nexus.fullname" . }}-initpwd |
17 | 18 | labels:
|
18 | 19 | app: {{ template "nexus.name" . }}
|
19 | 20 | release: {{ .Release.Name }}
|
20 | 21 | spec:
|
21 | 22 | restartPolicy: Never
|
22 | 23 | containers:
|
23 | 24 | - name: nexus-initpwd
|
24 |
| - image: busybox:1.32.0 |
| 25 | + image: curlimages/curl:7.73.0 |
25 | 26 | command:
|
26 |
| - - /bin/bash |
27 |
| - - -c |
28 |
| - args: |
29 |
| - - >- |
30 |
| - curl -X PUT |
31 |
| - -H "Content-Type: text/plain" |
32 |
| - -H "Authorization: Basic $(NEXUS_AUTHORIZATION)" |
33 |
| - --fail |
34 |
| - -s |
35 |
| - -d "$(ADMIN_PASSWORD)" |
36 |
| - "http://$(NEXUS_HOST)/service/rest/beta/security/users/admin/change-password" |
| 27 | + - /bin/sh |
| 28 | + - -ec |
| 29 | + - | |
| 30 | + curl --fail -X PUT \ |
| 31 | + http://$(NEXUS_HOST)/service/rest/beta/security/users/admin/change-password \ |
| 32 | + -H "Content-Type: text/plain" \ |
| 33 | + -H "Authorization: Basic $(NEXUS_AUTHORIZATION)" \ |
| 34 | + -d "$(ADMIN_PASSWORD)" |
37 | 35 | env:
|
38 | 36 | - name: NEXUS_AUTHORIZATION
|
39 | 37 | valueFrom:
|
40 | 38 | secretKeyRef:
|
41 | 39 | key: nexusAuthorization
|
42 |
| - name: {{ template "nexus.name" . }}-initpwd-secret |
| 40 | + name: {{ template "nexus.fullname" . }}-initpwd-secret |
43 | 41 | - name: NEXUS_HOST
|
44 |
| - value: {{ template "nexus.name" . }}-service.{{ .Release.Namespace }}:{{ .Values.nexus.nexusPort }} |
| 42 | + value: {{ template "nexus.fullname" . }}.{{ .Release.Namespace }}:{{ .Values.nexus.nexusPort }} |
45 | 43 | - name: ADMIN_PASSWORD
|
46 | 44 | valueFrom:
|
47 | 45 | secretKeyRef:
|
48 | 46 | key: adminPassword
|
49 |
| - name: {{ template "nexus.name" . }}-initpwd-secret |
| 47 | + name: {{ template "nexus.fullname" . }}-initpwd-secret |
50 | 48 | ---
|
51 | 49 | apiVersion: v1
|
52 | 50 | kind: Secret
|
53 | 51 | metadata:
|
54 |
| - name: {{ template "nexus.name" . }}-initpwd-secret |
| 52 | + name: {{ template "nexus.fullname" . }}-initpwd-secret |
55 | 53 | annotations:
|
56 |
| - helm.sh/hook: post-install |
| 54 | + helm.sh/hook: "post-install" |
| 55 | + helm.sh/hook-weight: "-10" |
57 | 56 | helm.sh/hook-delete-policy: "hook-succeeded,before-hook-creation"
|
58 | 57 | labels:
|
59 | 58 | {{ include "nexus.labels" . | indent 4 }}
|
60 | 59 | type: Opaque
|
61 | 60 | data:
|
62 |
| - nexusAuthorization: {{ printf "%s%s" "admin:" (default "admin123" .Values.initAdminPassword.defaultPasswordOverride) | b64enc }} |
| 61 | + nexusAuthorization: {{ printf "%s%s" "admin:" (default "admin123" .Values.initAdminPassword.defaultPasswordOverride) | b64enc | b64enc }} |
63 | 62 | adminPassword: {{ .Values.initAdminPassword.password | b64enc }}
|
64 | 63 | {{- end }}
|
0 commit comments