Skip to content

MongoDB Standalone - issue with templates  #250

Open
@gauravjain1582

Description

@gauravjain1582

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions