update
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
CHART NAME: {{ .Chart.Name }}
|
||||
CHART VERSION: {{ .Chart.Version }}
|
||||
APP VERSION: {{ .Chart.AppVersion }}
|
||||
|
||||
** Please be patient while the chart is being deployed **
|
||||
|
||||
{{- if .Values.diagnosticMode.enabled }}
|
||||
The chart has been deployed in diagnostic mode. All probes have been disabled and the command has been overwritten with:
|
||||
|
||||
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 4 }}
|
||||
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 4 }}
|
||||
|
||||
Get the list of pods by executing:
|
||||
|
||||
kubectl get pods --namespace {{ .Release.Namespace }} -l app.kubernetes.io/instance={{ .Release.Name }}
|
||||
|
||||
Access the pod you want to debug by executing
|
||||
|
||||
kubectl exec --namespace {{ .Release.Namespace }} -ti <NAME OF THE POD> -- bash
|
||||
|
||||
In order to replicate the container startup scripts execute this command:
|
||||
|
||||
/opt/bitnami/scripts/mongodb-sharded/entrypoint.sh /opt/bitnami/scripts/mongodb-sharded/run.sh
|
||||
|
||||
{{- else }}
|
||||
|
||||
The MongoDB® Sharded cluster can be accessed via the Mongos instances in port {{ .Values.service.port }} on the following DNS name from within your cluster:
|
||||
|
||||
{{ include "mongodb-sharded.serviceName" . }}.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}
|
||||
|
||||
To get the root password run:
|
||||
|
||||
export MONGODB_ROOT_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ include "common.names.fullname" . }} -o jsonpath="{.data.mongodb-root-password}" | base64 --decode)
|
||||
|
||||
{{- if and .Values.mongodbUsername .Values.mongodbDatabase }}
|
||||
{{- if .Values.mongodbPassword }}
|
||||
|
||||
To get the password for "{{ .Values.mongodbUsername }}" run:
|
||||
|
||||
export MONGODB_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ include "common.names.fullname" . }} -o jsonpath="{.data.mongodb-password}" | base64 --decode)
|
||||
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
To connect to your database run the following command:
|
||||
|
||||
kubectl run --namespace {{ .Release.Namespace }} {{ include "common.names.fullname" . }}-client --rm --tty -i --restart='Never' --image {{ template "mongodb-sharded.image" . }} --command -- mongo admin --host {{ include "mongodb-sharded.serviceName" . }} {{- if .Values.usePassword }} --authenticationDatabase admin -u root -p $MONGODB_ROOT_PASSWORD{{- end }}
|
||||
|
||||
To connect to your database from outside the cluster execute the following commands:
|
||||
|
||||
{{- if contains "NodePort" .Values.service.type }}
|
||||
|
||||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
||||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "mongodb-sharded.serviceName" . }})
|
||||
mongo --host $NODE_IP --port $NODE_PORT --authenticationDatabase admin -p $MONGODB_ROOT_PASSWORD
|
||||
|
||||
{{- else if contains "LoadBalancer" .Values.service.type }}
|
||||
|
||||
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
|
||||
Watch the status with: 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ include "mongodb-sharded.serviceName" . }}'
|
||||
|
||||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "mongodb-sharded.serviceName" . }} --include "{{ "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}" }}")
|
||||
mongo --host $SERVICE_IP --port {{ .Values.service.port }} --authenticationDatabase admin -p $MONGODB_ROOT_PASSWORD
|
||||
|
||||
{{- else if contains "ClusterIP" .Values.service.type }}
|
||||
|
||||
kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ include "mongodb-sharded.serviceName" . }} {{ .Values.service.port }}:{{ .Values.service.port }} &
|
||||
mongo --host 127.0.0.1 --authenticationDatabase admin -p $MONGODB_ROOT_PASSWORD
|
||||
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- include "mongodb-sharded.validateValues" . -}}
|
||||
{{- include "mongodb-sharded.checkRollingTags" . -}}
|
||||
@@ -0,0 +1,266 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
|
||||
{{/*
|
||||
Returns a ServiceAccount name for specified path or falls back to `common.serviceAccount.name`
|
||||
if `common.serviceAccount.create` is set to true. Falls back to Chart's fullname otherwise.
|
||||
Usage:
|
||||
{{ include "mongodb-sharded.serviceAccountName" (dict "value" .Values.path.to.serviceAccount "context" $) }}
|
||||
*/}}
|
||||
{{- define "mongodb-sharded.serviceAccountName" -}}
|
||||
{{- if .value.create }}
|
||||
{{- default (include "common.names.fullname" .context) .value.name | quote }}
|
||||
{{- else if .context.Values.common.serviceAccount.create }}
|
||||
{{- default (include "common.names.fullname" .context) .context.Values.common.serviceAccount.name | quote }}
|
||||
{{- else -}}
|
||||
{{- default "default" .value.name | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Renders a ServiceAccount for specified name.
|
||||
Usage:
|
||||
{{ include "mongodb-sharded.serviceaccount" (dict "value" .Values.path.to.serviceAccount "context" $) }}
|
||||
*/}}
|
||||
{{- define "mongodb-sharded.serviceaccount" -}}
|
||||
{{- if .value.create -}}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ include "mongodb-sharded.serviceAccountName" (dict "value" .value "context" .context) }}
|
||||
labels:
|
||||
{{- include "common.labels.standard" .context | nindent 4 }}
|
||||
---
|
||||
{{ end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "mongodb-sharded.secret" -}}
|
||||
{{- if .Values.existingSecret -}}
|
||||
{{- .Values.existingSecret -}}
|
||||
{{- else }}
|
||||
{{- include "common.names.fullname" . -}}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "mongodb-sharded.configServer.primaryHost" -}}
|
||||
{{- if .Values.configsvr.external.host -}}
|
||||
{{- .Values.configsvr.external.host }}
|
||||
{{- else -}}
|
||||
{{- printf "%s-configsvr-0.%s-headless.%s.svc.%s" (include "common.names.fullname" . ) (include "common.names.fullname" .) .Release.Namespace .Values.clusterDomain -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "mongodb-sharded.configServer.rsName" -}}
|
||||
{{- if .Values.configsvr.external.replicasetName -}}
|
||||
{{- .Values.configsvr.external.replicasetName }}
|
||||
{{- else }}
|
||||
{{- printf "%s-configsvr" ( include "common.names.fullname" . ) -}}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "mongodb-sharded.mongos.configCM" -}}
|
||||
{{- if .Values.mongos.configCM -}}
|
||||
{{- .Values.mongos.configCM -}}
|
||||
{{- else }}
|
||||
{{- printf "%s-mongos" (include "common.names.fullname" .) -}}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "mongodb-sharded.shardsvr.dataNode.configCM" -}}
|
||||
{{- if .Values.shardsvr.dataNode.configCM -}}
|
||||
{{- .Values.shardsvr.dataNode.configCM -}}
|
||||
{{- else }}
|
||||
{{- printf "%s-shardsvr-data" (include "common.names.fullname" .) -}}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "mongodb-sharded.shardsvr.arbiter.configCM" -}}
|
||||
{{- if .Values.shardsvr.arbiter.configCM -}}
|
||||
{{- .Values.shardsvr.arbiter.configCM -}}
|
||||
{{- else }}
|
||||
{{- printf "%s-shardsvr-arbiter" (include "common.names.fullname" .) -}}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "mongodb-sharded.configsvr.configCM" -}}
|
||||
{{- if .Values.configsvr.configCM -}}
|
||||
{{- .Values.configsvr.configCM -}}
|
||||
{{- else }}
|
||||
{{- printf "%s-configsvr" (include "common.names.fullname" .) -}}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Get the initialization scripts Secret name.
|
||||
*/}}
|
||||
{{- define "mongodb-sharded.initScriptsSecret" -}}
|
||||
{{- printf "%s" (include "common.tplvalues.render" (dict "value" .Values.common.initScriptsSecret "context" $)) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Get the initialization scripts configmap name.
|
||||
*/}}
|
||||
{{- define "mongodb-sharded.initScriptsCM" -}}
|
||||
{{- printf "%s" (include "common.tplvalues.render" (dict "value" .Values.common.initScriptsCM "context" $)) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create the name for the admin secret.
|
||||
*/}}
|
||||
{{- define "mongodb-sharded.adminSecret" -}}
|
||||
{{- if .Values.auth.existingAdminSecret -}}
|
||||
{{- .Values.auth.existingAdminSecret -}}
|
||||
{{- else -}}
|
||||
{{- include "common.names.fullname" . -}}-admin
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create the name for the key secret.
|
||||
*/}}
|
||||
{{- define "mongodb-sharded.keySecret" -}}
|
||||
{{- if .Values.auth.existingKeySecret -}}
|
||||
{{- .Values.auth.existingKeySecret -}}
|
||||
{{- else -}}
|
||||
{{- include "common.names.fullname" . -}}-keyfile
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Returns the proper Service name depending if an explicit service name is set
|
||||
in the values file. If the name is not explicitly set it will take the "common.names.fullname"
|
||||
*/}}
|
||||
{{- define "mongodb-sharded.serviceName" -}}
|
||||
{{- if .Values.service.name -}}
|
||||
{{ .Values.service.name }}
|
||||
{{- else -}}
|
||||
{{ include "common.names.fullname" . }}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper MongoDB® image name
|
||||
*/}}
|
||||
{{- define "mongodb-sharded.image" -}}
|
||||
{{ include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper image name (for the metrics image)
|
||||
*/}}
|
||||
{{- define "mongodb-sharded.metrics.image" -}}
|
||||
{{ include "common.images.image" (dict "imageRoot" .Values.metrics.image "global" .Values.global) }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper image name (for the init container volume-permissions image)
|
||||
*/}}
|
||||
{{- define "mongodb-sharded.volumePermissions.image" -}}
|
||||
{{ include "common.images.image" (dict "imageRoot" .Values.volumePermissions.image "global" .Values.global) }}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Return the proper Docker Image Registry Secret Names
|
||||
*/}}
|
||||
{{- define "mongodb-sharded.imagePullSecrets" -}}
|
||||
{{- include "common.images.pullSecrets" (dict "images" (list .Values.image .Values.metrics.image .Values.volumePermissions.image) "global" .Values.global) -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Compile all warnings into a single message, and call fail.
|
||||
*/}}
|
||||
{{- define "mongodb-sharded.validateValues" -}}
|
||||
{{- $messages := list -}}
|
||||
{{- $messages := append $messages (include "mongodb-sharded.validateValues.mongodbCustomDatabase" .) -}}
|
||||
{{- $messages := append $messages (include "mongodb-sharded.validateValues.externalCfgServer" .) -}}
|
||||
{{- $messages := append $messages (include "mongodb-sharded.validateValues.replicas" .) -}}
|
||||
{{- $messages := append $messages (include "mongodb-sharded.validateValues.config" .) -}}
|
||||
{{- $messages := without $messages "" -}}
|
||||
{{- $message := join "\n" $messages -}}
|
||||
|
||||
{{- if $message -}}
|
||||
{{- printf "\nVALUES VALIDATION:\n%s" $message | fail -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Validate values of MongoDB® - both mongodbUsername and mongodbDatabase are necessary
|
||||
to create a custom user and database during 1st initialization
|
||||
*/}}
|
||||
{{- define "mongodb-sharded.validateValues.mongodbCustomDatabase" -}}
|
||||
{{- if or (and .Values.mongodbUsername (not .Values.mongodbDatabase)) (and (not .Values.mongodbUsername) .Values.mongodbDatabase) }}
|
||||
mongodb: mongodbUsername, mongodbDatabase
|
||||
Both mongodbUsername and mongodbDatabase must be provided to create
|
||||
a custom user and database during 1st initialization.
|
||||
Please set both of them (--set mongodbUsername="xxxx",mongodbDatabase="yyyy")
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Validate values of MongoDB® - If using an external config server, then both the host and the replicaset name should be set.
|
||||
*/}}
|
||||
{{- define "mongodb-sharded.validateValues.externalCfgServer" -}}
|
||||
{{- if and .Values.configsvr.external.replicasetName (not .Values.configsvr.external.host) -}}
|
||||
mongodb: invalidExternalConfigServer
|
||||
You specified a replica set name for the external config server but not a host. Set both configsvr.external.replicasetName and configsvr.external.host
|
||||
{{- end -}}
|
||||
{{- if and (not .Values.configsvr.external.replicasetName) .Values.configsvr.external.host -}}
|
||||
mongodb: invalidExternalConfigServer
|
||||
You specified a host for the external config server but not the replica set name. Set both configsvr.external.replicasetName and configsvr.external.host
|
||||
{{- end -}}
|
||||
{{- if and .Values.configsvr.external.host (not .Values.configsvr.external.rootPassword) -}}
|
||||
mongodb: invalidExternalConfigServer
|
||||
You specified a host for the external config server but not the root password. Set the configsvr.external.rootPassword value.
|
||||
{{- end -}}
|
||||
{{- if and .Values.configsvr.external.host (not .Values.configsvr.external.replicasetKey) -}}
|
||||
mongodb: invalidExternalConfigServer
|
||||
You specified a host for the external config server but not the replica set key. Set the configsvr.external.replicasetKey value.
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Validate values of MongoDB® - The number of shards must be positive, as well as the data node replicas
|
||||
*/}}
|
||||
{{- define "mongodb-sharded.validateValues.replicas" -}}
|
||||
{{- if and (le (int .Values.shardsvr.dataNode.replicas) 0) (ge (int .Values.shards) 1) }}
|
||||
mongodb: invalidShardSvrReplicas
|
||||
You specified an invalid number of replicas per shard. Please set shardsvr.dataNode.replicas with a positive number or set the number of shards to 0.
|
||||
{{- end -}}
|
||||
{{- if lt (int .Values.shardsvr.arbiter.replicas) 0 }}
|
||||
mongodb: invalidShardSvrArbiters
|
||||
You specified an invalid number of arbiters per shard. Please set shardsvr.arbiter.replicas with a number greater or equal than 0
|
||||
{{- end -}}
|
||||
{{- if and (le (int .Values.configsvr.replicas) 0) (not .Values.configsvr.external.host) }}
|
||||
mongodb: invalidConfigSvrReplicas
|
||||
You specified an invalid number of replicas per shard. Please set configsvr.replicas with a positive number or set the configsvr.external.host value to use
|
||||
an external config server replicaset
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Validate values of MongoDB® - Cannot use both .config and .configCM
|
||||
*/}}
|
||||
{{- define "mongodb-sharded.validateValues.config" -}}
|
||||
{{- if and .Values.shardsvr.dataNode.configCM .Values.shardsvr.dataNode.config }}
|
||||
mongodb: shardDataNodeConflictingConfig
|
||||
You specified both shardsvr.dataNode.configCM and shardsvr.dataNode.config. You can only set one
|
||||
{{- end -}}
|
||||
{{- if and .Values.shardsvr.arbiter.configCM .Values.shardsvr.arbiter.config }}
|
||||
mongodb: arbiterNodeConflictingConfig
|
||||
You specified both shardsvr.arbiter.configCM and shardsvr.arbiter.config. You can only set one
|
||||
{{- end -}}
|
||||
{{- if and .Values.mongos.configCM .Values.mongos.config }}
|
||||
mongodb: mongosNodeConflictingConfig
|
||||
You specified both mongos.configCM and mongos.config. You can only set one
|
||||
{{- end -}}
|
||||
{{- if and .Values.configsvr.configCM .Values.configsvr.config }}
|
||||
mongodb: configSvrNodeConflictingConfig
|
||||
You specified both configsvr.configCM and configsvr.config. You can only set one
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/* Check if there are rolling tags in the images */}}
|
||||
{{- define "mongodb-sharded.checkRollingTags" -}}
|
||||
{{- include "common.warnings.rollingTag" .Values.image }}
|
||||
{{- include "common.warnings.rollingTag" .Values.metrics.image }}
|
||||
{{- include "common.warnings.rollingTag" .Values.volumePermissions.image }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,11 @@
|
||||
{{- if and (not .Values.configsvr.external.host) .Values.configsvr.config }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "common.names.fullname" . }}-configsvr
|
||||
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
||||
app.kubernetes.io/component: configsvr
|
||||
data:
|
||||
mongodb.conf: |-
|
||||
{{- include "common.tplvalues.render" (dict "value" .Values.configsvr.config "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,18 @@
|
||||
{{- if and (not .Values.configsvr.external.host) .Values.configsvr.pdb.enabled -}}
|
||||
kind: PodDisruptionBudget
|
||||
apiVersion: {{ include "common.capabilities.policy.apiVersion" . }}
|
||||
metadata:
|
||||
name: {{ include "common.names.fullname" . }}-configsvr
|
||||
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
||||
app.kubernetes.io/component: configsvr
|
||||
spec:
|
||||
selector:
|
||||
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: configsvr
|
||||
{{- if .Values.configsvr.pdb.minAvailable }}
|
||||
minAvailable: {{ .Values.configsvr.pdb.minAvailable | int }}
|
||||
{{- end }}
|
||||
{{- if .Values.configsvr.pdb.maxUnavailable }}
|
||||
maxUnavailable: {{ .Values.configsvr.pdb.maxUnavailable | int }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,32 @@
|
||||
{{- if and (not .Values.configsvr.external.host) (and .Values.metrics.enabled .Values.metrics.podMonitor.enabled) }}
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: PodMonitor
|
||||
metadata:
|
||||
name: {{ include "common.names.fullname" . }}-configsvr
|
||||
{{- if .Values.metrics.podMonitor.namespace }}
|
||||
namespace: {{ .Values.metrics.podMonitor.namespace }}
|
||||
{{- else }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- end }}
|
||||
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
||||
app.kubernetes.io/component: configsvr
|
||||
{{- if .Values.metrics.podMonitor.additionalLabels }}
|
||||
{{- include "common.tplvalues.render" (dict "value" .Values.metrics.podMonitor.additionalLabels "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
podMetricsEndpoints:
|
||||
- port: metrics
|
||||
path: /metrics
|
||||
{{- if .Values.metrics.podMonitor.interval }}
|
||||
interval: {{ .Values.metrics.podMonitor.interval }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.podMonitor.scrapeTimeout }}
|
||||
scrapeTimeout: {{ .Values.metrics.podMonitor.scrapeTimeout }}
|
||||
{{- end }}
|
||||
namespaceSelector:
|
||||
matchNames:
|
||||
- {{ .Release.Namespace }}
|
||||
selector:
|
||||
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: configsvr
|
||||
{{- end }}
|
||||
@@ -0,0 +1,376 @@
|
||||
{{- if not .Values.configsvr.external.host }}
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: {{ include "common.names.fullname" . }}-configsvr
|
||||
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
||||
app.kubernetes.io/component: configsvr
|
||||
spec:
|
||||
selector:
|
||||
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: configsvr
|
||||
serviceName: {{ include "common.names.fullname" . }}-headless
|
||||
replicas: {{ .Values.configsvr.replicas }}
|
||||
podManagementPolicy: {{ .Values.configsvr.podManagementPolicy }}
|
||||
updateStrategy: {{- toYaml .Values.configsvr.updateStrategy | nindent 4 }}
|
||||
template:
|
||||
metadata:
|
||||
labels: {{- include "common.labels.standard" . | nindent 8 }}
|
||||
app.kubernetes.io/component: configsvr
|
||||
{{- if .Values.configsvr.podLabels }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.configsvr.podLabels "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if or .Values.common.podAnnotations .Values.configsvr.podAnnotations .Values.metrics.enabled }}
|
||||
annotations:
|
||||
{{- if .Values.common.podAnnotations }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.common.podAnnotations "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.configsvr.podAnnotations }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.configsvr.podAnnotations "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.enabled }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.podAnnotations "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.common.schedulerName }}
|
||||
schedulerName: {{ .Values.common.schedulerName | quote }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ include "mongodb-sharded.serviceAccountName" (dict "value" .Values.configsvr.serviceAccount "context" $) }}
|
||||
{{- if .Values.configsvr.hostAliases }}
|
||||
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.configsvr.hostAliases "context" $) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.configsvr.affinity }}
|
||||
affinity: {{- include "common.tplvalues.render" (dict "value" .Values.configsvr.affinity "context" $) | nindent 8 }}
|
||||
{{- else }}
|
||||
affinity:
|
||||
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.configsvr.podAffinityPreset "component" "configsvr" "context" $) | nindent 10 }}
|
||||
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.configsvr.podAntiAffinityPreset "component" "configsvr" "context" $) | nindent 10 }}
|
||||
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.configsvr.nodeAffinityPreset.type "key" .Values.configsvr.nodeAffinityPreset.key "values" .Values.configsvr.nodeAffinityPreset.values) | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- if .Values.configsvr.nodeSelector }}
|
||||
nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.configsvr.nodeSelector "context" $) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.configsvr.tolerations }}
|
||||
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.configsvr.tolerations "context" $) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.configsvr.priorityClassName }}
|
||||
priorityClassName: {{ .Values.configsvr.priorityClassName | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.securityContext.enabled }}
|
||||
securityContext:
|
||||
fsGroup: {{ .Values.securityContext.fsGroup }}
|
||||
{{- end }}
|
||||
{{- include "mongodb-sharded.imagePullSecrets" . | nindent 6 }}
|
||||
initContainers:
|
||||
{{- if and .Values.volumePermissions.enabled .Values.configsvr.persistence.enabled }}
|
||||
- name: volume-permissions
|
||||
image: {{ include "mongodb-sharded.volumePermissions.image" . }}
|
||||
imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }}
|
||||
command: ["chown", "-R", "{{ .Values.securityContext.runAsUser }}:{{ .Values.securityContext.fsGroup }}", "{{ .Values.configsvr.persistence.mountPath }}"]
|
||||
securityContext:
|
||||
runAsUser: 0
|
||||
resources: {{ toYaml .Values.volumePermissions.resources | nindent 12 }}
|
||||
volumeMounts:
|
||||
- name: datadir
|
||||
mountPath: {{ .Values.configsvr.persistence.mountPath }}
|
||||
{{- end }}
|
||||
{{- with .Values.configsvr.initContainers }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" . "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.common.initContainers }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" . "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: mongodb
|
||||
image: {{ include "mongodb-sharded.image" . }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
{{- if .Values.securityContext.enabled }}
|
||||
securityContext:
|
||||
runAsNonRoot: {{ .Values.securityContext.runAsNonRoot }}
|
||||
runAsUser: {{ .Values.securityContext.runAsUser }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- containerPort: {{ .Values.common.containerPorts.mongo }}
|
||||
name: mongodb
|
||||
env:
|
||||
- name: MONGODB_ENABLE_NUMACTL
|
||||
value: {{ ternary "yes" "no" .Values.common.mongodbEnableNumactl | quote }}
|
||||
- name: BITNAMI_DEBUG
|
||||
value: {{ ternary "true" "false" (or .Values.image.debug .Values.diagnosticMode.enabled) | quote }}
|
||||
- name: MONGODB_SYSTEM_LOG_VERBOSITY
|
||||
value: {{ .Values.common.mongodbSystemLogVerbosity | quote }}
|
||||
- name: MONGODB_DISABLE_SYSTEM_LOG
|
||||
{{- if .Values.mongodbDisableSystemLog }}
|
||||
value: "yes"
|
||||
{{- else }}
|
||||
value: "no"
|
||||
{{- end }}
|
||||
- name: MONGODB_MAX_TIMEOUT
|
||||
value: {{ .Values.common.mongodbMaxWaitTimeout | quote }}
|
||||
- name: MONGODB_SHARDING_MODE
|
||||
value: "configsvr"
|
||||
- name: MONGODB_POD_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.name
|
||||
- name: MONGODB_PORT_NUMBER
|
||||
value: {{ .Values.common.containerPorts.mongo | quote }}
|
||||
- name: MONGODB_INITIAL_PRIMARY_HOST
|
||||
value: {{ include "mongodb-sharded.configServer.primaryHost" . }}
|
||||
- name: MONGODB_REPLICA_SET_NAME
|
||||
value: {{ printf "%s-configsvr" ( include "common.names.fullname" . ) }}
|
||||
{{- if .Values.common.useHostnames }}
|
||||
- name: MONGODB_ADVERTISED_HOSTNAME
|
||||
value: "$(MONGODB_POD_NAME).{{ include "common.names.fullname" . }}-headless.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }}"
|
||||
{{- end }}
|
||||
{{- if .Values.usePasswordFile }}
|
||||
- name: MONGODB_ROOT_PASSWORD_FILE
|
||||
value: "/bitnami/mongodb/secrets/mongodb-root-password"
|
||||
- name: MONGODB_REPLICA_SET_KEY_FILE
|
||||
value: "/bitnami/mongodb/secrets/mongodb-replica-set-key"
|
||||
{{- else }}
|
||||
- name: MONGODB_ROOT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "mongodb-sharded.secret" . }}
|
||||
key: mongodb-root-password
|
||||
- name: MONGODB_REPLICA_SET_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "mongodb-sharded.secret" . }}
|
||||
key: mongodb-replica-set-key
|
||||
{{- end }}
|
||||
- name: MONGODB_ENABLE_IPV6
|
||||
{{- if .Values.common.mongodbEnableIPv6 }}
|
||||
value: "yes"
|
||||
{{- else }}
|
||||
value: "no"
|
||||
{{- end }}
|
||||
- name: MONGODB_ENABLE_DIRECTORY_PER_DB
|
||||
{{- if .Values.common.mongodbDirectoryPerDB }}
|
||||
value: "yes"
|
||||
{{- else }}
|
||||
value: "no"
|
||||
{{- end }}
|
||||
{{- if .Values.configsvr.mongodbExtraFlags }}
|
||||
- name: MONGODB_EXTRA_FLAGS
|
||||
value: {{ .Values.configsvr.mongodbExtraFlags | join " " | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.common.extraEnvVars }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.common.extraEnvVars "context" $ ) | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if .Values.configsvr.extraEnvVars }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.configsvr.extraEnvVars "context" $ ) | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if or .Values.common.extraEnvVarsCM .Values.common.extraEnvVarsSecret .Values.configsvr.extraEnvVarsCM .Values.configsvr.extraEnvVarsSecret }}
|
||||
envFrom:
|
||||
{{- if .Values.common.extraEnvVarsCM }}
|
||||
- configMapRef:
|
||||
name: {{ include "common.tplvalues.render" ( dict "value" .Values.common.extraEnvVarsCM "context" $ ) }}
|
||||
{{- end }}
|
||||
{{- if .Values.common.extraEnvVarsSecret }}
|
||||
- secretRef:
|
||||
name: {{ include "common.tplvalues.render" ( dict "value" .Values.common.extraEnvVarsSecret "context" $ ) }}
|
||||
{{- end }}
|
||||
{{- if .Values.configsvr.extraEnvVarsCM }}
|
||||
- configMapRef:
|
||||
name: {{ include "common.tplvalues.render" ( dict "value" .Values.configsvr.extraEnvVarsCM "context" $ ) }}
|
||||
{{- end }}
|
||||
{{- if .Values.configsvr.extraEnvVarsSecret }}
|
||||
- secretRef:
|
||||
name: {{ include "common.tplvalues.render" ( dict "value" .Values.configsvr.extraEnvVarsSecret "context" $ ) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.diagnosticMode.enabled }}
|
||||
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
|
||||
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
|
||||
{{- else }}
|
||||
command:
|
||||
- /bin/bash
|
||||
- /entrypoint/replicaset-entrypoint.sh
|
||||
{{- end }}
|
||||
{{- if not .Values.diagnosticMode.enabled }}
|
||||
{{- if .Values.livenessProbe.enabled }}
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- pgrep
|
||||
- mongod
|
||||
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
|
||||
successThreshold: {{ .Values.livenessProbe.successThreshold }}
|
||||
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
|
||||
{{- end }}
|
||||
{{- if .Values.readinessProbe.enabled }}
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- mongo
|
||||
- --disableImplicitSessions
|
||||
- --eval
|
||||
- "db.adminCommand('ping')"
|
||||
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
|
||||
successThreshold: {{ .Values.readinessProbe.successThreshold }}
|
||||
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: replicaset-entrypoint-configmap
|
||||
mountPath: /entrypoint
|
||||
- name: datadir
|
||||
mountPath: {{ .Values.configsvr.persistence.mountPath }}
|
||||
{{- if or .Values.configsvr.config .Values.configsvr.configCM }}
|
||||
- name: config
|
||||
mountPath: /bitnami/mongodb/conf/
|
||||
{{- end }}
|
||||
{{- if .Values.usePasswordFile }}
|
||||
- name: secrets
|
||||
mountPath: /bitnami/mongodb/secrets/
|
||||
{{- end }}
|
||||
{{- if .Values.common.initScriptsCM }}
|
||||
- name: custom-init-scripts-cm
|
||||
mountPath: /docker-entrypoint-initdb.d/cm
|
||||
{{- end }}
|
||||
{{- if .Values.common.initScriptsSecret }}
|
||||
- name: custom-init-scripts-secret
|
||||
mountPath: /docker-entrypoint-initdb.d/secret
|
||||
{{- end }}
|
||||
{{- if .Values.common.extraVolumeMounts }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.common.extraVolumeMounts "context" $ ) | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if .Values.configsvr.extraVolumeMounts }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.configsvr.extraVolumeMounts "context" $ ) | nindent 12 }}
|
||||
{{- end }}
|
||||
resources: {{- toYaml .Values.configsvr.resources | nindent 12 }}
|
||||
{{- if .Values.metrics.enabled }}
|
||||
- name: metrics
|
||||
image: {{ include "mongodb-sharded.metrics.image" . }}
|
||||
imagePullPolicy: {{ .Values.metrics.image.pullPolicy | quote }}
|
||||
{{- if .Values.securityContext.enabled }}
|
||||
securityContext:
|
||||
runAsNonRoot: {{ .Values.securityContext.runAsNonRoot }}
|
||||
runAsUser: {{ .Values.securityContext.runAsUser }}
|
||||
{{- end }}
|
||||
env:
|
||||
{{- if .Values.usePasswordFile }}
|
||||
- name: MONGODB_ROOT_PASSWORD_FILE
|
||||
value: "/bitnami/mongodb/secrets/mongodb-root-password"
|
||||
{{- else }}
|
||||
- name: MONGODB_ROOT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "mongodb-sharded.secret" . }}
|
||||
key: mongodb-root-password
|
||||
{{- end }}
|
||||
{{- if .Values.diagnosticMode.enabled }}
|
||||
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
|
||||
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
|
||||
{{- else }}
|
||||
command:
|
||||
- sh
|
||||
- -ec
|
||||
- |-
|
||||
#!/bin/sh
|
||||
{{- if .Values.usePasswordFile }}
|
||||
export MONGODB_ROOT_PASSWORD="$(cat "${MONGODB_ROOT_PASSWORD_FILE}")"
|
||||
{{- end }}
|
||||
/bin/mongodb_exporter --web.listen-address ":{{ .Values.metrics.containerPort }}" --mongodb.uri mongodb://root:`echo $MONGODB_ROOT_PASSWORD | sed -r "s/@/%40/g;s/:/%3A/g"`@localhost:{{ .Values.service.port }}/admin{{ ternary "?ssl=true" "" $.Values.metrics.useTLS }} {{ .Values.metrics.extraArgs }}
|
||||
{{- end }}
|
||||
{{- if .Values.usePasswordFile }}
|
||||
volumeMounts:
|
||||
- name: secrets
|
||||
mountPath: /bitnami/mongodb/secrets/
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: metrics
|
||||
containerPort: {{ .Values.metrics.containerPort }}
|
||||
{{- if not .Values.diagnosticMode.enabled }}
|
||||
{{- if .Values.metrics.livenessProbe.enabled }}
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /metrics
|
||||
port: metrics
|
||||
initialDelaySeconds: {{ .Values.metrics.livenessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.metrics.livenessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ .Values.metrics.livenessProbe.timeoutSeconds }}
|
||||
failureThreshold: {{ .Values.metrics.livenessProbe.failureThreshold }}
|
||||
successThreshold: {{ .Values.metrics.livenessProbe.successThreshold }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.readinessProbe.enabled }}
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /metrics
|
||||
port: metrics
|
||||
initialDelaySeconds: {{ .Values.metrics.readinessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.metrics.readinessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ .Values.metrics.readinessProbe.timeoutSeconds }}
|
||||
failureThreshold: {{ .Values.metrics.readinessProbe.failureThreshold }}
|
||||
successThreshold: {{ .Values.metrics.readinessProbe.successThreshold }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
resources: {{ toYaml .Values.metrics.resources | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- with .Values.configsvr.sidecars }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" . "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.common.sidecars }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" . "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: replicaset-entrypoint-configmap
|
||||
configMap:
|
||||
name: {{ include "common.names.fullname" . }}-replicaset-entrypoint
|
||||
{{- if .Values.usePasswordFile }}
|
||||
- name: secrets
|
||||
secret:
|
||||
secretName: {{ include "mongodb-sharded.secret" . }}
|
||||
{{- end }}
|
||||
{{- if or .Values.configsvr.config .Values.configsvr.configCM }}
|
||||
- name: config
|
||||
configMap:
|
||||
name: {{ include "mongodb-sharded.configsvr.configCM" . }}
|
||||
{{- end }}
|
||||
{{- if .Values.common.initScriptsCM }}
|
||||
- name: custom-init-scripts-cm
|
||||
configMap:
|
||||
name: {{ include "mongodb-sharded.initScriptsCM" . }}
|
||||
defaultMode: 0755
|
||||
{{- end }}
|
||||
{{- if .Values.common.initScriptsSecret }}
|
||||
- name: custom-init-scripts-secret
|
||||
secret:
|
||||
secretName: {{ include "mongodb-sharded.initScriptsSecret" . }}
|
||||
defaultMode: 0755
|
||||
{{- end }}
|
||||
{{- if .Values.common.extraVolumes }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.common.extraVolumes "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.configsvr.extraVolumes }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.configsvr.extraVolumes "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.configsvr.persistence.enabled }}
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: datadir
|
||||
annotations:
|
||||
{{- range $key, $value := .Values.configsvr.persistence.annotations }}
|
||||
{{ $key }}: "{{ $value }}"
|
||||
{{- end }}
|
||||
spec:
|
||||
accessModes:
|
||||
{{- range .Values.configsvr.persistence.accessModes }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.configsvr.persistence.size | quote }}
|
||||
{{- include "common.storage.class" (dict "persistence" .Values.configsvr.persistence "global" .Values.global) | nindent 8 }}
|
||||
{{- else }}
|
||||
- name: datadir
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,4 @@
|
||||
{{- range .Values.extraDeploy }}
|
||||
---
|
||||
{{ include "common.tplvalues.render" (dict "value" . "context" $) }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,16 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "common.names.fullname" . }}-headless
|
||||
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
||||
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.service.annotations "context" $ ) | nindent 4 }}
|
||||
spec:
|
||||
type: ClusterIP
|
||||
clusterIP: None
|
||||
ports:
|
||||
- name: mongodb
|
||||
port: {{ .Values.service.port }}
|
||||
{{- if .Values.service.extraPorts }}
|
||||
{{- include "common.tplvalues.render" (dict "value" .Values.service.extraPorts "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
selector: {{ include "common.labels.matchLabels" . | nindent 4 }}
|
||||
@@ -0,0 +1,11 @@
|
||||
{{- if .Values.mongos.config }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "common.names.fullname" . }}-mongos
|
||||
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
||||
app.kubernetes.io/component: mongos
|
||||
data:
|
||||
mongodb.conf: |-
|
||||
{{- include "common.tplvalues.render" (dict "value" .Values.mongos.config "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,319 @@
|
||||
apiVersion: {{ if .Values.mongos.useStatefulSet }}{{ include "common.capabilities.statefulset.apiVersion" . }}{{- else }}{{ include "common.capabilities.deployment.apiVersion" . }}{{- end }}
|
||||
kind: {{ if .Values.mongos.useStatefulSet }}StatefulSet{{- else }}Deployment{{- end }}
|
||||
metadata:
|
||||
name: {{ include "common.names.fullname" . }}-mongos
|
||||
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
||||
app.kubernetes.io/component: mongos
|
||||
spec:
|
||||
{{- if .Values.mongos.useStatefulSet }}
|
||||
serviceName: {{ include "mongodb-sharded.serviceName" . }}
|
||||
podManagementPolicy: {{ .Values.mongos.podManagementPolicy }}
|
||||
updateStrategy:
|
||||
{{- else }}
|
||||
strategy:
|
||||
{{- end }}
|
||||
{{- toYaml .Values.mongos.updateStrategy | nindent 4 }}
|
||||
replicas: {{ .Values.mongos.replicas }}
|
||||
selector:
|
||||
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: mongos
|
||||
template:
|
||||
metadata:
|
||||
labels: {{- include "common.labels.standard" . | nindent 8 }}
|
||||
app.kubernetes.io/component: mongos
|
||||
{{- if .Values.mongos.podLabels }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.mongos.podLabels "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if or .Values.common.podAnnotations .Values.mongos.podAnnotations .Values.metrics.enabled }}
|
||||
annotations:
|
||||
{{- if .Values.common.podAnnotations }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.common.podAnnotations "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.mongos.podAnnotations }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.mongos.podAnnotations "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.enabled }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.podAnnotations "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.common.schedulerName }}
|
||||
schedulerName: {{ .Values.common.schedulerName | quote }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ include "mongodb-sharded.serviceAccountName" (dict "value" $.Values.mongos.serviceAccount "context" $) }}
|
||||
{{- if .Values.mongos.hostAliases }}
|
||||
hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.mongos.hostAliases "context" $) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.mongos.affinity }}
|
||||
affinity: {{- include "common.tplvalues.render" (dict "value" .Values.mongos.affinity "context" $) | nindent 8 }}
|
||||
{{- else }}
|
||||
affinity:
|
||||
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.mongos.podAffinityPreset "component" "mongos" "context" $) | nindent 10 }}
|
||||
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.mongos.podAntiAffinityPreset "component" "mongos" "context" $) | nindent 10 }}
|
||||
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.mongos.nodeAffinityPreset.type "key" .Values.mongos.nodeAffinityPreset.key "values" .Values.mongos.nodeAffinityPreset.values) | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- if .Values.mongos.nodeSelector }}
|
||||
nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.mongos.nodeSelector "context" $) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.mongos.tolerations }}
|
||||
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.mongos.tolerations "context" $) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.mongos.priorityClassName }}
|
||||
priorityClassName: {{ .Values.mongos.priorityClassName | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.securityContext.enabled }}
|
||||
securityContext:
|
||||
fsGroup: {{ .Values.securityContext.fsGroup }}
|
||||
{{- end }}
|
||||
{{- include "mongodb-sharded.imagePullSecrets" . | nindent 6 }}
|
||||
{{- if or $.Values.mongos.initContainers $.Values.common.initContainers }}
|
||||
initContainers:
|
||||
{{- with $.Values.mongos.initContainers }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" . "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with $.Values.common.initContainers }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" . "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: mongos
|
||||
image: {{ include "mongodb-sharded.image" . }}
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy | quote }}
|
||||
{{- if .Values.securityContext.enabled }}
|
||||
securityContext:
|
||||
runAsNonRoot: {{ .Values.securityContext.runAsNonRoot }}
|
||||
runAsUser: {{ .Values.securityContext.runAsUser }}
|
||||
{{- end }}
|
||||
env:
|
||||
- name: MONGODB_ENABLE_NUMACTL
|
||||
value: {{ ternary "yes" "no" $.Values.common.mongodbEnableNumactl | quote }}
|
||||
- name: BITNAMI_DEBUG
|
||||
value: {{ ternary "true" "false" (or .Values.image.debug .Values.diagnosticMode.enabled) | quote }}
|
||||
- name: MONGODB_SHARDING_MODE
|
||||
value: "mongos"
|
||||
- name: MONGODB_MAX_TIMEOUT
|
||||
value: {{ .Values.common.mongodbMaxWaitTimeout | quote }}
|
||||
{{- if .Values.usePasswordFile }}
|
||||
- name: MONGODB_ROOT_PASSWORD_FILE
|
||||
value: "/bitnami/mongodb/secrets/mongodb-root-password"
|
||||
- name: MONGODB_REPLICA_SET_KEY_FILE
|
||||
value: "/bitnami/mongodb/secrets/mongodb-replica-set-key"
|
||||
{{- else }}
|
||||
- name: MONGODB_ROOT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "mongodb-sharded.secret" . }}
|
||||
key: mongodb-root-password
|
||||
- name: MONGODB_REPLICA_SET_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "mongodb-sharded.secret" . }}
|
||||
key: mongodb-replica-set-key
|
||||
{{- end }}
|
||||
- name: MONGODB_POD_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.name
|
||||
{{- if .Values.common.useHostnames }}
|
||||
- name: MONGODB_ADVERTISED_HOSTNAME
|
||||
value: "$(MONGODB_POD_NAME)"
|
||||
{{- end }}
|
||||
- name: MONGODB_PORT_NUMBER
|
||||
value: {{ $.Values.common.containerPorts.mongo | quote }}
|
||||
- name: MONGODB_CFG_PRIMARY_HOST
|
||||
value: {{ include "mongodb-sharded.configServer.primaryHost" . }}
|
||||
- name: MONGODB_CFG_REPLICA_SET_NAME
|
||||
value: {{ include "mongodb-sharded.configServer.rsName" . }}
|
||||
- name: MONGODB_SYSTEM_LOG_VERBOSITY
|
||||
value: {{ .Values.common.mongodbSystemLogVerbosity | quote }}
|
||||
- name: MONGODB_DISABLE_SYSTEM_LOG
|
||||
{{- if .Values.mongodbDisableSystemLog }}
|
||||
value: "yes"
|
||||
{{- else }}
|
||||
value: "no"
|
||||
{{- end }}
|
||||
- name: MONGODB_ENABLE_IPV6
|
||||
{{- if .Values.common.mongodbEnableIPv6 }}
|
||||
value: "yes"
|
||||
{{- else }}
|
||||
value: "no"
|
||||
{{- end }}
|
||||
- name: MONGODB_ENABLE_DIRECTORY_PER_DB
|
||||
{{- if .Values.common.mongodbDirectoryPerDB }}
|
||||
value: "yes"
|
||||
{{- else }}
|
||||
value: "no"
|
||||
{{- end }}
|
||||
{{- if .Values.mongos.mongodbExtraFlags }}
|
||||
- name: MONGODB_EXTRA_FLAGS
|
||||
value: {{ .Values.mongos.mongodbExtraFlags | join " " | quote }}
|
||||
{{- end }}
|
||||
{{- if .Values.common.extraEnvVars }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" $.Values.common.extraEnvVars "context" $ ) | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if .Values.mongos.extraEnvVars }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" $.Values.mongos.extraEnvVars "context" $ ) | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if or .Values.common.extraEnvVarsCM .Values.common.extraEnvVarsSecret .Values.mongos.extraEnvVarsCM .Values.mongos.extraEnvVarsSecret }}
|
||||
envFrom:
|
||||
{{- if .Values.common.extraEnvVarsCM }}
|
||||
- configMapRef:
|
||||
name: {{ include "common.tplvalues.render" ( dict "value" .Values.common.extraEnvVarsCM "context" $ ) }}
|
||||
{{- end }}
|
||||
{{- if .Values.common.extraEnvVarsSecret }}
|
||||
- secretRef:
|
||||
name: {{ include "common.tplvalues.render" ( dict "value" .Values.common.extraEnvVarsSecret "context" $ ) }}
|
||||
{{- end }}
|
||||
{{- if .Values.configsvr.extraEnvVarsCM }}
|
||||
- configMapRef:
|
||||
name: {{ include "common.tplvalues.render" ( dict "value" .Values.mongos.extraEnvVarsCM "context" $ ) }}
|
||||
{{- end }}
|
||||
{{- if .Values.mongos.extraEnvVarsSecret }}
|
||||
- configMapRef:
|
||||
name: {{ include "common.tplvalues.render" ( dict "value" .Values.mongos.extraEnvVarsSecret "context" $ ) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.diagnosticMode.enabled }}
|
||||
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
|
||||
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: mongodb
|
||||
containerPort: {{ $.Values.common.containerPorts.mongo }}
|
||||
{{- if not .Values.diagnosticMode.enabled }}
|
||||
{{- if .Values.livenessProbe.enabled }}
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- mongo
|
||||
- --disableImplicitSessions
|
||||
- --eval
|
||||
- "db.adminCommand('ping')"
|
||||
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
|
||||
successThreshold: {{ .Values.livenessProbe.successThreshold }}
|
||||
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
|
||||
{{- end }}
|
||||
{{- if .Values.readinessProbe.enabled }}
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- mongo
|
||||
- --disableImplicitSessions
|
||||
- --eval
|
||||
- "db.adminCommand('ping')"
|
||||
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
|
||||
successThreshold: {{ .Values.readinessProbe.successThreshold }}
|
||||
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
{{- if .Values.usePasswordFile }}
|
||||
- name: secrets
|
||||
mountPath: /bitnami/mongodb/secrets/
|
||||
{{- end }}
|
||||
{{- if or .Values.mongos.config .Values.mongos.configCM }}
|
||||
- name: config
|
||||
mountPath: /bitnami/mongodb/conf/
|
||||
{{- end }}
|
||||
{{- if $.Values.common.extraVolumeMounts }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" $.Values.common.extraVolumeMounts "context" $ ) | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if $.Values.mongos.extraVolumeMounts }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" $.Values.mongos.extraVolumeMounts "context" $ ) | nindent 12 }}
|
||||
{{- end }}
|
||||
resources: {{- toYaml .Values.mongos.resources | nindent 12 }}
|
||||
{{- if .Values.metrics.enabled }}
|
||||
- name: metrics
|
||||
image: {{ include "mongodb-sharded.metrics.image" . }}
|
||||
imagePullPolicy: {{ .Values.metrics.image.pullPolicy | quote }}
|
||||
{{- if .Values.securityContext.enabled }}
|
||||
securityContext:
|
||||
runAsNonRoot: {{ .Values.securityContext.runAsNonRoot }}
|
||||
runAsUser: {{ .Values.securityContext.runAsUser }}
|
||||
{{- end }}
|
||||
env:
|
||||
{{- if .Values.usePasswordFile }}
|
||||
- name: MONGODB_ROOT_PASSWORD_FILE
|
||||
value: "/bitnami/mongodb/secrets/mongodb-root-password"
|
||||
{{- else }}
|
||||
- name: MONGODB_ROOT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "mongodb-sharded.secret" . }}
|
||||
key: mongodb-root-password
|
||||
{{- end }}
|
||||
{{- if .Values.diagnosticMode.enabled }}
|
||||
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
|
||||
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
|
||||
{{- else }}
|
||||
command:
|
||||
- sh
|
||||
- -ec
|
||||
- |-
|
||||
#!/bin/sh
|
||||
{{- if .Values.usePasswordFile }}
|
||||
export MONGODB_ROOT_PASSWORD="$(cat "${MONGODB_ROOT_PASSWORD_FILE}")"
|
||||
{{- end }}
|
||||
/bin/mongodb_exporter --web.listen-address ":{{ .Values.metrics.containerPort }}" --mongodb.uri mongodb://root:`echo $MONGODB_ROOT_PASSWORD | sed -r "s/@/%40/g;s/:/%3A/g"`@localhost:{{ .Values.service.port }}/admin{{ ternary "?ssl=true" "" $.Values.metrics.useTLS }} {{ .Values.metrics.extraArgs }}
|
||||
{{- end }}
|
||||
{{- if .Values.usePasswordFile }}
|
||||
volumeMounts:
|
||||
- name: secrets
|
||||
mountPath: /bitnami/mongodb/secrets/
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: metrics
|
||||
containerPort: {{ .Values.metrics.containerPort }}
|
||||
{{- if not .Values.diagnosticMode.enabled }}
|
||||
{{- if .Values.metrics.livenessProbe.enabled }}
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /metrics
|
||||
port: metrics
|
||||
initialDelaySeconds: {{ .Values.metrics.livenessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.metrics.readinessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ .Values.metrics.livenessProbe.timeoutSeconds }}
|
||||
failureThreshold: {{ .Values.metrics.livenessProbe.failureThreshold }}
|
||||
successThreshold: {{ .Values.metrics.livenessProbe.successThreshold }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.readinessProbe.enabled }}
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /metrics
|
||||
port: metrics
|
||||
initialDelaySeconds: {{ .Values.metrics.readinessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ .Values.metrics.readinessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ .Values.metrics.readinessProbe.timeoutSeconds }}
|
||||
failureThreshold: {{ .Values.metrics.readinessProbe.failureThreshold }}
|
||||
successThreshold: {{ .Values.metrics.readinessProbe.successThreshold }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
resources: {{- toYaml .Values.metrics.resources | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- with $.Values.mongos.sidecars }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" . "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with $.Values.common.sidecars }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" . "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
{{- if .Values.usePasswordFile }}
|
||||
- name: secrets
|
||||
secret:
|
||||
secretName: {{ include "mongodb-sharded.secret" . }}
|
||||
{{- end }}
|
||||
{{- if or .Values.mongos.config .Values.mongos.configCM }}
|
||||
- name: config
|
||||
configMap:
|
||||
name: {{ include "mongodb-sharded.mongos.configCM" . }}
|
||||
{{- end }}
|
||||
{{- if $.Values.common.extraVolumes }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" $.Values.common.extraVolumes "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if $.Values.mongos.extraVolumes }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" $.Values.mongos.extraVolumes "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,18 @@
|
||||
{{- if .Values.mongos.pdb.enabled -}}
|
||||
kind: PodDisruptionBudget
|
||||
apiVersion: {{ include "common.capabilities.policy.apiVersion" . }}
|
||||
metadata:
|
||||
name: {{ include "common.names.fullname" . }}-mongos
|
||||
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
||||
app.kubernetes.io/component: mongos
|
||||
spec:
|
||||
selector:
|
||||
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: mongos
|
||||
{{- if .Values.mongos.pdb.minAvailable }}
|
||||
minAvailable: {{ .Values.mongos.pdb.minAvailable | int }}
|
||||
{{- end }}
|
||||
{{- if .Values.mongos.pdb.maxUnavailable }}
|
||||
maxUnavailable: {{ .Values.mongos.pdb.maxUnavailable | int }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,32 @@
|
||||
{{- if and .Values.metrics.enabled .Values.metrics.podMonitor.enabled }}
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: PodMonitor
|
||||
metadata:
|
||||
name: {{ include "common.names.fullname" . }}-mongos
|
||||
{{- if .Values.metrics.podMonitor.namespace }}
|
||||
namespace: {{ .Values.metrics.podMonitor.namespace }}
|
||||
{{- else }}
|
||||
namespace: {{ .Release.Namespace }}
|
||||
{{- end }}
|
||||
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
||||
app.kubernetes.io/component: mongos
|
||||
{{- if .Values.metrics.podMonitor.additionalLabels }}
|
||||
{{- include "common.tplvalues.render" (dict "value" .Values.metrics.podMonitor.additionalLabels "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
podMetricsEndpoints:
|
||||
- port: metrics
|
||||
path: /metrics
|
||||
{{- if .Values.metrics.podMonitor.interval }}
|
||||
interval: {{ .Values.metrics.podMonitor.interval }}
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.podMonitor.scrapeTimeout }}
|
||||
scrapeTimeout: {{ .Values.metrics.podMonitor.scrapeTimeout }}
|
||||
{{- end }}
|
||||
namespaceSelector:
|
||||
matchNames:
|
||||
- {{ .Release.Namespace }}
|
||||
selector:
|
||||
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
|
||||
app.kubernetes.io/component: mongos
|
||||
{{- end }}
|
||||
@@ -0,0 +1,48 @@
|
||||
{{- if and .Values.mongos.useStatefulSet .Values.mongos.servicePerReplica.enabled }}
|
||||
{{- range $i := until (.Values.mongos.replicas | int) }}
|
||||
{{- $context := deepCopy $ | merge (dict "index" $i) }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "mongodb-sharded.serviceName" $ }}-{{ $i }}
|
||||
labels: {{ include "common.labels.standard" $ | nindent 4 }}
|
||||
app.kubernetes.io/component: mongos
|
||||
annotations: {{- include "common.tplvalues.render" (dict "value" $.Values.mongos.servicePerReplica.annotations "context" $context) | nindent 4 }}
|
||||
spec:
|
||||
type: {{ $.Values.mongos.servicePerReplica.type }}
|
||||
{{- if and $.Values.mongos.servicePerReplica.loadBalancerIP (eq $.Values.mongos.servicePerReplica.type "LoadBalancer") }}
|
||||
loadBalancerIP: {{ $.Values.mongos.servicePerReplica.loadBalancerIP }}
|
||||
{{- end }}
|
||||
{{- if and (eq $.Values.mongos.servicePerReplica.type "LoadBalancer") $.Values.mongos.servicePerReplica.loadBalancerSourceRanges }}
|
||||
loadBalancerSourceRanges:
|
||||
{{ with $.Values.mongos.servicePerReplica.loadBalancerSourceRanges }}
|
||||
{{ include "common.tplvalues.render" . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if and (eq $.Values.mongos.servicePerReplica.type "ClusterIP") $.Values.mongos.servicePerReplica.clusterIP }}
|
||||
clusterIP: {{ $.Values.mongos.servicePerReplica.clusterIP }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: mongodb
|
||||
port: {{ $.Values.mongos.servicePerReplica.port }}
|
||||
targetPort: mongodb
|
||||
{{- if $.Values.mongos.servicePerReplica.nodePort }}
|
||||
nodePort: {{ $.Values.mongos.servicePerReplica.nodePort }}
|
||||
{{- else if eq $.Values.mongos.servicePerReplica.type "ClusterIP" }}
|
||||
nodePort: null
|
||||
{{- end }}
|
||||
{{- if $.Values.metrics.enabled }}
|
||||
- name: metrics
|
||||
port: 9216
|
||||
targetPort: metrics
|
||||
{{- end }}
|
||||
{{- if $.Values.mongos.servicePerReplica.extraPorts }}
|
||||
{{- include "common.tplvalues.render" (dict "value" $.Values.mongos.servicePerReplica.extraPorts "context" $context) | nindent 4 }}
|
||||
{{- end }}
|
||||
selector: {{ include "common.labels.matchLabels" $ | nindent 4 }}
|
||||
app.kubernetes.io/component: mongos
|
||||
statefulset.kubernetes.io/pod-name: {{ include "common.names.fullname" $ }}-mongos-{{ $i }}
|
||||
sessionAffinity: {{ default "None" $.Values.mongos.servicePerReplica.sessionAffinity }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,41 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "mongodb-sharded.serviceName" . }}
|
||||
labels: {{ include "common.labels.standard" . | nindent 4 }}
|
||||
app.kubernetes.io/component: mongos
|
||||
annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.service.annotations "context" $ ) | nindent 4 }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
{{- if and .Values.service.loadBalancerIP (eq .Values.service.type "LoadBalancer") }}
|
||||
loadBalancerIP: {{ .Values.service.loadBalancerIP }}
|
||||
{{- end }}
|
||||
{{- if and (eq .Values.service.type "LoadBalancer") .Values.service.loadBalancerSourceRanges }}
|
||||
loadBalancerSourceRanges:
|
||||
{{ with .Values.service.loadBalancerSourceRanges }}
|
||||
{{ toYaml . | indent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if and (eq .Values.service.type "ClusterIP") .Values.service.clusterIP }}
|
||||
clusterIP: {{ .Values.service.clusterIP }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: mongodb
|
||||
port: {{ .Values.service.port }}
|
||||
targetPort: mongodb
|
||||
{{- if .Values.service.nodePort }}
|
||||
nodePort: {{ .Values.service.nodePort }}
|
||||
{{- else if eq .Values.service.type "ClusterIP" }}
|
||||
nodePort: null
|
||||
{{- end }}
|
||||
{{- if .Values.metrics.enabled }}
|
||||
- name: metrics
|
||||
port: 9216
|
||||
targetPort: metrics
|
||||
{{- end }}
|
||||
{{- if .Values.service.extraPorts }}
|
||||
{{- include "common.tplvalues.render" (dict "value" .Values.service.extraPorts "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
selector: {{ include "common.labels.matchLabels" . | nindent 4 }}
|
||||
app.kubernetes.io/component: mongos
|
||||
sessionAffinity: {{ default "None" .Values.service.sessionAffinity }}
|
||||
@@ -0,0 +1,30 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "common.names.fullname" . }}-replicaset-entrypoint
|
||||
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
||||
data:
|
||||
replicaset-entrypoint.sh: |-
|
||||
#!/bin/bash
|
||||
|
||||
sleep 5
|
||||
|
||||
. /liblog.sh
|
||||
|
||||
# Perform adaptations depending on the host name
|
||||
if [[ $HOSTNAME =~ (.*)-0$ ]]; then
|
||||
info "Setting node as primary"
|
||||
export MONGODB_REPLICA_SET_MODE=primary
|
||||
else
|
||||
info "Setting node as secondary"
|
||||
export MONGODB_REPLICA_SET_MODE=secondary
|
||||
{{- if .Values.usePasswordFile }}
|
||||
export MONGODB_INITIAL_PRIMARY_ROOT_PASSWORD_FILE="$MONGODB_ROOT_PASSWORD_FILE"
|
||||
unset MONGODB_ROOT_PASSWORD_FILE
|
||||
{{- else }}
|
||||
export MONGODB_INITIAL_PRIMARY_ROOT_PASSWORD="$MONGODB_ROOT_PASSWORD"
|
||||
unset MONGODB_ROOT_PASSWORD
|
||||
{{- end }}
|
||||
fi
|
||||
|
||||
exec /entrypoint.sh /run.sh
|
||||
@@ -0,0 +1,30 @@
|
||||
{{- if not .Values.existingSecret }}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ include "common.names.fullname" . }}
|
||||
labels: {{- include "common.labels.standard" $ | nindent 4 }}
|
||||
type: Opaque
|
||||
data:
|
||||
{{- if .Values.configsvr.external.rootPassword }}
|
||||
mongodb-root-password: {{ .Values.configsvr.external.rootPassword | b64enc | quote }}
|
||||
{{- else if .Values.mongodbRootPassword }}
|
||||
mongodb-root-password: {{ .Values.mongodbRootPassword | b64enc | quote }}
|
||||
{{- else }}
|
||||
mongodb-root-password: {{ randAlphaNum 10 | b64enc | quote }}
|
||||
{{- end }}
|
||||
{{- if and .Values.mongodbUsername .Values.mongodbDatabase }}
|
||||
{{- if .Values.mongodbPassword }}
|
||||
mongodb-password: {{ .Values.mongodbPassword | b64enc | quote }}
|
||||
{{- else }}
|
||||
mongodb-password: {{ randAlphaNum 10 | b64enc | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if .Values.configsvr.external.replicasetKey }}
|
||||
mongodb-replica-set-key: {{ .Values.configsvr.external.replicasetKey | b64enc | quote }}
|
||||
{{- else if .Values.replicaSetKey }}
|
||||
mongodb-replica-set-key: {{ .Values.replicaSetKey | b64enc | quote }}
|
||||
{{- else }}
|
||||
mongodb-replica-set-key: {{ randAlphaNum 10 | b64enc | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,5 @@
|
||||
{{ include "mongodb-sharded.serviceaccount" (dict "value" .Values.common.serviceAccount "context" $) }}
|
||||
{{ include "mongodb-sharded.serviceaccount" (dict "value" .Values.mongos.serviceAccount "context" $) }}
|
||||
{{ include "mongodb-sharded.serviceaccount" (dict "value" .Values.configsvr.serviceAccount "context" $) }}
|
||||
{{ include "mongodb-sharded.serviceaccount" (dict "value" .Values.shardsvr.arbiter.serviceAccount "context" $) }}
|
||||
{{ include "mongodb-sharded.serviceaccount" (dict "value" .Values.shardsvr.dataNode.serviceAccount "context" $) }}
|
||||
@@ -0,0 +1,11 @@
|
||||
{{- if and .Values.shards .Values.shardsvr.arbiter.replicas .Values.shardsvr.arbiter.config }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "common.names.fullname" . }}-shardsvr-arbiter
|
||||
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
||||
app.kubernetes.io/component: shardsvr-arbiter
|
||||
data:
|
||||
mongodb.conf: |-
|
||||
{{- include "common.tplvalues.render" (dict "value" .Values.shardsvr.arbiter.config "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,337 @@
|
||||
{{- if and .Values.shards .Values.shardsvr.arbiter.replicas }}
|
||||
{{- $replicas := $.Values.shards | int }}
|
||||
{{- range $i, $e := until $replicas }}
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: {{ printf "%s-shard%d-arbiter" (include "common.names.fullname" $ ) $i }}
|
||||
labels: {{- include "common.labels.standard" $ | nindent 4 }}
|
||||
app.kubernetes.io/component: shardsvr-arbiter
|
||||
spec:
|
||||
selector:
|
||||
matchLabels: {{- include "common.labels.matchLabels" $ | nindent 6 }}
|
||||
app.kubernetes.io/component: shardsvr-arbiter
|
||||
podManagementPolicy: {{ $.Values.shardsvr.arbiter.podManagementPolicy }}
|
||||
updateStrategy: {{- toYaml $.Values.shardsvr.arbiter.updateStrategy | nindent 4 }}
|
||||
serviceName: {{ include "common.names.fullname" $ }}-headless
|
||||
replicas: {{ $.Values.shardsvr.arbiter.replicas }}
|
||||
template:
|
||||
metadata:
|
||||
labels: {{- include "common.labels.standard" $ | nindent 8 }}
|
||||
app.kubernetes.io/component: shardsvr-arbiter
|
||||
{{- if $.Values.shardsvr.arbiter.podLabels }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" $.Values.shardsvr.arbiter.podLabels "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
shard: {{ $i | quote }}
|
||||
{{- if or $.Values.common.podAnnotations $.Values.shardsvr.arbiter.podAnnotations $.Values.metrics.enabled }}
|
||||
annotations:
|
||||
{{- if $.Values.common.podAnnotations }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" $.Values.common.podAnnotations "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if $.Values.shardsvr.arbiter.podAnnotations }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" $.Values.shardsvr.arbiter.podAnnotations "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if $.Values.metrics.enabled }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" $.Values.metrics.podAnnotations "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
spec:
|
||||
serviceAccountName: {{ include "mongodb-sharded.serviceAccountName" (dict "value" $.Values.shardsvr.arbiter.serviceAccount "context" $) }}
|
||||
{{- if $.Values.common.schedulerName }}
|
||||
schedulerName: {{ $.Values.common.schedulerName | quote }}
|
||||
{{- end }}
|
||||
{{- if $.Values.shardsvr.arbiter.hostAliases }}
|
||||
hostAliases: {{- include "common.tplvalues.render" (dict "value" $.Values.shardsvr.arbiter.hostAliases "context" $) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if $.Values.shardsvr.arbiter.affinity }}
|
||||
affinity: {{- include "common.tplvalues.render" (dict "value" $.Values.shardsvr.arbiter.affinity "context" (set $ "arbiterLoopId" $i)) | nindent 8 }}
|
||||
{{- else }}
|
||||
affinity:
|
||||
podAffinity: {{- include "common.affinities.pods" (dict "type" $.Values.shardsvr.arbiter.podAffinityPreset "component" "shardsvr-arbiter" "context" $) | nindent 10 }}
|
||||
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" $.Values.shardsvr.arbiter.podAntiAffinityPreset "component" "shardsvr-arbiter" "context" $) | nindent 10 }}
|
||||
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" $.Values.shardsvr.arbiter.nodeAffinityPreset.type "key" $.Values.shardsvr.arbiter.nodeAffinityPreset.key "values" $.Values.shardsvr.arbiter.nodeAffinityPreset.values) | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- if $.Values.shardsvr.arbiter.nodeSelector }}
|
||||
nodeSelector: {{- include "common.tplvalues.render" (dict "value" $.Values.shardsvr.arbiter.nodeSelector "context" $) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if $.Values.shardsvr.arbiter.tolerations }}
|
||||
tolerations: {{- include "common.tplvalues.render" (dict "value" $.Values.shardsvr.arbiter.tolerations "context" $) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if $.Values.shardsvr.arbiter.priorityClassName }}
|
||||
priorityClassName: {{ $.Values.shardsvr.arbiter.priorityClassName | quote }}
|
||||
{{- end }}
|
||||
{{- if $.Values.securityContext.enabled }}
|
||||
securityContext:
|
||||
fsGroup: {{ $.Values.securityContext.fsGroup }}
|
||||
{{- end }}
|
||||
{{- include "mongodb-sharded.imagePullSecrets" $ | nindent 6 }}
|
||||
{{- if or $.Values.shardsvr.arbiter.initContainers $.Values.common.initContainers }}
|
||||
initContainers:
|
||||
{{- with $.Values.shardsvr.arbiter.initContainers }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" . "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with $.Values.common.initContainers }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" . "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: {{ include "common.names.fullname" $ }}-arbiter
|
||||
image: {{ include "mongodb-sharded.image" $ }}
|
||||
imagePullPolicy: {{ $.Values.image.pullPolicy }}
|
||||
{{- if $.Values.securityContext.enabled }}
|
||||
securityContext:
|
||||
runAsNonRoot: {{ $.Values.securityContext.runAsNonRoot }}
|
||||
runAsUser: {{ $.Values.securityContext.runAsUser }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- containerPort: {{ $.Values.common.containerPorts.mongo }}
|
||||
name: mongodb
|
||||
env:
|
||||
- name: MONGODB_ENABLE_NUMACTL
|
||||
value: {{ ternary "yes" "no" $.Values.common.mongodbEnableNumactl | quote }}
|
||||
- name: BITNAMI_DEBUG
|
||||
value: {{ ternary "true" "false" (or $.Values.image.debug $.Values.diagnosticMode.enabled) | quote }}
|
||||
- name: MONGODB_SYSTEM_LOG_VERBOSITY
|
||||
value: {{ $.Values.common.mongodbSystemLogVerbosity | quote }}
|
||||
- name: MONGODB_DISABLE_SYSTEM_LOG
|
||||
{{- if $.Values.common.mongodbDisableSystemLog }}
|
||||
value: "yes"
|
||||
{{- else }}
|
||||
value: "no"
|
||||
{{- end }}
|
||||
- name: MONGODB_POD_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.name
|
||||
- name: MONGODB_MAX_TIMEOUT
|
||||
value: {{ $.Values.common.mongodbMaxWaitTimeout | quote }}
|
||||
- name: MONGODB_SHARDING_MODE
|
||||
value: "shardsvr"
|
||||
- name: MONGODB_REPLICA_SET_MODE
|
||||
value: "arbiter"
|
||||
- name: MONGODB_PORT_NUMBER
|
||||
value: {{ $.Values.common.containerPorts.mongo | quote }}
|
||||
- name: MONGODB_INITIAL_PRIMARY_HOST
|
||||
value: {{ printf "%s-shard%d-data-0.%s-headless.%s.svc.%s" (include "common.names.fullname" $ ) $i (include "common.names.fullname" $ ) $.Release.Namespace $.Values.clusterDomain }}
|
||||
- name: MONGODB_REPLICA_SET_NAME
|
||||
value: {{ printf "%s-shard-%d" ( include "common.names.fullname" $ ) $i }}
|
||||
{{- if $.Values.common.useHostnames }}
|
||||
- name: MONGODB_ADVERTISED_HOSTNAME
|
||||
value: "$(MONGODB_POD_NAME).{{ include "common.names.fullname" $ }}-headless.{{ $.Release.Namespace }}.svc.{{ $.Values.clusterDomain }}"
|
||||
{{- end }}
|
||||
- name: MONGODB_ENABLE_IPV6
|
||||
{{- if $.Values.common.mongodbEnableIPv6 }}
|
||||
value: "yes"
|
||||
{{- else }}
|
||||
value: "no"
|
||||
{{- end }}
|
||||
- name: MONGODB_ENABLE_DIRECTORY_PER_DB
|
||||
{{- if $.Values.common.mongodbDirectoryPerDB }}
|
||||
value: "yes"
|
||||
{{- else }}
|
||||
value: "no"
|
||||
{{- end }}
|
||||
{{- if $.Values.usePasswordFile }}
|
||||
- name: MONGODB_INITIAL_PRIMARY_ROOT_PASSWORD_FILE
|
||||
value: "/bitnami/mongodb/secrets/mongodb-root-password"
|
||||
- name: MONGODB_REPLICA_SET_KEY_FILE
|
||||
value: "/bitnami/mongodb/secrets/mongodb-replica-set-key"
|
||||
{{- else }}
|
||||
- name: MONGODB_INITIAL_PRIMARY_ROOT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "mongodb-sharded.secret" $ }}
|
||||
key: mongodb-root-password
|
||||
- name: MONGODB_REPLICA_SET_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "mongodb-sharded.secret" $ }}
|
||||
key: mongodb-replica-set-key
|
||||
{{- end }}
|
||||
{{- if $.Values.shardsvr.arbiter.mongodbExtraFlags }}
|
||||
- name: MONGODB_EXTRA_FLAGS
|
||||
value: {{ $.Values.shardsvr.arbiter.mongodbExtraFlags | join " " | quote }}
|
||||
{{- end }}
|
||||
{{- if $.Values.common.extraEnvVars }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" $.Values.common.extraEnvVars "context" $ ) | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if $.Values.shardsvr.arbiter.extraEnvVars }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" $.Values.shardsvr.arbiter.extraEnvVars "context" $ ) | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if or $.Values.common.extraEnvVarsCM $.Values.common.extraEnvVarsSecret $.Values.shardsvr.arbiter.extraEnvVarsCM $.Values.shardsvr.arbiter.extraEnvVarsSecret }}
|
||||
envFrom:
|
||||
{{- if $.Values.common.extraEnvVarsCM }}
|
||||
- configMapRef:
|
||||
name: {{ include "common.tplvalues.render" ( dict "value" $.Values.common.extraEnvVarsCM "context" $ ) }}
|
||||
{{- end }}
|
||||
{{- if $.Values.common.extraEnvVarsSecret }}
|
||||
- secretRef:
|
||||
name: {{ include "common.tplvalues.render" ( dict "value" $.Values.common.extraEnvVarsSecret "context" $ ) }}
|
||||
{{- end }}
|
||||
{{- if $.Values.shardsvr.arbiter.extraEnvVarsCM }}
|
||||
- configMapRef:
|
||||
name: {{ include "common.tplvalues.render" ( dict "value" $.Values.shardsvr.arbiter.extraEnvVarsCM "context" $ ) }}
|
||||
{{- end }}
|
||||
{{- if $.Values.shardsvr.arbiter.extraEnvVarsSecret }}
|
||||
- configMapRef:
|
||||
name: {{ include "common.tplvalues.render" ( dict "value" $.Values.shardsvr.arbiter.extraEnvVarsSecret "context" $ ) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if $.Values.diagnosticMode.enabled }}
|
||||
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
|
||||
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if not $.Values.diagnosticMode.enabled }}
|
||||
{{- if $.Values.livenessProbe.enabled }}
|
||||
livenessProbe:
|
||||
tcpSocket:
|
||||
port: mongodb
|
||||
initialDelaySeconds: {{ $.Values.livenessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ $.Values.livenessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ $.Values.livenessProbe.timeoutSeconds }}
|
||||
successThreshold: {{ $.Values.livenessProbe.successThreshold }}
|
||||
failureThreshold: {{ $.Values.livenessProbe.failureThreshold }}
|
||||
{{- end }}
|
||||
{{- if $.Values.readinessProbe.enabled }}
|
||||
readinessProbe:
|
||||
tcpSocket:
|
||||
port: mongodb
|
||||
initialDelaySeconds: {{ $.Values.readinessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ $.Values.readinessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ $.Values.readinessProbe.timeoutSeconds }}
|
||||
successThreshold: {{ $.Values.readinessProbe.successThreshold }}
|
||||
failureThreshold: {{ $.Values.readinessProbe.failureThreshold }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
{{- if or $.Values.shardsvr.arbiter.config $.Values.shardsvr.arbiter.configCM }}
|
||||
- name: config
|
||||
mountPath: /bitnami/mongodb/conf/
|
||||
{{- end }}
|
||||
{{- if $.Values.usePasswordFile }}
|
||||
- name: secrets
|
||||
mountPath: /bitnami/mongodb/secrets/
|
||||
{{- end }}
|
||||
{{- if $.Values.common.initScriptsCM }}
|
||||
- name: custom-init-scripts-cm
|
||||
mountPath: /docker-entrypoint-initdb.d/cm
|
||||
{{- end }}
|
||||
{{- if $.Values.common.initScriptsSecret }}
|
||||
- name: custom-init-scripts-secret
|
||||
mountPath: /docker-entrypoint-initdb.d/secret
|
||||
{{- end }}
|
||||
{{- if $.Values.common.extraVolumeMounts }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" $.Values.common.extraVolumeMounts "context" $ ) | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if $.Values.shardsvr.arbiter.extraVolumeMounts }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" $.Values.shardsvr.arbiter.extraVolumeMounts "context" $ ) | nindent 12 }}
|
||||
{{- end }}
|
||||
resources: {{- toYaml $.Values.shardsvr.arbiter.resources | nindent 12 }}
|
||||
{{- if $.Values.metrics.enabled }}
|
||||
- name: metrics
|
||||
image: {{ include "mongodb-sharded.metrics.image" $ }}
|
||||
imagePullPolicy: {{ $.Values.metrics.image.pullPolicy | quote }}
|
||||
{{- if $.Values.securityContext.enabled }}
|
||||
securityContext:
|
||||
runAsNonRoot: {{ $.Values.securityContext.runAsNonRoot }}
|
||||
runAsUser: {{ $.Values.securityContext.runAsUser }}
|
||||
{{- end }}
|
||||
env:
|
||||
{{- if $.Values.usePasswordFile }}
|
||||
- name: MONGODB_ROOT_PASSWORD_FILE
|
||||
value: "/bitnami/mongodb/secrets/mongodb-root-password"
|
||||
{{- else }}
|
||||
- name: MONGODB_ROOT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "mongodb-sharded.secret" $ }}
|
||||
key: mongodb-root-password
|
||||
{{- end }}
|
||||
{{- if $.Values.diagnosticMode.enabled }}
|
||||
command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 12 }}
|
||||
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
|
||||
{{- else }}
|
||||
command:
|
||||
- sh
|
||||
- -ec
|
||||
- |-
|
||||
#!/bin/sh
|
||||
{{- if $.Values.usePasswordFile }}
|
||||
export MONGODB_ROOT_PASSWORD="$(cat "${MONGODB_ROOT_PASSWORD_FILE}")"
|
||||
{{- end }}
|
||||
/bin/mongodb_exporter --web.listen-address ":{{ $.Values.metrics.containerPort }}" --mongodb.uri mongodb://root:`echo $MONGODB_ROOT_PASSWORD | sed -r "s/@/%40/g;s/:/%3A/g"`@localhost:{{ $.Values.service.port }}/admin{{ ternary "?ssl=true" "" $.Values.metrics.useTLS }} {{ $.Values.metrics.extraArgs }}
|
||||
{{- end }}
|
||||
{{- if $.Values.usePasswordFile }}
|
||||
volumeMounts:
|
||||
- name: secrets
|
||||
mountPath: /bitnami/mongodb/secrets/
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: metrics
|
||||
containerPort: {{ $.Values.metrics.containerPort }}
|
||||
{{- if not $.Values.diagnosticMode.enabled }}
|
||||
{{- if $.Values.metrics.livenessProbe.enabled }}
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /metrics
|
||||
port: metrics
|
||||
initialDelaySeconds: {{ $.Values.metrics.livenessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ $.Values.metrics.livenessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ $.Values.metrics.livenessProbe.timeoutSeconds }}
|
||||
failureThreshold: {{ $.Values.metrics.livenessProbe.failureThreshold }}
|
||||
successThreshold: {{ $.Values.metrics.livenessProbe.successThreshold }}
|
||||
{{- end }}
|
||||
{{- if $.Values.metrics.readinessProbe.enabled }}
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /metrics
|
||||
port: metrics
|
||||
initialDelaySeconds: {{ $.Values.metrics.readinessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ $.Values.metrics.readinessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ $.Values.metrics.readinessProbe.timeoutSeconds }}
|
||||
failureThreshold: {{ $.Values.metrics.readinessProbe.failureThreshold }}
|
||||
successThreshold: {{ $.Values.metrics.readinessProbe.successThreshold }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
resources: {{ toYaml $.Values.metrics.resources | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- with $.Values.shardsvr.arbiter.sidecars }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" . "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with $.Values.common.sidecars }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" . "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
{{- if or $.Values.shardsvr.arbiter.config $.Values.shardsvr.arbiter.configCM }}
|
||||
- name: config
|
||||
configMap:
|
||||
name: {{ include "mongodb-sharded.shardsvr.arbiter.configCM" $ }}
|
||||
{{- end }}
|
||||
{{- if $.Values.usePasswordFile }}
|
||||
- name: secrets
|
||||
secret:
|
||||
secretName: {{ include "mongodb-sharded.secret" $ }}
|
||||
{{- end }}
|
||||
{{- if $.Values.common.initScriptsCM }}
|
||||
- name: custom-init-scripts-cm
|
||||
configMap:
|
||||
name: {{ include "mongodb-sharded.initScriptsCM" $ }}
|
||||
defaultMode: 0755
|
||||
{{- end }}
|
||||
{{- if $.Values.common.initScriptsSecret }}
|
||||
- name: custom-init-scripts-secret
|
||||
secret:
|
||||
secretName: {{ include "mongodb-sharded.initScriptsSecret" $ }}
|
||||
defaultMode: 0755
|
||||
{{- end }}
|
||||
{{- if $.Values.common.extraVolumes }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" $.Values.common.extraVolumes "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if $.Values.shardsvr.arbiter.extraVolumes }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" $.Values.shardsvr.arbiter.extraVolumes "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if lt $i (sub $replicas 1) }}
|
||||
---
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,11 @@
|
||||
{{- if and .Values.shards .Values.shardsvr.dataNode.config }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "common.names.fullname" . }}-shardsvr-data
|
||||
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
||||
app.kubernetes.io/component: shardsvr
|
||||
data:
|
||||
mongodb.conf: |-
|
||||
{{- include "common.tplvalues.render" (dict "value" .Values.shardsvr.dataNode.config "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,23 @@
|
||||
{{- if and .Values.shards .Values.shardsvr.dataNode.pdb.enabled -}}
|
||||
{{- $replicas := .Values.shards | int -}}
|
||||
{{- range $i, $e := until $replicas -}}
|
||||
kind: PodDisruptionBudget
|
||||
apiVersion: {{ include "common.capabilities.policy.apiVersion" . }}
|
||||
metadata:
|
||||
name: {{ printf "%s-shard%d-data" (include "common.names.fullname" $ ) $i }}
|
||||
labels: {{- include "common.labels.standard" $ | nindent 4 }}
|
||||
app.kubernetes.io/component: shardsvr
|
||||
spec:
|
||||
selector:
|
||||
matchLabels: {{- include "common.labels.matchLabels" $ | nindent 6 }}
|
||||
app.kubernetes.io/component: shardsvr
|
||||
shard: {{ $i | quote }}
|
||||
{{- if $.Values.shardsvr.dataNode.pdb.minAvailable }}
|
||||
minAvailable: {{ $.Values.shardsvr.dataNode.pdb.minAvailable | int }}
|
||||
{{- end }}
|
||||
{{- if $.Values.shardsvr.dataNode.pdb.maxUnavailable }}
|
||||
maxUnavailable: {{ $.Values.shardsvr.dataNode.pdb.maxUnavailable | int }}
|
||||
{{- end }}
|
||||
---
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,35 @@
|
||||
{{- if and .Values.shards .Values.metrics.enabled .Values.metrics.podMonitor.enabled }}
|
||||
{{- $replicas := .Values.shards | int }}
|
||||
{{- range $i, $e := until $replicas }}
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: PodMonitor
|
||||
metadata:
|
||||
name: {{ printf "%s-shard%d-data" (include "common.names.fullname" $ ) $i }}
|
||||
{{- if $.Values.metrics.podMonitor.namespace }}
|
||||
namespace: {{ $.Values.metrics.podMonitor.namespace }}
|
||||
{{- else }}
|
||||
namespace: {{ $.Release.Namespace }}
|
||||
{{- end }}
|
||||
labels: {{- include "common.labels.standard" $ | nindent 4 }}
|
||||
app.kubernetes.io/component: shardsvr
|
||||
{{- if $.Values.metrics.podMonitor.additionalLabels }}
|
||||
{{- include "common.tplvalues.render" (dict "value" $.Values.metrics.podMonitor.additionalLabels "context" $) | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
podMetricsEndpoints:
|
||||
- port: metrics
|
||||
path: /metrics
|
||||
{{- if $.Values.metrics.podMonitor.interval }}
|
||||
interval: {{ $.Values.metrics.podMonitor.interval }}
|
||||
{{- end }}
|
||||
{{- if $.Values.metrics.podMonitor.scrapeTimeout }}
|
||||
scrapeTimeout: {{ $.Values.metrics.podMonitor.scrapeTimeout }}
|
||||
{{- end }}
|
||||
namespaceSelector:
|
||||
matchNames:
|
||||
- {{ $.Release.Namespace }}
|
||||
selector:
|
||||
matchLabels: {{- include "common.labels.matchLabels" $ | nindent 6 }}
|
||||
app.kubernetes.io/component: shardsvr
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,387 @@
|
||||
{{- if .Values.shards }}
|
||||
{{- $replicas := .Values.shards | int }}
|
||||
{{- range $i, $e := until $replicas }}
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: {{ printf "%s-shard%d-data" (include "common.names.fullname" $ ) $i }}
|
||||
labels: {{- include "common.labels.standard" $ | nindent 4 }}
|
||||
app.kubernetes.io/component: shardsvr
|
||||
spec:
|
||||
selector:
|
||||
matchLabels: {{- include "common.labels.matchLabels" $ | nindent 6 }}
|
||||
app.kubernetes.io/component: shardsvr
|
||||
podManagementPolicy: {{ $.Values.shardsvr.dataNode.podManagementPolicy }}
|
||||
updateStrategy: {{- toYaml $.Values.shardsvr.dataNode.updateStrategy | nindent 4 }}
|
||||
serviceName: {{ include "common.names.fullname" $ }}-headless
|
||||
replicas: {{ $.Values.shardsvr.dataNode.replicas }}
|
||||
template:
|
||||
metadata:
|
||||
labels: {{- include "common.labels.standard" $ | nindent 8 }}
|
||||
app.kubernetes.io/component: shardsvr
|
||||
{{- if $.Values.shardsvr.dataNode.podLabels }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" $.Values.shardsvr.dataNode.podLabels "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
shard: {{ $i | quote }}
|
||||
{{- if or $.Values.common.podAnnotations $.Values.shardsvr.dataNode.podAnnotations $.Values.metrics.enabled }}
|
||||
annotations:
|
||||
{{- if $.Values.common.podAnnotations }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" $.Values.common.podAnnotations "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if $.Values.shardsvr.dataNode.podAnnotations }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" $.Values.shardsvr.dataNode.podAnnotations "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if $.Values.metrics.enabled }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" $.Values.metrics.podAnnotations "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if $.Values.common.schedulerName }}
|
||||
schedulerName: {{ $.Values.common.schedulerName | quote }}
|
||||
{{- end }}
|
||||
{{- if $.Values.shardsvr.dataNode.affinity }}
|
||||
affinity: {{- include "common.tplvalues.render" (dict "value" $.Values.shardsvr.dataNode.affinity "context" (set $ "dataNodeLoopId" $i)) | nindent 8 }}
|
||||
{{- else }}
|
||||
affinity:
|
||||
podAffinity: {{- include "common.affinities.pods" (dict "type" $.Values.shardsvr.dataNode.podAffinityPreset "component" "shardsvr" "context" $) | nindent 10 }}
|
||||
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" $.Values.shardsvr.dataNode.podAntiAffinityPreset "component" "shardsvr" "context" $) | nindent 10 }}
|
||||
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" $.Values.shardsvr.dataNode.nodeAffinityPreset.type "key" $.Values.shardsvr.dataNode.nodeAffinityPreset.key "values" $.Values.shardsvr.dataNode.nodeAffinityPreset.values) | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- if $.Values.shardsvr.dataNode.hostAliases }}
|
||||
hostAliases: {{- include "common.tplvalues.render" (dict "value" $.Values.shardsvr.dataNode.hostAliases "context" $) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if $.Values.shardsvr.dataNode.nodeSelector }}
|
||||
nodeSelector: {{- include "common.tplvalues.render" (dict "value" $.Values.shardsvr.dataNode.nodeSelector "context" (set $ "dataNodeLoopId" $i)) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if $.Values.shardsvr.dataNode.tolerations }}
|
||||
tolerations: {{- include "common.tplvalues.render" (dict "value" $.Values.shardsvr.dataNode.tolerations "context" (set $ "dataNodeLoopId" $i)) | nindent 8 }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ include "mongodb-sharded.serviceAccountName" (dict "value" $.Values.shardsvr.dataNode.serviceAccount "context" $) }}
|
||||
{{- if $.Values.shardsvr.dataNode.priorityClassName }}
|
||||
priorityClassName: {{ $.Values.shardsvr.dataNode.priorityClassName | quote }}
|
||||
{{- end }}
|
||||
{{- if $.Values.securityContext.enabled }}
|
||||
securityContext:
|
||||
fsGroup: {{ $.Values.securityContext.fsGroup }}
|
||||
{{- end }}
|
||||
{{- include "mongodb-sharded.imagePullSecrets" $ | nindent 6 }}
|
||||
initContainers:
|
||||
{{- if and $.Values.volumePermissions.enabled $.Values.shardsvr.persistence.enabled }}
|
||||
- name: volume-permissions
|
||||
image: {{ include "mongodb-sharded.volumePermissions.image" $ }}
|
||||
imagePullPolicy: {{ $.Values.volumePermissions.image.pullPolicy | quote }}
|
||||
command: ["chown", "-R", "{{ $.Values.securityContext.runAsUser }}:{{ $.Values.securityContext.fsGroup }}", "{{ $.Values.shardsvr.persistence.mountPath }}"]
|
||||
securityContext:
|
||||
runAsUser: 0
|
||||
resources: {{ toYaml $.Values.volumePermissions.resources | nindent 12 }}
|
||||
volumeMounts:
|
||||
- name: datadir
|
||||
mountPath: {{ $.Values.shardsvr.persistence.mountPath }}
|
||||
{{- end }}
|
||||
{{- with $.Values.shardsvr.dataNode.initContainers }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" . "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with $.Values.common.initContainers }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" . "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: mongodb
|
||||
image: {{ include "mongodb-sharded.image" $ }}
|
||||
imagePullPolicy: {{ $.Values.image.pullPolicy }}
|
||||
{{- if $.Values.securityContext.enabled }}
|
||||
securityContext:
|
||||
runAsNonRoot: {{ $.Values.securityContext.runAsNonRoot }}
|
||||
runAsUser: {{ $.Values.securityContext.runAsUser }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- containerPort: {{ $.Values.common.containerPorts.mongo }}
|
||||
name: mongodb
|
||||
env:
|
||||
- name: MONGODB_ENABLE_NUMACTL
|
||||
value: {{ ternary "yes" "no" $.Values.common.mongodbEnableNumactl | quote }}
|
||||
- name: BITNAMI_DEBUG
|
||||
value: {{ ternary "true" "false" (or $.Values.image.debug $.Values.diagnosticMode.enabled) | quote }}
|
||||
- name: MONGODB_SYSTEM_LOG_VERBOSITY
|
||||
value: {{ $.Values.common.mongodbSystemLogVerbosity | quote }}
|
||||
- name: MONGODB_MAX_TIMEOUT
|
||||
value: {{ $.Values.common.mongodbMaxWaitTimeout | quote }}
|
||||
- name: MONGODB_DISABLE_SYSTEM_LOG
|
||||
{{- if $.Values.mongodbDisableSystemLog }}
|
||||
value: "yes"
|
||||
{{- else }}
|
||||
value: "no"
|
||||
{{- end }}
|
||||
- name: MONGODB_PORT_NUMBER
|
||||
value: {{ $.Values.common.containerPorts.mongo | quote }}
|
||||
- name: MONGODB_SHARDING_MODE
|
||||
value: "shardsvr"
|
||||
- name: MONGODB_POD_NAME
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.name
|
||||
- name: MONGODB_MONGOS_HOST
|
||||
value: {{ include "mongodb-sharded.serviceName" $ }}
|
||||
- name: MONGODB_MONGOS_PORT_NUMBER
|
||||
value: {{ $.Values.service.port | quote }}
|
||||
- name: MONGODB_INITIAL_PRIMARY_HOST
|
||||
value: {{ printf "%s-shard%d-data-0.%s-headless.%s.svc.%s" (include "common.names.fullname" $ ) $i (include "common.names.fullname" $ ) $.Release.Namespace $.Values.clusterDomain }}
|
||||
- name: MONGODB_REPLICA_SET_NAME
|
||||
value: {{ printf "%s-shard-%d" ( include "common.names.fullname" $ ) $i }}
|
||||
{{- if $.Values.common.useHostnames }}
|
||||
- name: MONGODB_ADVERTISED_HOSTNAME
|
||||
value: "$(MONGODB_POD_NAME).{{ include "common.names.fullname" $ }}-headless.{{ $.Release.Namespace }}.svc.{{ $.Values.clusterDomain }}"
|
||||
{{- end }}
|
||||
{{- if $.Values.usePasswordFile }}
|
||||
- name: MONGODB_ROOT_PASSWORD_FILE
|
||||
value: "/bitnami/mongodb/secrets/mongodb-root-password"
|
||||
- name: MONGODB_REPLICA_SET_KEY_FILE
|
||||
value: "/bitnami/mongodb/secrets/mongodb-replica-set-key"
|
||||
{{- else }}
|
||||
- name: MONGODB_ROOT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "mongodb-sharded.secret" $ }}
|
||||
key: mongodb-root-password
|
||||
- name: MONGODB_REPLICA_SET_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "mongodb-sharded.secret" $ }}
|
||||
key: mongodb-replica-set-key
|
||||
{{- end }}
|
||||
- name: MONGODB_ENABLE_IPV6
|
||||
{{- if $.Values.common.mongodbEnableIPv6 }}
|
||||
value: "yes"
|
||||
{{- else }}
|
||||
value: "no"
|
||||
{{- end }}
|
||||
- name: MONGODB_ENABLE_DIRECTORY_PER_DB
|
||||
{{- if $.Values.common.mongodbDirectoryPerDB }}
|
||||
value: "yes"
|
||||
{{- else }}
|
||||
value: "no"
|
||||
{{- end }}
|
||||
{{- if $.Values.shardsvr.dataNode.mongodbExtraFlags }}
|
||||
- name: MONGODB_EXTRA_FLAGS
|
||||
value: {{ $.Values.shardsvr.dataNode.mongodbExtraFlags | join " " | quote }}
|
||||
{{- end }}
|
||||
{{- if $.Values.common.extraEnvVars }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" $.Values.common.extraEnvVars "context" $ ) | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if $.Values.shardsvr.dataNode.extraEnvVars }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" $.Values.shardsvr.dataNode.extraEnvVars "context" $ ) | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if or $.Values.common.extraEnvVarsCM $.Values.common.extraEnvVarsSecret $.Values.shardsvr.dataNode.extraEnvVarsCM $.Values.shardsvr.dataNode.extraEnvVarsSecret }}
|
||||
envFrom:
|
||||
{{- if $.Values.common.extraEnvVarsCM }}
|
||||
- configMapRef:
|
||||
name: {{ include "mongodb-sharded.tplValue" ( dict "value" $.Values.common.extraEnvVarsCM "context" $ ) }}
|
||||
{{- end }}
|
||||
{{- if $.Values.common.extraEnvVarsSecret }}
|
||||
- secretRef:
|
||||
name: {{ include "mongodb-sharded.tplValue" ( dict "value" $.Values.common.extraEnvVarsSecret "context" $ ) }}
|
||||
{{- end }}
|
||||
{{- if $.Values.shardsvr.dataNode.extraEnvVarsCM }}
|
||||
- configMapRef:
|
||||
name: {{ include "mongodb-sharded.tplValue" ( dict "value" $.Values.shardsvr.dataNode.extraEnvVarsCM "context" $ ) }}
|
||||
{{- end }}
|
||||
{{- if $.Values.shardsvr.dataNode.extraEnvVarsSecret }}
|
||||
- secretRef:
|
||||
name: {{ include "mongodb-sharded.tplValue" ( dict "value" $.Values.shardsvr.dataNode.extraEnvVarsSecret "context" $ ) }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- if $.Values.diagnosticMode.enabled }}
|
||||
command: {{- include "common.tplvalues.render" (dict "value" $.Values.diagnosticMode.command "context" $) | nindent 12 }}
|
||||
args: {{- include "common.tplvalues.render" (dict "value" $.Values.diagnosticMode.args "context" $) | nindent 12 }}
|
||||
{{- else }}
|
||||
command:
|
||||
- /bin/bash
|
||||
- /entrypoint/replicaset-entrypoint.sh
|
||||
{{- end }}
|
||||
{{- if not $.Values.diagnosticMode.enabled }}
|
||||
{{- if $.Values.livenessProbe.enabled }}
|
||||
livenessProbe:
|
||||
exec:
|
||||
command:
|
||||
- pgrep
|
||||
- mongod
|
||||
initialDelaySeconds: {{ $.Values.livenessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ $.Values.livenessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ $.Values.livenessProbe.timeoutSeconds }}
|
||||
successThreshold: {{ $.Values.livenessProbe.successThreshold }}
|
||||
failureThreshold: {{ $.Values.livenessProbe.failureThreshold }}
|
||||
{{- end }}
|
||||
{{- if $.Values.readinessProbe.enabled }}
|
||||
readinessProbe:
|
||||
exec:
|
||||
command:
|
||||
- mongo
|
||||
- --disableImplicitSessions
|
||||
- --eval
|
||||
- "db.adminCommand('ping')"
|
||||
initialDelaySeconds: {{ $.Values.readinessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ $.Values.readinessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ $.Values.readinessProbe.timeoutSeconds }}
|
||||
successThreshold: {{ $.Values.readinessProbe.successThreshold }}
|
||||
failureThreshold: {{ $.Values.readinessProbe.failureThreshold }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: replicaset-entrypoint-configmap
|
||||
mountPath: /entrypoint
|
||||
- name: datadir
|
||||
mountPath: {{ $.Values.shardsvr.persistence.mountPath }}
|
||||
{{- if or $.Values.shardsvr.dataNode.config $.Values.shardsvr.dataNode.configCM }}
|
||||
- name: config
|
||||
mountPath: /bitnami/mongodb/conf/
|
||||
{{- end }}
|
||||
{{- if $.Values.usePasswordFile }}
|
||||
- name: secrets
|
||||
mountPath: /bitnami/mongodb/secrets/
|
||||
{{- end }}
|
||||
{{- if $.Values.common.initScriptsCM }}
|
||||
- name: custom-init-scripts-cm
|
||||
mountPath: /docker-entrypoint-initdb.d/cm
|
||||
{{- end }}
|
||||
{{- if $.Values.common.initScriptsSecret }}
|
||||
- name: custom-init-scripts-secret
|
||||
mountPath: /docker-entrypoint-initdb.d/secret
|
||||
{{- end }}
|
||||
{{- if $.Values.common.extraVolumeMounts }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" $.Values.common.extraVolumeMounts "context" $ ) | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if $.Values.shardsvr.dataNode.extraVolumeMounts }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" $.Values.shardsvr.dataNode.extraVolumeMounts "context" $ ) | nindent 12 }}
|
||||
{{- end }}
|
||||
resources: {{- toYaml $.Values.shardsvr.dataNode.resources | nindent 12 }}
|
||||
{{- if $.Values.metrics.enabled }}
|
||||
- name: metrics
|
||||
image: {{ include "mongodb-sharded.metrics.image" $ }}
|
||||
imagePullPolicy: {{ $.Values.metrics.image.pullPolicy | quote }}
|
||||
{{- if $.Values.securityContext.enabled }}
|
||||
securityContext:
|
||||
runAsNonRoot: {{ $.Values.securityContext.runAsNonRoot }}
|
||||
runAsUser: {{ $.Values.securityContext.runAsUser }}
|
||||
{{- end }}
|
||||
env:
|
||||
{{- if $.Values.usePasswordFile }}
|
||||
- name: MONGODB_ROOT_PASSWORD_FILE
|
||||
value: "/bitnami/mongodb/secrets/mongodb-root-password"
|
||||
{{- else }}
|
||||
- name: MONGODB_ROOT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "mongodb-sharded.secret" $ }}
|
||||
key: mongodb-root-password
|
||||
{{- end }}
|
||||
{{- if $.Values.diagnosticMode.enabled }}
|
||||
command: {{- include "common.tplvalues.render" (dict "value" $.Values.diagnosticMode.command "context" $) | nindent 12 }}
|
||||
args: {{- include "common.tplvalues.render" (dict "value" $.Values.diagnosticMode.args "context" $) | nindent 12 }}
|
||||
{{- else }}
|
||||
command:
|
||||
- sh
|
||||
- -ec
|
||||
- |-
|
||||
#!/bin/sh
|
||||
{{- if $.Values.usePasswordFile }}
|
||||
export MONGODB_ROOT_PASSWORD="$(cat "${MONGODB_ROOT_PASSWORD_FILE}")"
|
||||
{{- end }}
|
||||
/bin/mongodb_exporter --web.listen-address ":{{ $.Values.metrics.containerPort }}" --mongodb.uri mongodb://root:`echo $MONGODB_ROOT_PASSWORD | sed -r "s/@/%40/g;s/:/%3A/g"`@localhost:{{ $.Values.service.port }}/admin{{ ternary "?ssl=true" "" $.Values.metrics.useTLS }} {{ $.Values.metrics.extraArgs }}
|
||||
{{- end }}
|
||||
{{- if $.Values.usePasswordFile }}
|
||||
volumeMounts:
|
||||
- name: secrets
|
||||
mountPath: /bitnami/mongodb/secrets/
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: metrics
|
||||
containerPort: {{ $.Values.metrics.containerPort }}
|
||||
{{- if not $.Values.diagnosticMode.enabled }}
|
||||
{{- if $.Values.metrics.livenessProbe.enabled }}
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /metrics
|
||||
port: metrics
|
||||
initialDelaySeconds: {{ $.Values.metrics.livenessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ $.Values.metrics.livenessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ $.Values.metrics.livenessProbe.timeoutSeconds }}
|
||||
failureThreshold: {{ $.Values.metrics.livenessProbe.failureThreshold }}
|
||||
successThreshold: {{ $.Values.metrics.livenessProbe.successThreshold }}
|
||||
{{- end }}
|
||||
{{- if $.Values.metrics.readinessProbe.enabled }}
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /metrics
|
||||
port: metrics
|
||||
initialDelaySeconds: {{ $.Values.metrics.readinessProbe.initialDelaySeconds }}
|
||||
periodSeconds: {{ $.Values.metrics.readinessProbe.periodSeconds }}
|
||||
timeoutSeconds: {{ $.Values.metrics.readinessProbe.timeoutSeconds }}
|
||||
failureThreshold: {{ $.Values.metrics.readinessProbe.failureThreshold }}
|
||||
successThreshold: {{ $.Values.metrics.readinessProbe.successThreshold }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
resources: {{ toYaml $.Values.metrics.resources | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- with $.Values.shardsvr.dataNode.sidecars }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" . "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with $.Values.common.sidecars }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" . "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: replicaset-entrypoint-configmap
|
||||
configMap:
|
||||
name: {{ include "common.names.fullname" $ }}-replicaset-entrypoint
|
||||
{{- if $.Values.usePasswordFile }}
|
||||
- name: secrets
|
||||
secret:
|
||||
secretName: {{ include "mongodb-sharded.secret" $ }}
|
||||
{{- end }}
|
||||
{{- if $.Values.common.initScriptsCM }}
|
||||
- name: custom-init-scripts-cm
|
||||
configMap:
|
||||
name: {{ include "mongodb-sharded.initScriptsCM" $ }}
|
||||
defaultMode: 0755
|
||||
{{- end }}
|
||||
{{- if $.Values.common.initScriptsSecret }}
|
||||
- name: custom-init-scripts-secret
|
||||
secret:
|
||||
secretName: {{ include "mongodb-sharded.initScriptsSecret" $ }}
|
||||
defaultMode: 0755
|
||||
{{- end }}
|
||||
{{- if or $.Values.shardsvr.dataNode.config $.Values.shardsvr.dataNode.configCM }}
|
||||
- name: config
|
||||
configMap:
|
||||
name: {{ include "mongodb-sharded.shardsvr.dataNode.configCM" $ }}
|
||||
{{- end }}
|
||||
{{- if $.Values.common.extraVolumes }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" $.Values.common.extraVolumes "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if $.Values.shardsvr.dataNode.extraVolumes }}
|
||||
{{- include "common.tplvalues.render" ( dict "value" $.Values.shardsvr.dataNode.extraVolumes "context" $ ) | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if $.Values.shardsvr.persistence.enabled }}
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: datadir
|
||||
annotations:
|
||||
{{- range $key, $value := $.Values.shardsvr.persistence.annotations }}
|
||||
{{ $key }}: "{{ $value }}"
|
||||
{{- end }}
|
||||
spec:
|
||||
accessModes:
|
||||
{{- range $.Values.shardsvr.persistence.accessModes }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ $.Values.shardsvr.persistence.size | quote }}
|
||||
{{- include "common.storage.class" (dict "persistence" $.Values.shardsvr.persistence "global" $.Values.global) | nindent 8 }}
|
||||
{{- else }}
|
||||
- name: datadir
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
{{- if lt $i (sub $replicas 1) }}
|
||||
---
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
Reference in New Issue
Block a user