Sync mongodb chart

This patch set polishes and fixes the mongodb chart.

* key and naming convention matches mariadb's convention;
* fix indentation;
* add in the ability to handle chown_on_start.

Change-Id: I5804eb730a55a192f3cd1518fbccf2416dddcefa
Signed-off-by: Tin Lam <tin@irrational.io>
This commit is contained in:
Tin Lam 2018-04-26 11:18:45 -05:00
parent 7554196a22
commit 5486403e04
2 changed files with 74 additions and 56 deletions

View File

@ -40,72 +40,88 @@ spec:
{{ .Values.labels.server.node_selector_key }}: {{ .Values.labels.server.node_selector_value }}
initContainers:
{{ tuple $envAll $dependencies list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
containers:
- name: mongodb
image: {{ .Values.images.tags.mongodb }}
imagePullPolicy: {{ .Values.images.pull_policy }}
ports:
- containerPort: {{ tuple "mongodb" "internal" "mongodb" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
env:
- name: ADMIN_PASS
valueFrom:
secretKeyRef:
name: mongodb-root-creds
key: MONGODB_ROOT_PASSWORD
- name: ADMIN_USER
valueFrom:
secretKeyRef:
name: mongodb-root-creds
key: MONGODB_ROOT_USERNAME
command:
- /tmp/start.sh
livenessProbe:
exec:
command:
- mongo
- --eval
- "db.adminCommand('ping')"
initialDelaySeconds: 20
timeoutSeconds: 5
readinessProbe:
exec:
command:
- mongo
- --eval
- "db.adminCommand('ping')"
initialDelaySeconds: 20
timeoutSeconds: 5
{{- if $envAll.Values.volume.chown_on_start }}
- name: mongodb-perms
image: {{ $envAll.Values.images.tags.mongodb }}
imagePullPolicy: {{ $envAll.Values.images.pull_policy }}
securityContext:
runAsUser: 0
{{ tuple $envAll $envAll.Values.pod.resources.server | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
volumeMounts:
- name: mongodb-bin
mountPath: /tmp/start.sh
subPath: start.sh
readOnly: true
- name: mongodb-bin
mountPath: /tmp/setup_admin_user.sh
subPath: setup_admin_user.sh
readOnly: true
- name: mongodb-data
mountPath: /data/db
command:
- chown
- -R
- "mongodb:"
- {{ $envAll.Values.volume.host.host_path }}
volumeMounts:
- name: mongodb-data
mountPath: {{ $envAll.Values.volume.host.host_path }}
{{- end }}
containers:
- name: mongodb
image: {{ .Values.images.tags.mongodb }}
imagePullPolicy: {{ .Values.images.pull_policy }}
ports:
- containerPort: {{ tuple "mongodb" "internal" "mongodb" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
env:
- name: ADMIN_PASS
valueFrom:
secretKeyRef:
name: mongodb-root-creds
key: MONGODB_ROOT_PASSWORD
- name: ADMIN_USER
valueFrom:
secretKeyRef:
name: mongodb-root-creds
key: MONGODB_ROOT_USERNAME
command:
- /tmp/start.sh
livenessProbe:
exec:
command:
- mongo
- --eval
- "db.adminCommand('ping')"
initialDelaySeconds: 20
timeoutSeconds: 5
readinessProbe:
exec:
command:
- mongo
- --eval
- "db.adminCommand('ping')"
initialDelaySeconds: 20
timeoutSeconds: 5
{{ tuple $envAll $envAll.Values.pod.resources.server | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
volumeMounts:
- name: mongodb-bin
mountPath: /tmp/start.sh
subPath: start.sh
readOnly: true
- name: mongodb-bin
mountPath: /tmp/setup_admin_user.sh
subPath: setup_admin_user.sh
readOnly: true
- name: mongodb-data
mountPath: /data/db
volumes:
- name: mongodb-bin
configMap:
name: mongodb-bin
defaultMode: 0555
{{- if not .Values.storage.pvc.enabled }}
{{- if not .Values.volume.enabled }}
- name: mongodb-data
hostPath:
path: {{ .Values.storage.host.host_path }}
path: {{ .Values.volume.host_path }}
{{- else }}
volumeClaimTemplates:
- metadata:
name: mongodb-data
annotations:
{{ .Values.storage.pvc.class_path }}: {{ .Values.storage.pvc.class_name }}
{{ .Values.volume.class_path }}: {{ .Values.volume.class_name }}
spec:
accessModes: [ "ReadWriteOnce" ]
resources:
requests:
storage: {{ .Values.storage.pvc.size }}
storage: {{ .Values.volume.size }}
{{- end }}
{{- end }}

View File

@ -16,6 +16,8 @@
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
release_group: null
pod:
affinity:
anti:
@ -43,12 +45,12 @@ images:
dep_check: quay.io/stackanetes/kubernetes-entrypoint:v0.3.0
pull_policy: IfNotPresent
storage:
pvc:
enabled: false
size: 5Gi
class_name: general
class_path: volume.beta.kubernetes.io/storage-class
volume:
chown_on_start: true
enabled: false
size: 5Gi
class_name: general
class_path: volume.beta.kubernetes.io/storage-class
host:
host_path: /var/lib/openstack-helm/mongodb