
1. To wait until the deployment is complete run:

   kubectl rollout status deployments {{ .Release.Name }} -n {{ .Release.Namespace }}

2. To check the status of the deployment without waiting, run the following command and confirm the `mockserver` has the `Running` status:

   kubectl get po -l release={{ .Release.Name }} -n {{ .Release.Namespace }}

3. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
   {{- range .Values.ingress.hosts }}
       http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }}
   {{- end }}
{{- else if contains "NodePort" .Values.service.type }}

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

   OR

   kubectl -n {{ .Release.Namespace }} port-forward svc/mockserver 1080:1080 &
   export MOCKSERVER_HOST=127.0.0.1:1080
   echo http://$MOCKSERVER_HOST
{{- else if contains "LoadBalancer" .Values.service.type }}

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

   OR

   kubectl -n {{ .Release.Namespace }} port-forward svc/mockserver 1080:1080 &
   export MOCKSERVER_HOST=127.0.0.1:1080
   echo http://$MOCKSERVER_HOST
{{- else if contains "ClusterIP" .Values.service.type }}

   export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "release.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
   kubectl port-forward $POD_NAME {{ .Values.service.port }}:{{ .Values.service.port }} -n {{ .Release.Namespace }} &
   sleep 1 && export MOCKSERVER_HOST=127.0.0.1:{{ .Values.service.port }}
   echo http://$MOCKSERVER_HOST

   OR

   kubectl -n {{ .Release.Namespace }} port-forward svc/mockserver 1080:1080 &
   export MOCKSERVER_HOST=127.0.0.1:1080
   echo http://$MOCKSERVER_HOST
{{- end }}
{{- if .Values.app.persistence.enabled }}

4. Persistence is enabled. Expectations will be persisted to {{ .Values.app.persistence.mountPath }}/persistedExpectations.json
   {{- if .Values.app.persistence.existingClaimName }}
   Using existing PVC: {{ .Values.app.persistence.existingClaimName }}
   {{- else }}
   A PersistentVolumeClaim named "{{ template "release.name" . }}" has been created.
   {{- end }}

   NOTE: The chart automatically sets MOCKSERVER_PERSIST_EXPECTATIONS,
   MOCKSERVER_PERSISTED_EXPECTATIONS_PATH, and MOCKSERVER_INITIALIZATION_JSON_PATH.
   Any matching property in your mockserver.properties file takes precedence.
{{- end }}
