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

Did you know there are enterprise versions of the Bitnami catalog? For enhanced secure software supply chain features, unlimited pulls from Docker, LTS support, or application customization, see Bitnami Premium or Tanzu Application Catalog. See https://www.arrow.com/globalecs/na/vendors/bitnami for more information.

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

{{- if .Values.ingress.enabled }}

1. Get the Odoo URL indicated on the Ingress Rule and associate it to your cluster external IP:

   export CLUSTER_IP=$(minikube ip) # On Minikube. Use: `kubectl cluster-info` on others K8s clusters
   export HOSTNAME=$(kubectl get ingress --namespace {{ .Release.Namespace }} {{ template "common.names.fullname" . }} -o jsonpath='{.spec.rules[0].host}')
   echo "Odoo URL: http://$HOSTNAME/"
   echo "$CLUSTER_IP  $HOSTNAME" | sudo tee -a /etc/hosts

{{- else }}

1. Get the Odoo URL by running:

{{- $odooPort := coalesce .Values.service.ports.http .Values.service.port | toString }}
{{- if eq .Values.service.type "NodePort" }}

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

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

** Please ensure an external IP is associated to the {{ template "common.names.fullname" . }} service before proceeding **
** Watch the status using: kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "common.names.fullname" . }} **

  export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "common.names.fullname" . }} --template "{{ "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}" }}")
  echo "Odoo URL: http://$SERVICE_IP{{- if ne $odooPort "80" }}:{{ $odooPort }}{{ end }}/"

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

  echo "Odoo URL: http://127.0.0.1:8080/"
  kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ template "common.names.fullname" . }} 8080:{{ $odooPort }}

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

2. Obtain the login credentials

  export ODOO_EMAIL={{ .Values.odooEmail }}
  {{ include "common.utils.secret.getvalue" (dict "secret" (include "odoo.secretName" .) "field" "odoo-password" "context" $) }}

  echo Email   : $ODOO_EMAIL
  echo Password: $ODOO_PASSWORD

{{- include "common.warnings.rollingTag" .Values.image }}
{{- include "common.warnings.resources" (dict "sections" (list "" "volumePermissions") "context" $) }}
{{- include "common.warnings.modifiedImages" (dict "images" (list .Values.image) "context" $) }}
{{- include "common.errors.insecureImages" (dict "images" (list .Values.image) "context" $) }}
