Skip to content

Commit

Permalink
use persistent volume for mongodb
Browse files Browse the repository at this point in the history
  • Loading branch information
rdcm committed Nov 19, 2023
1 parent 3365d63 commit f763faa
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 2 deletions.
4 changes: 4 additions & 0 deletions helm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ description: Development environment
type: application
version: 0.1.0
appVersion: "1.16.0"
dependencies:
- name: ingress-nginx
version: "4.8.3"
repository: "https://kubernetes.github.io/ingress-nginx"
8 changes: 7 additions & 1 deletion helm/templates/mongodb/deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,11 @@ spec:
cpu: {{ .Values.mongodb.resources.limits.cpu }}
ports:
- containerPort: {{ .Values.mongodb.port }}

volumeMounts:
- mountPath: /data/db
name: {{ .Values.mongodb.label }}
volumes:
- name: {{ .Values.mongodb.label }}
persistentVolumeClaim:
claimName: {{ .Values.mongodb.label }}

11 changes: 11 additions & 0 deletions helm/templates/mongodb/persistent-volume-claim.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ .Values.mongodb.label }}
spec:
resources:
requests:
storage: {{ .Values.mongodb.volume.capacity }}
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
14 changes: 14 additions & 0 deletions helm/templates/mongodb/persistent-volume.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: {{ .Values.mongodb.label }}
spec:
capacity:
storage: {{ .Values.mongodb.volume.capacity }}
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Retain
hostPath:
path: /data/{{ .Values.mongodb.label }}
type: ""
4 changes: 3 additions & 1 deletion helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ mongodb:
tag: latest
resources:
limits:
memory: "128Mi"
memory: "512Mi"
cpu: "500m"
volume:
capacity: 1000Mi

kafka:
label: kafka
Expand Down

0 comments on commit f763faa

Please sign in to comment.