browsertrix/chart/templates/mongo.yaml
Ilya Kreymer 7ea6d76f10
Resource Constraints Cleanup: (fixes #895) (#1019)
* resource constraints: (fixes #895)
- for cpu, only set cpu requests
- for memory, set mem requests == mem limits
- add missing resource constraints for minio and scheduled job
- for crawler, set mem and cpu constraints per browser, scale based on browser instances per crawler
- add comments in values.yaml for crawler values being multiplied
- default values: bump crawler to 650 millicpu per browser instance just in case

cleanup: remove unused entries from main backend configmap
2023-08-01 00:11:16 -07:00

142 lines
3.0 KiB
YAML

# 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 }}"
MONGO_DB_URL: "{{ .Values.mongo_auth.db_url }}"
---
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 }}"
MONGO_DB_URL: "{{ .Values.mongo_auth.db_url }}"
{{- 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 }}