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 }} {{ .Values.labels.server.node_selector_key }}: {{ .Values.labels.server.node_selector_value }}
initContainers: initContainers:
{{ tuple $envAll $dependencies list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} {{ tuple $envAll $dependencies list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }}
containers: {{- if $envAll.Values.volume.chown_on_start }}
- name: mongodb - name: mongodb-perms
image: {{ .Values.images.tags.mongodb }} image: {{ $envAll.Values.images.tags.mongodb }}
imagePullPolicy: {{ .Values.images.pull_policy }} imagePullPolicy: {{ $envAll.Values.images.pull_policy }}
ports: securityContext:
- containerPort: {{ tuple "mongodb" "internal" "mongodb" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} runAsUser: 0
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 }} {{ tuple $envAll $envAll.Values.pod.resources.server | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
volumeMounts: command:
- name: mongodb-bin - chown
mountPath: /tmp/start.sh - -R
subPath: start.sh - "mongodb:"
readOnly: true - {{ $envAll.Values.volume.host.host_path }}
- name: mongodb-bin volumeMounts:
mountPath: /tmp/setup_admin_user.sh - name: mongodb-data
subPath: setup_admin_user.sh mountPath: {{ $envAll.Values.volume.host.host_path }}
readOnly: true {{- end }}
- name: mongodb-data containers:
mountPath: /data/db - 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: volumes:
- name: mongodb-bin - name: mongodb-bin
configMap: configMap:
name: mongodb-bin name: mongodb-bin
defaultMode: 0555 defaultMode: 0555
{{- if not .Values.storage.pvc.enabled }} {{- if not .Values.volume.enabled }}
- name: mongodb-data - name: mongodb-data
hostPath: hostPath:
path: {{ .Values.storage.host.host_path }} path: {{ .Values.volume.host_path }}
{{- else }} {{- else }}
volumeClaimTemplates: volumeClaimTemplates:
- metadata: - metadata:
name: mongodb-data name: mongodb-data
annotations: annotations:
{{ .Values.storage.pvc.class_path }}: {{ .Values.storage.pvc.class_name }} {{ .Values.volume.class_path }}: {{ .Values.volume.class_name }}
spec: spec:
accessModes: [ "ReadWriteOnce" ] accessModes: [ "ReadWriteOnce" ]
resources: resources:
requests: requests:
storage: {{ .Values.storage.pvc.size }} storage: {{ .Values.volume.size }}
{{- end }} {{- end }}
{{- end }} {{- end }}

View File

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