CHART NAME: {{ .Chart.Name }}
CHART VERSION: {{ .Chart.Version }}
APP VERSION: {{ .Chart.AppVersion }}

** Please be patient while the chart is being deployed **

{{- $dbSecretName := include "node.mongodb.fullname" . -}}

{{- if .Values.diagnosticMode.enabled }}
The chart has been deployed in diagnostic mode. All probes have been disabled and the command has been overwritten with:

  command: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.command "context" $) | nindent 4 }}
  args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 4 }}

Get the list of pods by executing:

  kubectl get pods --namespace {{ include "common.names.namespace" .  }} -l app.kubernetes.io/instance={{ .Release.Name }}

Access the pod you want to debug by executing

  kubectl exec --namespace {{ include "common.names.namespace" .  }} -ti <NAME OF THE POD> -- bash

{{- else }}

1. Get the URL of your Node app  by running:

{{- if eq .Values.service.type "NodePort" }}

  export NODE_PORT=$(kubectl get --namespace {{ include "common.names.namespace" . }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "common.names.fullname" . }})
  export NODE_IP=$(kubectl get nodes --namespace {{ include "common.names.namespace" . }} -o jsonpath="{.items[0].status.addresses[0].address}")
  echo "Node app URL: http://$NODE_IP:$NODE_PORT/"

{{- else if eq .Values.service.type "LoadBalancer" }}

  NOTE: It may take a few minutes for the LoadBalancer IP to be available.
        Watch the status with: 'kubectl get svc -w {{ template "common.names.fullname" . }} --namespace {{ include "common.names.namespace" . }}'

  export SERVICE_IP=$(kubectl get svc --namespace {{ include "common.names.namespace" . }} {{ template "common.names.fullname" . }} --template "{{ "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}" }}")
  echo "Node app URL: http://$SERVICE_IP/"

{{- else if eq .Values.service.type "ClusterIP" }}

  kubectl port-forward --namespace {{ include "common.names.namespace" . }} svc/{{ template "common.names.fullname" . }} {{ .Values.service.ports.http  }}:{{ .Values.service.ports.http }}
  echo "Node app URL: http://127.0.0.1:{{ .Values.service.ports.http }}/"

{{- end }}
{{- end }}

{{- include "node.checkRollingTags" . }}
{{- include "node.validateValues" . }}
