Skip to content

Commit a14a2f8

Browse files
authored
Merge pull request #13 from mongodb/ent-helm
adding SHA users generation
2 parents 3edcf62 + f6ea498 commit a14a2f8

File tree

5 files changed

+66
-2
lines changed

5 files changed

+66
-2
lines changed

charts/ent-operator-database/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
apiVersion: v2
22
name: mongodb-enterprise-database
33
description: MongoDB Kubernetes Enterprise Operator- MongoDB DataBase charts
4-
version: 0.1.2
4+
version: 0.1.4
55
kubeVersion: '>=1.15-0'
66
keywords:
77
- mongodb

charts/ent-operator-database/templates/database.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,14 @@ spec:
2929
security:
3030
authentication:
3131
enabled: true
32-
modes: ["SCRAM"] # Valid authentication modes are "SCRAM' and "X509"
32+
modes:
33+
{{- range .Values.security.authentication.modes }}
34+
- {{ . | quote }} # Valid authentication modes are "SCRAM' and "X509"
35+
{{- end }}
36+
{{- if .Values.security.tls.enabled }}
37+
tls:
38+
enabled: {{ .Values.security.tls.enabled }}
39+
{{- end }}
3340

3441
# Optional field - ignoreUnknownUsers
3542
# A value of true means that any users not configured via the Operator or the Ops Manager or Cloud Manager UI
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{{- range .Values.users }}
2+
---
3+
apiVersion: v1
4+
kind: Secret
5+
metadata:
6+
name: {{ $.Values.name }}-{{ .username }}-secret
7+
namespace: {{ $.Release.Namespace }}
8+
type: Opaque
9+
stringData:
10+
password: {{ .password | quote}}
11+
{{- end }}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{{- range .Values.users }}
2+
---
3+
apiVersion: mongodb.com/v1
4+
kind: MongoDBUser
5+
metadata:
6+
name: {{ $.Values.name }}-{{ .username }}-mongodbuser
7+
namespace: {{ $.Release.Namespace }}
8+
spec:
9+
passwordSecretKeyRef:
10+
name: {{ $.Values.name }}-{{ .username }}-secret # the name of the secret that stores this user's password
11+
key: password # the key in the secret that stores the password
12+
username: {{ .username }}
13+
db: {{ .db }}
14+
mongodbResourceRef:
15+
name: {{ $.Values.name }} # The name of the MongoDB resource this user will be added to
16+
roles:
17+
{{- toYaml .roles | nindent 6 }}
18+
{{- end }}

charts/ent-operator-database/values.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ opsManager:
2525
# Alternatevly an existing secret and config map could be provided directly
2626
configMap: opsmanager-configmap
2727
secretRef: opsmanager-org-access-key
28+
29+
security:
30+
authentication:
31+
modes: ["SCRAM"] # Valid authentication modes are "SCRAM", "LDAP" and "X509"
32+
tls:
33+
enabled: false
34+
35+
2836
resources:
2937
limits:
3038
cpu: 2
@@ -41,3 +49,23 @@ registry:
4149
# TODO: specify for each image and move there?
4250
pullPolicy: Always
4351
# Specify if images are pulled from private registry
52+
53+
users:
54+
- username: admin-user
55+
db: admin
56+
password: "%SomeLong%password$foradmin"
57+
roles:
58+
- db: admin
59+
name: clusterAdmin
60+
- db: admin
61+
name: userAdminAnyDatabase
62+
- db: admin
63+
name: readWrite
64+
- db: admin
65+
name: userAdminAnyDatabase
66+
- username: app-user
67+
db: admin
68+
password: "%SomeLong%password$"
69+
roles:
70+
- db: admin
71+
name: readWrite

0 commit comments

Comments
 (0)