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

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

{{- if .Values.clair.enabled }}

Clair scanner was deployed. Follow these steps to add it as an additional interrogation service for Harbor:
https://goharbor.io/docs/latest/administration/vulnerability-scanning/pluggable-scanners

  Endpoint: {{ include "harbor.clairAdapter.url" . | quote }}
  Authorization: "None"
  Options: "Use internal registry address"

{{- end }}

{{ include "harbor.validateValues" . }}
{{ include "harbor.checkRollingTags" . }}
