Skip to content
Snippets Groups Projects
Commit ee29cfe6 authored by georgi.todorov's avatar georgi.todorov
Browse files

Add mongo configs

parent eb4ed44f
No related branches found
No related tags found
1 merge request!1mongo-custom-helm
Pipeline #56197 passed with stages
in 9 seconds
image: nexus.tech.vereign.com:6001/helm:3.5.3
include:
- project: 'gaiax/tsa/ci-helpers'
file: 'helm-package.yml'
stages:
- lint
- package
helm-lint:
extends: .helm-lint
stage: lint
tags:
- amd64-docker
helm-package:
extends: .helm-package
stage: package
tags:
- amd64-docker
apiVersion: v1
appVersion: "v0.0.1"
name: mongodb
version: "0.0.1"
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "mongodb.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "mongodb.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "mongodb.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- define "mongodb.metricsSecret" -}}
{{- if .Values.auth.existingMetricsSecret -}}
{{- .Values.auth.existingMetricsSecret -}}
{{- else -}}
{{- template "mongodb.fullname" . -}}-metrics
{{- end -}}
{{- end -}}
\ No newline at end of file
apiVersion: v1
kind: Service
metadata:
name: {{ template "mongodb.name" . }}
namespace: {{ template "mongodb.name" . }}
labels:
name: {{ template "mongodb.name" . }}
spec:
ports:
- protocol: TCP
port: {{ .Values.port }}
targetPort: {{ .Values.port }}
selector:
name: {{ template "mongodb.name" . }}
clusterIP: None
clusterIPs:
- None
type: ClusterIP
sessionAffinity: None
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
internalTrafficPolicy: Cluster
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: {{ template "mongodb.name" . }}
namespace: {{ template "mongodb.name" . }}
spec:
replicas: {{ .Values.replicas }}
selector:
matchLabels:
name: {{ template "mongodb.name" . }}
template:
metadata:
creationTimestamp: null
labels:
name: {{ template "mongodb.name" . }}
spec:
containers:
- name: {{ template "mongodb.name" . }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
command:
- mongod
- '--port=27017'
- '--dbpath=/data/db'
- '--replSet=rs0'
- '--bind_ip_all'
ports:
- containerPort: {{ .Values.port }}
protocol: TCP
env:
- name: MONGO_INITDB_ROOT_USERNAME
value: {{ .Values.mongo.user }}
- name: MONGO_INITDB_ROOT_PASSWORD
value: {{ .Values.mongo.pass }}
- name: MONGO_REPLICA_SET_NAME
value: {{ .Values.mongo.replicaSetName }}
resources: {}
volumeMounts:
- name: mongo-persistent-storage
mountPath: /data/db
livenessProbe:
exec:
command:
- >-
test $(echo "rs.initiate().ok || rs.status().ok" | mongo -u
root -p root --quiet) -eq 1
initialDelaySeconds: 10
timeoutSeconds: 1
periodSeconds: 30
successThreshold: 1
failureThreshold: 3
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
imagePullPolicy: Always
- name: {{ template "mongodb.name" . }}-sidecar
image: cvallance/mongo-k8s-sidecar
env:
- name: MONGO_SIDECAR_POD_LABELS
value: name=mongo
- name: KUBERNETES_MONGO_SERVICE_NAME
value: {{ template "mongodb.name" . }}
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
imagePullPolicy: Always
restartPolicy: Always
terminationGracePeriodSeconds: 10
dnsPolicy: ClusterFirst
serviceAccountName: {{ template "mongodb.name" . }}
serviceAccount: {{ template "mongodb.name" . }}
securityContext: {}
schedulerName: default-scheduler
volumeClaimTemplates:
- kind: PersistentVolumeClaim
apiVersion: v1
metadata:
name: mongo-persistent-storage
creationTimestamp: null
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.persistentVolume.size | quote }}
storageClassName: standard
volumeMode: Filesystem
serviceName: {{ template "mongodb.name" . }}
podManagementPolicy: OrderedReady
updateStrategy:
type: RollingUpdate
rollingUpdate:
partition: 0
revisionHistoryLimit: 10
\ No newline at end of file
# Mongo replica count
replicas: 1
# Mongo service port
port: 27017
# Mongo replSetName, user and pass
mongo:
replicaSetName: rs0
user: ""
pass: ""
# Specs for the MongoDB image
image:
repository: mongo
tag: 3.6
# Select desired volume size
persistentVolume:
size: 10Gi
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment