Add MongoDB managed service based on Percona Operator for MongoDB with: - Replica set mode (default) and sharded cluster mode - Configurable replicas, storage, and resource presets - Custom users with role-based access control - S3-compatible backup with PITR support - Bootstrap/restore from backup - External access support - WorkloadMonitor integration for dashboard - Comprehensive helm-unittest test coverage (91 tests) Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Aleksei Sviridkin <f@lex.la>
34 lines
1.5 KiB
YAML
34 lines
1.5 KiB
YAML
{{- $clusterDomain := (index .Values._cluster "cluster-domain") | default "cozy.local" }}
|
|
{{- $operatorSecret := lookup "v1" "Secret" .Release.Namespace (printf "internal-%s-users" .Release.Name) }}
|
|
{{- $password := "" }}
|
|
{{- if and $operatorSecret (hasKey $operatorSecret.data "MONGODB_DATABASE_ADMIN_PASSWORD") }}
|
|
{{- $password = index $operatorSecret.data "MONGODB_DATABASE_ADMIN_PASSWORD" | b64dec }}
|
|
{{- end }}
|
|
---
|
|
# Dashboard credentials - lookup from operator-created secret
|
|
# Operator creates secret named "internal-<release>-users" with system user passwords
|
|
# Note: On first install, password/uri will be empty until operator creates the secret.
|
|
# Run 'helm upgrade' after MongoDB is ready to populate credentials.
|
|
apiVersion: v1
|
|
kind: Secret
|
|
metadata:
|
|
name: {{ .Release.Name }}-credentials
|
|
type: Opaque
|
|
stringData:
|
|
username: databaseAdmin
|
|
password: {{ $password | quote }}
|
|
{{- if .Values.sharding }}
|
|
host: {{ .Release.Name }}-mongos.{{ .Release.Namespace }}.svc.{{ $clusterDomain }}
|
|
{{- else }}
|
|
host: {{ .Release.Name }}-rs0.{{ .Release.Namespace }}.svc.{{ $clusterDomain }}
|
|
{{- end }}
|
|
port: "27017"
|
|
{{- if $password }}
|
|
{{- if .Values.sharding }}
|
|
uri: mongodb://databaseAdmin:{{ $password | urlquery }}@{{ .Release.Name }}-mongos.{{ .Release.Namespace }}.svc.{{ $clusterDomain }}:27017/admin
|
|
{{- else }}
|
|
uri: mongodb://databaseAdmin:{{ $password | urlquery }}@{{ .Release.Name }}-rs0.{{ .Release.Namespace }}.svc.{{ $clusterDomain }}:27017/admin?replicaSet=rs0
|
|
{{- end }}
|
|
{{- else }}
|
|
uri: ""
|
|
{{- end }}
|