browsertrix/chart/templates/mongo.yaml
Ilya Kreymer 82ffc0dfbc
Local Deployment Work: Support running locally + test cluster on CI (#396)
* k8s local deployment work:
- make it easier to deploy w/o ingress by setting 'local_service_port' (suggested port 30870)
- if using local minio, ensure file endpoints set to /data/ and /data/ proxies correctly to local bucket
- if not using minio, ensure file endpoints point to correct access / endpoint url.
- setup should work with docker desktop, minikube, microk8s and k3s!
- nginx chart: bump nginx memory limit to 20Mi
- nginx image: 00-default-override-resolver-config -> 00-browsertrix-nginx-init for clarity
- nginx image: use default nginx.conf, pin to nginx 1.23.2
- mongo: readd readiness probe, bump connect wait timeout (needed for ci)
- config: set superadmin username to 'admin'
- config schema: set 'name' as required 
- add sample chart values overrides:
- chart values: local-config.yaml for running locally with 'local_service_port'
- chart values: add microk8s-hosted.yaml for configuring a hosted microk8s setup
- chart values: add microk8s-ci.yaml for ci tests
- ci: remove docker swarm tests
- ci: add microk8s integration tests: launching cluster, logging in, running a crawl of example.com, downloading/checking WACZ
- bump to 1.1.0-beta.2
2022-12-02 19:58:34 -08:00

140 lines
2.9 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.api_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:
cpu: {{ .Values.mongo_limits_cpu }}
memory: {{ .Values.mongo_limits_memory }}
requests:
cpu: {{ .Values.mongo_requests_cpu }}
memory: {{ .Values.mongo_requests_memory }}
# reenable for now with mongo 5.0.x
readinessProbe:
timeoutSeconds: 10
successThreshold: 1
failureThreshold: 2
exec:
command:
- mongo
- --eval
- db.adminCommand('ping')
---
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 }}