Dedicated mongo for inventory

This commit is contained in:
2025-12-22 21:37:15 +02:00
parent d174b12e73
commit c74041cffc
3 changed files with 91 additions and 1 deletions

View File

@@ -32,7 +32,7 @@ spec:
- secretRef:
name: inventory-cookies
- secretRef:
name: inventory-mongodb
name: mongodb-user-password
- secretRef:
name: inventory-s3
name: inventory-app

View File

@@ -11,3 +11,4 @@ resources:
- ./inventory-extras.yaml
- ./inventory-redirects.yaml
- ./goredirect.yaml
- ./mongo.yaml

89
hackerspace/mongo.yaml Normal file
View File

@@ -0,0 +1,89 @@
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: mongodb
spec:
selector:
matchLabels:
app: mongodb
replicas: 1
minReadySeconds: 10
template:
metadata:
labels:
app: mongodb
spec:
terminationGracePeriodSeconds: 10
containers:
- name: mongodb
image: mongo:8
ports:
- containerPort: 27017
name: mongo
env:
- name: MONGO_INITDB_ROOT_USERNAME
value: "root"
- name: MONGO_INITDB_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: mongodb-root-password
key: MONGO_INITDB_ROOT_PASSWORD
- name: MONGO_DBNAME
value: application
- name: MONGO_USER
value: application
- name: MONGO_PASS
valueFrom:
secretKeyRef:
name: mongodb-user-password
key: MONGO_PASS
- name: MONGO_AUTHSOURCE
value: "admin"
volumeMounts:
- name: data
mountPath: /data/db
volumeClaimTemplates:
- metadata:
name: data
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: ceph-rbd
resources:
requests:
storage: 10Gi
---
apiVersion: codemowers.cloud/v1beta1
kind: SecretClaim
metadata:
name: mongodb-root-password
spec:
size: 32
mapping:
- key: MONGO_INITDB_ROOT_PASSWORD
value: "%(plaintext)s"
---
apiVersion: codemowers.cloud/v1beta1
kind: SecretClaim
metadata:
name: mongodb-user-password
spec:
size: 32
mapping:
- key: MONGO_PASS
value: "%(plaintext)s"
- key: MONGO_URI
value: "mongodb://application:%(plaintext)s@mongodb/application&authSource=admin"
---
apiVersion: v1
kind: Service
metadata:
name: mongodb
spec:
ports:
- port: 27017
name: mongo
targetPort: 27017
selector:
app: mongodb
type: ClusterIP