Congratulations. You have just deployed JFrog Artifactory!
{{- if .Values.artifactory.masterKey }}
{{- if and (not .Values.artifactory.masterKeySecretName) (eq .Values.artifactory.masterKey "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF") }}


***************************************** WARNING ******************************************
* Your Artifactory master key is still set to the provided example:                        *
* artifactory.masterKey=FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF   *
*                                                                                          *
* You should change this to your own generated key:                                        *
* $ export MASTER_KEY=$(openssl rand -hex 32)                                              *
* $ echo ${MASTER_KEY}                                                                     *
*                                                                                          *
* Pass the created master key to helm with '--set artifactory.masterKey=${MASTER_KEY}'     *
*                                                                                          *
* Alternatively, you can use a pre-existing secret with a key called master-key with       *
* '--set artifactory.masterKeySecretName=${SECRET_NAME}'                                   *
********************************************************************************************
{{- end }}
{{- end }}

{{- if .Values.artifactory.joinKey }}
{{- if eq .Values.artifactory.joinKey "EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE" }}


***************************************** WARNING ******************************************
* Your Artifactory join key is still set to the provided example:                          *
* artifactory.joinKey=EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE                                     *
*                                                                                          *
* You should change this to your own generated key:                                        *
* $ export JOIN_KEY=$(openssl rand -hex 32)                                                *
* $ echo ${JOIN_KEY}                                                                       *
*                                                                                          *
* Pass the created master key to helm with '--set artifactory.joinKey=${JOIN_KEY}'         *
*                                                                                          *
********************************************************************************************
{{- end }}
{{- end }}

{{- if and (or (or (or (or (or ( or ( or ( or (or (or ( or (or .Values.artifactory.masterKeySecretName .Values.global.masterKeySecretName) .Values.systemYamlOverride.existingSecret) (or .Values.artifactory.customCertificates.enabled .Values.global.customCertificates.enabled)) .Values.aws.licenseConfigSecretName) .Values.artifactory.persistence.customBinarystoreXmlSecret) .Values.access.customCertificatesSecretName) .Values.systemYamlOverride.existingSecret) .Values.artifactory.license.secret) .Values.artifactory.userPluginSecrets) (and .Values.artifactory.admin.secret .Values.artifactory.admin.dataKey)) (and .Values.artifactory.persistence.googleStorage.gcpServiceAccount.enabled .Values.artifactory.persistence.googleStorage.gcpServiceAccount.customSecretName)) (or .Values.artifactory.joinKeySecretName .Values.global.joinKeySecretName)) .Values.artifactory.unifiedSecretInstallation }}
****************************************** WARNING **************************************************************************************************
* The unifiedSecretInstallation flag is currently enabled, which creates the unified secret. The existing secrets will continue as separate secrets.*
* Update the values.yaml with the existing secrets to add them to the unified secret.                                                               *
*****************************************************************************************************************************************************
{{- end }}

1. Get the Artifactory URL by running these commands:

   {{- if .Values.ingress.enabled }}
   {{- range .Values.ingress.hosts }}
     http://{{ . }}
   {{- end }}

   {{- else if contains "NodePort" .Values.nginx.service.type }}
   export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "artifactory.nginx.fullname" . }})
   export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
   echo http://$NODE_IP:$NODE_PORT/

   {{- else if contains "LoadBalancer"  .Values.nginx.service.type }}

   NOTE: It may take a few minutes for the LoadBalancer IP to be available.
         You can watch the status of the service by running 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "artifactory.nginx.fullname" . }}'
   export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "artifactory.nginx.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
   echo http://$SERVICE_IP/

   {{- else if contains "ClusterIP" .Values.nginx.service.type }}
   export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "component={{ .Values.nginx.name }}" -o jsonpath="{.items[0].metadata.name}")
   echo http://127.0.0.1:{{ .Values.nginx.externalPortHttp }}
   kubectl port-forward --namespace {{ .Release.Namespace }} $POD_NAME {{ .Values.nginx.externalPortHttp }}:{{ .Values.nginx.internalPortHttp }}

   {{- end }}

2. Open Artifactory in your browser
   Default credential for Artifactory:
   user: admin
   password: password

{{ if .Values.artifactory.javaOpts.jmx.enabled }}
JMX configuration:
{{- if not (contains "LoadBalancer"  .Values.artifactory.service.type) }}
If you want to access JMX from you computer with jconsole, you should set ".Values.artifactory.service.type=LoadBalancer" !!!
{{ end }}

1. Get the Artifactory service IP:
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "artifactory.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')

2. Map the service name to the service IP in /etc/hosts:
sudo sh -c "echo \"${SERVICE_IP}    {{ template "artifactory.fullname" . }}\" >> /etc/hosts"

3. Launch jconsole:
jconsole {{ template "artifactory.fullname" . }}:{{ .Values.artifactory.javaOpts.jmx.port }}
{{- end }}
