-
-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathmongo.yaml
More file actions
151 lines (122 loc) · 3.44 KB
/
mongo.yaml
File metadata and controls
151 lines (122 loc) · 3.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# mongo secrets used with backend and with local mongo, if any
---
apiVersion: v1
kind: Secret
metadata:
name: mongo-auth
namespace: {{ .Values.crawler_namespace }}
type: Opaque
stringData:
MONGO_INITDB_ROOT_USERNAME: "{{ .Values.mongo_auth.username }}"
MONGO_INITDB_ROOT_PASSWORD: "{{ .Values.mongo_auth.password }}"
MONGO_HOST: "{{ .Values.mongo_host }}"
{{- if .Values.mongo_auth.db_url }}
MONGO_DB_URL: "{{ .Values.mongo_auth.db_url }}"
{{- else }}
MONGO_DB_URL: "mongodb://{{ urlquery .Values.mongo_auth.username }}:{{ urlquery .Values.mongo_auth.password }}@{{ .Values.mongo_host }}:27017/browsertrixcloud?tls=false&authSource=admin"
{{- end }}
---
apiVersion: v1
kind: Secret
metadata:
name: mongo-auth
namespace: {{ .Release.Namespace }}
type: Opaque
stringData:
MONGO_INITDB_ROOT_USERNAME: "{{ .Values.mongo_auth.username }}"
MONGO_INITDB_ROOT_PASSWORD: "{{ .Values.mongo_auth.password }}"
MONGO_HOST: "{{ .Values.mongo_host }}"
{{- if .Values.mongo_auth.db_url }}
MONGO_DB_URL: "{{ .Values.mongo_auth.db_url }}"
{{- else }}
MONGO_DB_URL: "mongodb://{{ urlquery .Values.mongo_auth.username }}:{{ urlquery .Values.mongo_auth.password }}@{{ .Values.mongo_host }}:27017/browsertrixcloud?tls=false&authSource=admin"
{{- end }}
{{- if .Values.mongo_local }}
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: local-mongo
namespace: {{ .Release.Namespace }}
spec:
selector:
matchLabels:
app: local-mongo
serviceName: local-mongo
replicas: {{ .Values.backend_num_replicas }}
podManagementPolicy: Parallel
volumeClaimTemplates:
- metadata:
name: data-db
annotations:
helm.sh/resource-policy: keep
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 2Gi
{{- if .Values.volume_storage_class }}
storageClassName: {{ .Values.volume_storage_class }}
{{- end }}
template:
metadata:
labels:
app: local-mongo
spec:
{{- if .Values.main_node_type }}
nodeSelector:
nodeType: {{ .Values.main_node_type }}
{{- end }}
containers:
- name: mongo
image: {{ .Values.mongo_image }}
{{- if .Values.mongo_run_repair }}
command: ["mongod", "--repair"]
{{- end }}
imagePullPolicy: {{ .Values.mongo_pull_policy }}
envFrom:
- secretRef:
name: mongo-auth
volumeMounts:
- name: data-db
mountPath: /data/db
subPath: mongo
resources:
limits:
memory: {{ .Values.mongo_memory }}
requests:
cpu: {{ .Values.mongo_cpu }}
memory: {{ .Values.mongo_memory }}
# should work with 6.0.x with longer timeout
readinessProbe:
timeoutSeconds: 20
periodSeconds: 40
initialDelaySeconds: 5
successThreshold: 1
failureThreshold: 5
exec:
command:
- mongosh
- --eval
- db.adminCommand('ping')
- --quiet
---
apiVersion: v1
kind: Service
metadata:
namespace: {{ .Release.Namespace }}
name: local-mongo
labels:
app: local-mongo
spec:
#type: ClusterIP
clusterIP: None
selector:
app: local-mongo
ports:
- protocol: TCP
port: 27017
targetPort: 27017
name: mongo
{{- end }}