From b82a9ad4a60d8384bf1f86b087a0e2b5d2584cda Mon Sep 17 00:00:00 2001 From: ahmadzana Date: Sun, 10 Sep 2023 15:24:35 +0300 Subject: [PATCH] add volume claim to mongodb deployment --- docker/kubernetes/kustomize/kustomization.yaml | 2 ++ docker/kubernetes/kustomize/mongodb-deployment.yaml | 7 +++++++ docker/kubernetes/kustomize/mongodb-volume.yaml | 12 ++++++++++++ 3 files changed, 21 insertions(+) create mode 100644 docker/kubernetes/kustomize/mongodb-volume.yaml diff --git a/docker/kubernetes/kustomize/kustomization.yaml b/docker/kubernetes/kustomize/kustomization.yaml index 434cdaf9433..9b066f33ff4 100644 --- a/docker/kubernetes/kustomize/kustomization.yaml +++ b/docker/kubernetes/kustomize/kustomization.yaml @@ -2,6 +2,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: + - mongodb-volume.yaml - mongodb-deployment.yaml - mongodb-service.yaml - api-deployment.yaml @@ -18,6 +19,7 @@ resources: - ws-service.yaml - worker-deployment.yaml - worker-service.yaml + # namespace # Adds namespace to all resources. diff --git a/docker/kubernetes/kustomize/mongodb-deployment.yaml b/docker/kubernetes/kustomize/mongodb-deployment.yaml index 14c149bbcc6..d36e7666557 100644 --- a/docker/kubernetes/kustomize/mongodb-deployment.yaml +++ b/docker/kubernetes/kustomize/mongodb-deployment.yaml @@ -28,3 +28,10 @@ spec: name: mongodb ports: - containerPort: 27017 + volumeMounts: + - name: "mongodb-persistent-storage" + mountPath: "/data/db" + volumes: + - name: "mongodb-persistent-storage" + persistentVolumeClaim: + claimName: "novu-mongodb-pvc" diff --git a/docker/kubernetes/kustomize/mongodb-volume.yaml b/docker/kubernetes/kustomize/mongodb-volume.yaml new file mode 100644 index 00000000000..079449ffffa --- /dev/null +++ b/docker/kubernetes/kustomize/mongodb-volume.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: novu-mongodb-pvc +spec: + resources: + requests: + storage: 5Gi + volumeMode: Filesystem + storageClassName: local-storage + accessModes: + - ReadWriteOnce