init commit
This commit is contained in:
26
helm/templates/_helpers.tpl
Normal file
26
helm/templates/_helpers.tpl
Normal file
@@ -0,0 +1,26 @@
|
||||
{{- define "mongo.name" -}}
|
||||
{{- printf "%s" .Chart.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "mongo.name.headless" -}}
|
||||
{{- printf "%s-headless" .Chart.Name | trunc 54 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "mongo.name.config" -}}
|
||||
{{- printf "%s-config" .Chart.Name | trunc 56 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "mongo.name.secret" -}}
|
||||
{{- printf "%s-secret" .Chart.Name | trunc 56 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "mongo.name.initialize" -}}
|
||||
{{- printf "%s-initialize" .Chart.Name | trunc 52 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "mongo.labels" -}}
|
||||
app.kubernetes.io/name: {{ include "mongo.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
helm.sh/chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
{{- end -}}
|
||||
16
helm/templates/headless-service.yaml
Normal file
16
helm/templates/headless-service.yaml
Normal file
@@ -0,0 +1,16 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "mongo.name.headless" . }}
|
||||
labels:
|
||||
{{- include "mongo.labels" . | nindent 4 }}
|
||||
spec:
|
||||
clusterIP: None
|
||||
publishNotReadyAddresses: true
|
||||
ports:
|
||||
- port: {{ .Values.service.port }}
|
||||
targetPort: {{ .Values.service.port }}
|
||||
protocol: TCP
|
||||
name: mongodb
|
||||
selector:
|
||||
app.kubernetes.io/name: {{ include "mongo.name" . }}
|
||||
12
helm/templates/secret.yaml
Normal file
12
helm/templates/secret.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ include "mongo.name.secret" . }}
|
||||
labels:
|
||||
{{- include "mongo.labels" . | nindent 4 }}
|
||||
type: Opaque
|
||||
stringData:
|
||||
{{- if .Values.auth.enabled }}
|
||||
MONGO_INITDB_ROOT_PASSWORD: "{{ .Values.auth.rootPassword }}"
|
||||
MONGO_INITDB_ROOT_USERNAME: "{{ .Values.auth.rootUsername }}"
|
||||
{{- end }}
|
||||
18
helm/templates/service.yaml
Normal file
18
helm/templates/service.yaml
Normal file
@@ -0,0 +1,18 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "mongo.name" . }}
|
||||
labels:
|
||||
{{- include "mongo.labels" . | nindent 4 }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
{{- if and .Values.service.loadBalancerIP (ne .Values.service.loadBalancerIP "") }}
|
||||
loadBalancerIP: {{ .Values.service.loadBalancerIP }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- port: {{ .Values.service.port }}
|
||||
targetPort: {{ .Values.service.port }}
|
||||
protocol: TCP
|
||||
name: mongodb
|
||||
selector:
|
||||
app.kubernetes.io/name: {{ include "mongo.name" . }}
|
||||
78
helm/templates/statefulset.yaml
Normal file
78
helm/templates/statefulset.yaml
Normal file
@@ -0,0 +1,78 @@
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: {{ include "mongo.name" . }}
|
||||
labels:
|
||||
{{- include "mongo.labels" . | nindent 4 }}
|
||||
spec:
|
||||
serviceName: {{ include "mongo.name" . }}
|
||||
replicas: {{ .Values.statefulset.replicas }}
|
||||
podManagementPolicy: {{ .Values.statefulset.podManagementPolicy }}
|
||||
updateStrategy:
|
||||
type: {{ .Values.statefulset.updateStrategy.type }}
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: {{ include "mongo.name" . }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ include "mongo.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
spec:
|
||||
{{- if .Values.securityContext.enabled }}
|
||||
securityContext:
|
||||
fsGroup: {{ .Values.securityContext.fsGroup }}
|
||||
runAsUser: {{ .Values.securityContext.runAsUser }}
|
||||
runAsNonRoot: {{ .Values.securityContext.runAsNonRoot }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: mongo
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
args:
|
||||
{{- if .Values.extraCommandLineArgs }}
|
||||
- "{{ .Values.extraCommandLineArgs }}"
|
||||
{{- end }}
|
||||
ports:
|
||||
- containerPort: {{ .Values.service.port }}
|
||||
name: mongodb
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: {{ include "mongo.name.secret" . }}
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /data/db
|
||||
{{- if .Values.readinessProbe.enabled }}
|
||||
readinessProbe:
|
||||
exec:
|
||||
command: {{ toJson .Values.healthCheck.command }}
|
||||
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
|
||||
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
|
||||
successThreshold: {{ .Values.readinessProbe.successThreshold }}
|
||||
{{- end }}
|
||||
{{- if .Values.livenessProbe.enabled }}
|
||||
livenessProbe:
|
||||
exec:
|
||||
command: {{ toJson .Values.healthCheck.command }}
|
||||
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
|
||||
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
|
||||
successThreshold: {{ .Values.livenessProbe.successThreshold }}
|
||||
{{- end }}
|
||||
resources:
|
||||
{{- toYaml .Values.resources | nindent 10 }}
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: data
|
||||
spec:
|
||||
accessModes:
|
||||
{{- toYaml .Values.persistence.accessModes | nindent 10 }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.persistence.size }}
|
||||
{{- if .Values.persistence.storageClass }}
|
||||
storageClassName: {{ .Values.persistence.storageClass }}
|
||||
{{- end }}
|
||||
Reference in New Issue
Block a user