Skip to content

Commit 877b640

Browse files
committed
set password default users: admin & app
1 parent 13ef886 commit 877b640

File tree

3 files changed

+52
-0
lines changed

3 files changed

+52
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# © Copyright IBM Corporation 2022, 2023, 2024
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
{{- if .Values.secretCredentials.enable }}
15+
kind: Secret
16+
apiVersion: v1
17+
metadata:
18+
name: {{ include "ibm-mq.fullname" . }}-credentials
19+
labels:
20+
{{- include "ibm-mq.labels" . | nindent 4 }}
21+
stringData:
22+
{{- if .Values.secretCredentials.admin }}
23+
mqAdminPassword: {{ .Values.secretCredentials.admin }}
24+
{{- end }}
25+
{{- if .Values.secretCredentials.app }}
26+
mqAppPassword: {{ .Values.secretCredentials.app }}
27+
{{- end}}
28+
type: Opaque
29+
{{- end }}

charts/ibm-mq/templates/stateful-set.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,8 @@ spec:
131131
volumes:
132132
{{- else if .Values.security.readOnlyRootFilesystem }}
133133
volumes:
134+
{{- else if .Values.secretCredentials.enable }}
135+
volumes:
134136
{{- end}}
135137
{{- if .Values.queueManager.multiinstance.enable }}
136138
- name: {{ $dataVolumeClaimName }}
@@ -260,6 +262,12 @@ spec:
260262
- name: tmp-volume
261263
emptyDir: {}
262264
{{- end }}
265+
{{- if or .Values.secretCredentials.enable }}
266+
- name: mq-credentials
267+
secret:
268+
defaultMode: 420
269+
secretName: {{ include "ibm-mq.fullname" . }}-credentials
270+
{{- end }}
263271
terminationGracePeriodSeconds: {{.Values.queueManager.terminationGracePeriodSeconds}}
264272
containers:
265273
- name: qmgr
@@ -352,6 +360,8 @@ spec:
352360
volumeMounts:
353361
{{- else if .Values.security.readOnlyRootFilesystem }}
354362
volumeMounts:
363+
{{- else if .Values.secretCredentials.enable }}
364+
volumeMounts:
355365
{{- end}}
356366
{{- if .Values.queueManager.nativeha.tls }}
357367
{{- if .Values.queueManager.nativeha.tls.secretName }}
@@ -443,6 +453,10 @@ spec:
443453
- mountPath: "/tmp"
444454
name: tmp-volume
445455
{{- end }}
456+
{{- if .Values.secretCredentials.enable }}
457+
- name: mq-credentials
458+
mountPath: "/var/run/secrets"
459+
{{- end }}
446460
securityContext:
447461
allowPrivilegeEscalation: false
448462
readOnlyRootFilesystem: {{ .Values.security.readOnlyRootFilesystem }}

charts/ibm-mq/values.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@ image:
2525
# pullPolicy is either IfNotPresent or Always (https://kubernetes.io/docs/concepts/containers/images/)
2626
pullPolicy: IfNotPresent
2727

28+
# User credentials configuration
29+
secretCredentials:
30+
# enabled is whether to configure user credentials via secret or not. (in MQ /run/secrets directory)
31+
enable: false
32+
# set the admin user password
33+
admin: ""
34+
# set the app user password
35+
app: ""
36+
2837
# metadata allows setting of additional labels and annottations to be added to all resources. Set on helm install using --set metadata.labels.KEY=VALUE,metadata.labels.=VALUE,...
2938
metadata:
3039
labels: {}

0 commit comments

Comments
 (0)