Telemetry: add mongodb chart
This PS adds a mongodb chart. Change-Id: I7038650ca38b1fbae02a14c39d10270e847042c6
This commit is contained in:
parent
637383495b
commit
e5304b45e0
24
mongodb/Chart.yaml
Normal file
24
mongodb/Chart.yaml
Normal file
@ -0,0 +1,24 @@
|
||||
# Copyright 2017 The Openstack-Helm Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
apiVersion: v1
|
||||
description: OpenStack-Helm MongoDB
|
||||
name: mongodb
|
||||
version: 0.1.0
|
||||
home: https://www.mongodb.com
|
||||
sources:
|
||||
- https://github.com/mongodb/mongo
|
||||
- https://git.openstack.org/cgit/openstack/openstack-helm
|
||||
maintainers:
|
||||
- name: OpenStack-Helm Authors
|
19
mongodb/requirements.yaml
Normal file
19
mongodb/requirements.yaml
Normal file
@ -0,0 +1,19 @@
|
||||
|
||||
# Copyright 2017 The Openstack-Helm Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
dependencies:
|
||||
- name: helm-toolkit
|
||||
repository: http://localhost:8879/charts
|
||||
version: 0.1.0
|
28
mongodb/templates/bin/_setup_admin_user.sh.tpl
Normal file
28
mongodb/templates/bin/_setup_admin_user.sh.tpl
Normal file
@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
{{/*
|
||||
Copyright 2017 The Openstack-Helm Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/}}
|
||||
|
||||
set -ex
|
||||
mongo admin \
|
||||
--username "${ADMIN_USER}" \
|
||||
--password "${ADMIN_PASS}" \
|
||||
--eval "db.changeUserPassword(\"${ADMIN_USER}\", \"${ADMIN_PASS}\")" || \
|
||||
mongo admin \
|
||||
--eval "db.createUser({ user: \"${ADMIN_USER}\", \
|
||||
pwd: \"${ADMIN_PASS}\", \
|
||||
roles: [ { role: \"userAdminAnyDatabase\", \
|
||||
db: \"admin\" } ] });"
|
20
mongodb/templates/bin/_start.sh.tpl
Normal file
20
mongodb/templates/bin/_start.sh.tpl
Normal file
@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
{{/*
|
||||
Copyright 2017 The Openstack-Helm Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/}}
|
||||
|
||||
set -ex
|
||||
exec mongod --auth
|
29
mongodb/templates/configmap-bin.yaml
Normal file
29
mongodb/templates/configmap-bin.yaml
Normal file
@ -0,0 +1,29 @@
|
||||
{{/*
|
||||
Copyright 2017 The Openstack-Helm Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/}}
|
||||
|
||||
{{- if .Values.manifests.configmap_bin }}
|
||||
{{- $envAll := . }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: mongodb-bin
|
||||
data:
|
||||
start.sh: |
|
||||
{{ tuple "bin/_start.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
|
||||
setup_admin_user.sh: |
|
||||
{{ tuple "bin/_setup_admin_user.sh.tpl" . | include "helm-toolkit.utils.template" | indent 4 }}
|
||||
{{- end }}
|
28
mongodb/templates/secret-db-root-password.yaml
Normal file
28
mongodb/templates/secret-db-root-password.yaml
Normal file
@ -0,0 +1,28 @@
|
||||
{{/*
|
||||
Copyright 2017 The Openstack-Helm Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/}}
|
||||
|
||||
{{- if .Values.manifests.secret_db_root_creds }}
|
||||
{{- $envAll := . }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: mongodb-root-creds
|
||||
type: Opaque
|
||||
data:
|
||||
MONGODB_ROOT_PASSWORD: {{ .Values.endpoints.mongodb.auth.admin.password | b64enc }}
|
||||
MONGODB_ROOT_USERNAME: {{ .Values.endpoints.mongodb.auth.admin.username | b64enc }}
|
||||
{{- end }}
|
30
mongodb/templates/service.yaml
Normal file
30
mongodb/templates/service.yaml
Normal file
@ -0,0 +1,30 @@
|
||||
{{/*
|
||||
Copyright 2017 The Openstack-Helm Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/}}
|
||||
|
||||
{{- if .Values.manifests.service }}
|
||||
{{- $envAll := . }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ tuple "mongodb" "internal" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
|
||||
spec:
|
||||
ports:
|
||||
- name: db
|
||||
port: {{ tuple "mongodb" "internal" "mongodb" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
|
||||
selector:
|
||||
{{ tuple $envAll "mongodb" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
|
||||
{{- end }}
|
109
mongodb/templates/statefulset.yaml
Normal file
109
mongodb/templates/statefulset.yaml
Normal file
@ -0,0 +1,109 @@
|
||||
{{/*
|
||||
Copyright 2017 The Openstack-Helm Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/}}
|
||||
|
||||
{{- if .Values.manifests.statefulset }}
|
||||
{{- $envAll := . }}
|
||||
---
|
||||
apiVersion: apps/v1beta1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: mongodb
|
||||
spec:
|
||||
serviceName: {{ tuple "mongodb" "internal" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
|
||||
replicas: {{ .Values.pod.replicas.server }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{ tuple $envAll "mongodb" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }}
|
||||
spec:
|
||||
affinity:
|
||||
{{ tuple $envAll "mongodb" "server" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }}
|
||||
nodeSelector:
|
||||
{{ .Values.labels.node_selector_key }}: {{ .Values.labels.node_selector_value }}
|
||||
containers:
|
||||
- name: mongodb
|
||||
image: {{ .Values.images.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
|
||||
lifecycle:
|
||||
postStart:
|
||||
exec:
|
||||
command:
|
||||
- /tmp/setup_admin_user.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 }}
|
||||
- name: mongodb-data
|
||||
hostPath:
|
||||
path: {{ .Values.storage.host.host_path }}
|
||||
{{- else }}
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: mongodb-data
|
||||
annotations:
|
||||
{{ .Values.storage.pvc.class_path }}: {{ .Values.storage.pvc.class_name }}
|
||||
spec:
|
||||
accessModes: [ "ReadWriteOnce" ]
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.storage.pvc.size }}
|
||||
{{- end }}
|
||||
{{- end }}
|
78
mongodb/values.yaml
Normal file
78
mongodb/values.yaml
Normal file
@ -0,0 +1,78 @@
|
||||
# Copyright 2017 The Openstack-Helm Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Default values for mongodb.
|
||||
# This is a YAML-formatted file.
|
||||
# Declare variables to be passed into your templates.
|
||||
|
||||
pod:
|
||||
affinity:
|
||||
anti:
|
||||
type:
|
||||
default: preferredDuringSchedulingIgnoredDuringExecution
|
||||
topologyKey:
|
||||
default: kubernetes.io/hostname
|
||||
replicas:
|
||||
#only 1 replica currently supported
|
||||
server: 1
|
||||
resources:
|
||||
enabled: false
|
||||
server:
|
||||
requests:
|
||||
memory: "128Mi"
|
||||
cpu: "100m"
|
||||
limits:
|
||||
memory: "1024Mi"
|
||||
cpu: "2000m"
|
||||
|
||||
# using dockerhub mongodb: https://hub.docker.com/r/library/mongo/tags/
|
||||
images:
|
||||
mongodb: docker.io/mongo:3.4.9-jessie
|
||||
pull_policy: IfNotPresent
|
||||
|
||||
storage:
|
||||
pvc:
|
||||
enabled: false
|
||||
size: 5Gi
|
||||
class_name: general
|
||||
class_path: volume.beta.kubernetes.io/storage-class
|
||||
host:
|
||||
host_path: /var/lib/openstack-helm/mongodb
|
||||
|
||||
labels:
|
||||
node_selector_key: openstack-control-plane
|
||||
node_selector_value: enabled
|
||||
|
||||
endpoints:
|
||||
cluster_domain_suffix: cluster.local
|
||||
mongodb:
|
||||
auth:
|
||||
admin:
|
||||
username: root
|
||||
password: password
|
||||
hosts:
|
||||
default: mongodb
|
||||
host_fqdn_override:
|
||||
default: null
|
||||
path: null
|
||||
scheme: mongodb
|
||||
port:
|
||||
mongodb:
|
||||
default: 27017
|
||||
|
||||
manifests:
|
||||
configmap_bin: true
|
||||
secret_db_root_creds: true
|
||||
service: true
|
||||
statefulset: true
|
@ -130,7 +130,6 @@ if [ "x$INTEGRATION" == "xmulti" ]; then
|
||||
helm install --namespace=openstack ${WORK_DIR}/postgresql --name=postgresql
|
||||
helm install --namespace=openstack ${WORK_DIR}/gnocchi --name=gnocchi
|
||||
helm install --namespace=openstack ${WORK_DIR}/mongodb --name=mongodb
|
||||
helm install --namespace=openstack ${WORK_DIR}/ceilometer --name=ceilometer
|
||||
fi
|
||||
kube_wait_for_pods openstack ${POD_START_TIMEOUT_OPENSTACK}
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user