{{- include "deploy.validateValues" . }}

{{- if (include "deploy.serverUrl" .) }}
## To get the application URL, run:
{{ include "deploy.serverUrl" . }}
{{- end }}
## To connect over HTTP port forward on port {{ .Values.master.containerPorts.deployHttp }} use:
kubectl port-forward service/{{ include "common.names.fullname" . }} {{ .Values.master.containerPorts.deployHttp }}:{{ .Values.master.services.lb.portNames.deployHttp }}
## To get the admin password for Digitalai Deploy, run:
{{- if kindIs "map" .Values.auth.adminPassword }}
kubectl get secret --namespace {{ .Release.Namespace }} {{ .Values.auth.adminPassword.valueFrom.secretKeyRef.name }} -o jsonpath="{ .data.{{ .Values.auth.adminPassword.valueFrom.secretKeyRef.key }} }" | base64 --decode; echo
{{- else }}
kubectl get secret --namespace {{ .Release.Namespace }} {{ include "common.names.fullname" . }} -o jsonpath="{.data.deployPassword}" | base64 --decode; echo
{{- end }}

{{- if .Values.master.podServiceTemplate.enabled }}
## Access to the master's akka services is avalable via .Values.worker.podServiceTemplate.type services:
{{- range $podNumber := untilStep 0 (int .Values.worker.replicaCount) 1 }}
{{- $newValues := merge (dict "podNumber" $podNumber) $ }}
## - "{{- include "common.tplvalues.render" (dict "value" $.Values.worker.podServiceTemplate.name "context" $newValues) }}"
{{- end }}
{{- else }}
## Access to the master's services is avalable via headless service: "{{ include "deploy.names.master" . }}"
{{- end }}

{{- if or .Values.postgresql.install .Values.external.db.enabled }}
## To get the password for main database, run:
kubectl get secret --namespace  {{ .Release.Namespace }} {{ include "common.names.fullname" . }} -o jsonpath="{.data.mainDatabasePassword}" | base64 --decode; echo
## To get the password for report database, run:
kubectl get secret --namespace  {{ .Release.Namespace }} {{ include "common.names.fullname" . }} -o jsonpath="{.data.reportDatabasePassword}" | base64 --decode; echo
{{- end }}

{{- if or .Values.rabbitmq.install .Values.external.mq.enabled }}
## To get the password for rabbitMQ, run:
kubectl get secret --namespace  {{ .Release.Namespace }} {{ include "common.names.fullname" . }} -o jsonpath="{.data.rabbitmqPassword}" | base64 --decode; echo
{{- end }}
