StackStorm / stackstorm-k8s

K8s Helm Chart that codifies StackStorm (aka "IFTTT for Ops" https://stackstorm.com/) Highly Availability fleet as a simple to use reproducible infrastructure-as-code app
https://helm.stackstorm.com/
Apache License 2.0
105 stars 106 forks source link

MongoDB standalone architecture handling - missing in template #251

Open gauravjain1582 opened 3 years ago

gauravjain1582 commented 3 years ago

folks, I figured MongoDB standalone architecture handling is also required in configmaps_st2-conf.yaml template. At the moment Standalone or Replicate set both populate list of mondo-pb pod endpoints to config.

https://github.com/StackStorm/stackstorm-ha/blob/master/templates/configmaps_st2-conf.yaml

   {{- if index .Values "mongodb" "auth" "enabled" }}
    host = mongodb://{{ template "mongodb-nodes" $ }}/{{ required "mongodb.auth.database is required!" (index .Values "mongodb" "auth" "database") }}?authSource={{ required "mongodb.auth.database is required!" (index .Values "mongodb" "auth" "database") }}&replicaSet={{ index .Values "mongodb" "replicaSetName" }}
    username = {{ required "mongodb.auth.username is required!" (index .Values "mongodb" "auth" "username") }}
    password = {{ required "mongodb.auth.password is required!" (index .Values "mongodb" "auth" "password") }}
    db_name = {{ required "mongodb.auth.database is required!" (index .Values "mongodb" "auth" "database") }}
    {{- else }}
    host = mongodb://{{ template "mongodb-nodes" $ }}/?replicaSet={{ index .Values "mongodb" "replicaSetName" }}

I can reproduce everything in my env. I fix would be needed.

Thx G

arms11 commented 3 years ago

Hi @gauravjain1582 this is by design. MongoDB standalone is not a recommended option for StackStorm-HA deployment. All pods (as appropriate) and external dependencies are expected to be HA. Ideally, standalone should only be used in development/testing environment. For Production replicaset is the way to go. Hope that helps.

cognifloyd commented 3 years ago

Why would you install a standalone MongoDB in kubernetes? If you have a standalone MongoDB instance outside of kubernetes, then you should be disabling the mongodb chart, and provide your own database host/auth config in .Values.st2.config.

If, however, you are using the mongo subchart to somehow install a standalone mongo, then I'm happy to review a pull request that fixes support for that setup. What changes would be required to support that? Is it minimal?