New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable support for MongoDB persistence in K8s #364
Enable support for MongoDB persistence in K8s #364
Conversation
…ann <kai.zimmermann@microsoft.com>
@kaizimmerm Why do you not connect a CosmosDB instance for a persistent storage example for ditto on Azure? |
@ghandim I intend to look into this soon. However, I would like to keep the MongoDB embedded option for test/dev purposes and especially there it is really annoying if you lose your data all the time. Besides this patch will work in other K8s environments that have storage support as well. I hear there are other clouds next on Azure in existence, all balderdash of course 😈 Kai |
@kaizimmerm Good point :-) I will give it a try... |
|
||
...either with persistent storage | ||
|
||
```bash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kaizimmerm I think you have to add here (cd ../helm/eclipse-ditto/ && helm dependency update)
. Otherwise you get a weird message from helm...
Signed-off-by: Kai Zimmermann <kai.zimmermann@microsoft.com>
...either with persistent storage | ||
|
||
```bash | ||
helm upgrade ditto ../helm/eclipse-ditto/ --namespace $k8s_namespace --set service.type=LoadBalancer,mongodb.persistence.enabled=true,mongodb.persistence.storageClass=managed-premium-retain --wait --install |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kaizimmerm Whats the advantage to use an own storage class definition instead of the default one? If I spin up ditto with helm upgrade ditto ../helm/eclipse-ditto/ --namespace $k8s_namespace --set service.type=LoadBalancer,mongodb.persistence.enabled=true --wait --install
K8s generates a default persistent volume with from my point of view the same configuration as configured in managed-premium-retain
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kaizimmerm Now I got it. The important difference is the retain
policy.
@kaizimmerm I think if we want to support the preservation of the mongodb data between complete reinstallations of ditto e.g. with
Then we can upgrade/install ditto without any data loss with
With that it could be sufficient to use the default storage-class because the storage is deleted only when the pvc is deleted, or? What do you think? |
Please ignore the Codacy check - I tried that out and it did "review" all open PRs |
@ghandim yes, I guess that would work. I could add a paragraph on this to the helm guide. Agreed? |
Signed-off-by: Kai Zimmermann <kai.zimmermann@microsoft.com>
@kaizimmerm With this pvc I was able to create a persistent reusable (default) storage in Azure AKS/Minikube:
To use the storage on Minikube in the namespace dittons you have to create ditto with
On Azure:
So I think we should align also the helm documentation and use a separate namespace dittons and move the ditto-pvc to helm. Then also for the developers it is more clear that there are not many differences between the deployments on different environments. |
@ghandim In Azure (and I assume other K8s setups as well) there are already PVCs pre setup. So I would make this an optional step in the helm guide. |
@ghandim forget it, I mixed something up 😄 So I agree, I will adapt accordingly |
Signed-off-by: Kai Zimmermann <kai.zimmermann@microsoft.com>
@ghandim added it, let me know what you think |
deployment/helm/README.md
Outdated
@@ -44,8 +44,32 @@ helm init | |||
|
|||
```bash | |||
cd <DITTO_PATH>/deployment/helm/ | |||
kubectl create namespace dittons | |||
helm update dependencies |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Path is missing here: helm dependencies update ./eclipse-ditto/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, good catch!
Signed-off-by: Kai Zimmermann <kai.zimmermann@microsoft.com>
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: ditto-pvc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kaizimmerm Should we name the pvc also ditto-mongodb-pvc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
deployment/azure/README.md
Outdated
```bash | ||
echo " storageClassName: managed-premium-retain" >> ../helm/ditto-mongodb-pvc.yaml | ||
kubectl apply -f ../helm/ditto-mongodb-pvc.yaml --namespace $k8s_namespace | ||
helm upgrade ditto ../helm/eclipse-ditto/ --namespace $k8s_namespace --set service.type=LoadBalancer,mongodb.persistence.enabled=true,mongodb.persistence.existingClaim=ditto-pvc --wait --install |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto-mongodb-pvc has now to be used here also for the existingClaim ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done 😄
704ec1d
to
83fa39d
Compare
@kaizimmerm One last thing.... |
@ghandim sure, will do that |
@kaizimmerm Last but not least I would reduce the values in Charts.yaml to
What do you think? |
af8bd92
to
3f2257b
Compare
@kaizimmerm LGTM 👍 @thjaeckle Nothing more to add from my point of view at the moment. |
Awesome, thank you both for the effort 👍 |
Hi,
small but practical improvement is to use persistent storage in the K8s setup for the MongoDB.
So I:
stable/mongodb
chart which has this feature (and many more) already included.Let me know what you think,
Kai