stackstorm-k8s icon indicating copy to clipboard operation
stackstorm-k8s copied to clipboard

MongoDB Standalone - issue with templates

Open gauravjain1582 opened this issue 4 years ago • 1 comments

Folks, I observed an issue with init jobs config (for deployments relay on mongodb), specifically when mongoDB set to run in standalone architecture. k8s do not create headless service for standalone mode, hence a service/endpoint should be referred in place of headless services.

Following need some logical handing for standalone mode. until nc -z -w 2 {{ $.Release.Name }}-mongodb-headless {{ $mongodb_port }} && echo mongodb ok;

--->

until nc -z -w 2 {{ $.Release.Name }}-mongodb {{ $mongodb_port }} && echo mongodb ok;

`

{{- $mongodb_port := (int (index .Values "mongodb" "service" "port")) }}
- name: wait-for-db
  image: busybox:1.28
  command:
    - 'sh'
    - '-c'
    - >
      until nc -z -w 2 {{ $.Release.Name }}-mongodb-headless {{ $mongodb_port }} && echo mongodb ok;
        do
          echo 'Waiting for MongoDB Connection...'
          sleep 2;
      done
{{- end }}
{{- end -}}

let me know if anyone able to reproduce it.

Thanks

gauravjain1582 avatar Sep 16 '21 03:09 gauravjain1582

The relevant sections of the template are here: https://github.com/StackStorm/stackstorm-ha/blob/8388b0bb741be1f1c77ab7d942f9c0e4aae23624/templates/_helpers.tpl#L42-L55 https://github.com/StackStorm/stackstorm-ha/blob/8388b0bb741be1f1c77ab7d942f9c0e4aae23624/templates/_helpers.tpl#L89-L104

It is interesting that we handle the non -headless case in one helper but not the other. I would be happy to review a PR that improves this. Thanks!

cognifloyd avatar Nov 11 '21 21:11 cognifloyd