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 **

1. Get the Harbor URL:

{{- if eq .Values.exposureType "ingress" }}

  You should be able to access your new Harbor installation through {{ include "harbor.externalUrl" . }}

{{- else if and (eq .Values.exposureType "proxy") (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 --namespace {{ .Release.Namespace }} -w {{ include "common.names.fullname" . }}'

    {{- $port:=.Values.service.ports.http | toString }}
    export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "common.names.fullname" . }} --template "{{ "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}" }}")
    echo "Harbor URL: http://$SERVICE_IP{{- if ne $port "80" }}:{{ .Values.service.ports.http  }}{{ end }}/"

{{- else if and (eq .Values.exposureType "proxy") (eq .Values.service.type "ClusterIP") }}

  {{- if .Values.nginx.tls.enabled }}

    echo "Harbor URL: https://127.0.0.1:8443/"
    kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ include "common.names.fullname" . }} 8443:{{ .Values.service.ports.https }}

  {{- else }}

    echo "Harbor URL: http://127.0.0.1:8080/"
    kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ include "common.names.fullname" . }} 8080:{{ .Values.service.ports.http }}

  {{- end }}

{{- else if and (eq .Values.exposureType "proxy") (eq .Values.service.type "NodePort") }}

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

{{- end }}

2. Login with the following credentials to see your Harbor application

  echo Username: "admin"
  echo Password: $(kubectl get secret --namespace {{ .Release.Namespace }} {{ printf "%s-envvars" (include "harbor.core" .) }} -o jsonpath="{.data.HARBOR_ADMIN_PASSWORD}" | base64 -d)

{{ include "harbor.validateValues" . }}
{{ include "harbor.checkRollingTags" . }}
{{- include "common.warnings.resources" (dict "sections" (list "core" "exporter" "jobservice" "nginx" "portal" "registry.controller" "registry.server" "trivy" "volumePermissions") "context" $) }}
{{- include "common.warnings.modifiedImages" (dict "images" (list .Values.volumePermissions.image .Values.nginx.image .Values.portal.image .Values.core.image .Values.jobservice.image .Values.registry.server.image .Values.registry.controller.image .Values.trivy.image .Values.exporter.image) "context" $) }}
{{- include "common.errors.insecureImages" (dict "images" (list .Values.volumePermissions.image .Values.nginx.image .Values.portal.image .Values.core.image .Values.jobservice.image .Values.registry.server.image .Values.registry.controller.image .Values.trivy.image .Values.exporter.image) "context" $) }}
