Skip to content

Commit

Permalink
feat(*): enable access control (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
Xinzhao Xu authored Jan 13, 2021
1 parent 59a9a57 commit 0a2200f
Showing 1 changed file with 31 additions and 10 deletions.
41 changes: 31 additions & 10 deletions manifests/infra-mongo/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,29 @@ spec:
- name: {{ .Chart.Name }}
image: {{ include "common.images.image" (dict "context" $ "repository" .Values.platformConfig.imageRepositoryLibrary "imageRoot" .Values.image) | quote }}
imagePullPolicy: {{ default "Always" .Values.platformConfig.imagePullPolicy | quote }}
{{- if .Values.command }}
command: {{- include "common.tplvalues.render" ( dict "value" .Values.command "context" $) | nindent 8 }}
{{- else }}
command:
- "mongod"
{{- end }}
env:
- name: MONGO_INITDB_ROOT_USERNAME
valueFrom:
secretKeyRef:
name: mongo-config
key: user
- name: MONGO_INITDB_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mongo-config
key: password
{{- if .Values.args }}
args: {{- include "common.tplvalues.render" ( dict "value" .Values.args "context" $) | nindent 8 }}
{{- else }}
args:
- "--replSet"
- "rs0"
- "--bind_ip"
- "0.0.0.0"
- --replSet
- rs0
- --bind_ip
- 0.0.0.0
- --clusterAuthMode
- keyFile
- --keyFile
- /data/config/mongodb-keyfile
{{- end }}
{{- if .Values.serverPort }}
ports:
Expand All @@ -73,6 +82,18 @@ spec:
value: {{ .Values.serverPort | quote }}
- name: "KUBERNETES_MONGO_SERVICE_NAME"
value: {{ .Values.serviceName | quote }}
- name: MONGODB_USERNAME
valueFrom:
secretKeyRef:
name: mongo-config
key: user
- name: MONGODB_PASSWORD
valueFrom:
secretKeyRef:
name: mongo-config
key: password
- name: MONGODB_DATABASE
value: admin
{{- if .Values.sidecar.resources }}
resources: {{- toYaml .Values.sidecar.resources | nindent 10 }}
{{- end }}
Expand Down

0 comments on commit 0a2200f

Please sign in to comment.