Skip to content

Commit

Permalink
Add mongo to deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
FozzieHi committed Aug 4, 2024
1 parent 9783861 commit 8c34663
Showing 1 changed file with 73 additions and 1 deletion.
74 changes: 73 additions & 1 deletion deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ spec:
valueFrom:
secretKeyRef:
name: formula-one-credentials
key: db-name
key: mongodb-db-name
- name: TOKEN
valueFrom:
secretKeyRef:
Expand All @@ -61,3 +61,75 @@ spec:
path: /healthz
port: 8080
initialDelaySeconds: 3
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: mongo
namespace: formulaone
spec:
serviceName: mongo
selector:
matchLabels:
app: mongo
replicas: 1
template:
metadata:
labels:
app: mongo
spec:
containers:
- name: mongo
image: mongo:7.0.12
ports:
- containerPort: 27017
livenessProbe:
exec:
command:
- mongosh
- --eval
- "db.adminCommand('ping')"
initialDelaySeconds: 5
readinessProbe:
exec:
command:
- mongosh
- --eval
- "db.adminCommand('ping')"
initialDelaySeconds: 5
env:
- name: MONGO_INITDB_ROOT_USERNAME
valueFrom:
secretKeyRef:
name: formula-one-credentials
key: mongodb-root-username
- name: MONGO_INITDB_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: formula-one-credentials
key: mongodb-root-password
volumeMounts:
- mountPath: "/data/db"
name: mongo-pvc
volumeClaimTemplates:
- metadata:
name: mongo-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
storageClassName: do-block-storage
---
apiVersion: v1
kind: Service
metadata:
name: mongo-service
namespace: formulaone
spec:
selector:
app: mongo
ports:
- protocol: TCP
port: 27017

0 comments on commit 8c34663

Please sign in to comment.