{{- $hasRepair := ne (printf "%v" (default "" .Values.database.repair.version) | trim) "" }}
{{- $cli := ternary "oc" "kubectl" .Values.openshift.enabled }}
Boundary controller chart has been {{ if .Release.IsInstall }}installed{{ else }}upgraded{{ end }} successfully.

Release:   {{ .Release.Name }}
Namespace: {{ include "boundary.namespace" . }}

Controller:
- Replicas:         {{ .Values.controller.replicas }}
- API Service:      {{ include "boundary.controller.apiServiceName" . }} (port {{ .Values.controller.service.api.port }})
- Cluster Service:  {{ include "boundary.controller.clusterServiceName" . }} (port {{ .Values.controller.service.cluster.port }})
- Ops Service:      {{ include "boundary.controller.opsServiceName" . }} (port {{ .Values.controller.service.ops.port }})
- TLS:              {{ if and .Values.tls.api.disabled .Values.tls.ops.disabled }}disabled{{ else }}enabled (cert from Secret "{{ .Values.tls.secretName }}"){{ end }}

Secret:
- Name:          {{ include "boundary.controller.secretName" . }}
- Required keys: {{ .Values.secretRefs.keys.databaseUrl }}, {{ .Values.secretRefs.keys.license }}{{- if eq (include "boundary.controller.usesEnvMigrationUrl" . | trim) "true" }}, {{ .Values.secretRefs.keys.migrationUrl }}{{- end }}{{- if .Values.bootstrapAdmin.enabled }}, {{ .Values.secretRefs.keys.adminUsername }}, {{ .Values.secretRefs.keys.adminPassword }}{{- end }}{{- if eq (include "boundary.controller.usesEnvAeadKms" . | trim) "true" }}, {{ .Values.secretRefs.keys.kmsRoot }}, {{ .Values.secretRefs.keys.kmsWorkerAuth }}, {{ .Values.secretRefs.keys.kmsRecovery }}{{- end }}

Next steps:

{{- if .Release.IsInstall }}
1. To check install-hook jobs:

   {{ $cli }} get jobs -n {{ include "boundary.namespace" . }}
{{- if .Values.database.init.enabled }}
   {{ $cli }} logs -n {{ include "boundary.namespace" . }} job/{{ include "boundary.controller.serviceName" . }}-init-db
{{- end }}
{{- if .Values.bootstrapAdmin.enabled }}
   {{ $cli }} logs -n {{ include "boundary.namespace" . }} job/{{ include "boundary.controller.serviceName" . }}-bootstrap-admin
{{- end }}
{{- else if and .Values.database.migrate.enabled $hasRepair }}
1. To check pre-upgrade repair and migration hook jobs:

   {{ $cli }} get jobs -n {{ include "boundary.namespace" . }}
   {{ $cli }} logs -n {{ include "boundary.namespace" . }} job/{{ include "boundary.controller.serviceName" . }}-database-repair
   {{ $cli }} logs -n {{ include "boundary.namespace" . }} job/{{ include "boundary.controller.serviceName" . }}-database-migration
{{- else if .Values.database.migrate.enabled }}
1. To check pre-upgrade migration hook job:

   {{ $cli }} get jobs -n {{ include "boundary.namespace" . }}
   {{ $cli }} logs -n {{ include "boundary.namespace" . }} job/{{ include "boundary.controller.serviceName" . }}-database-migration
{{- else }}
1. To verify rollout and pod status:

   {{ $cli }} rollout status deployment/{{ include "boundary.controller.serviceName" . }} -n {{ include "boundary.namespace" . }}
   {{ $cli }} get pods -n {{ include "boundary.namespace" . }} -l app.kubernetes.io/component=controller
{{- end }}

{{- if .Values.openshift.enabled }}
2. To get OpenShift Route hostnames:

   oc get routes -n {{ include "boundary.namespace" . }}
{{- if .Values.openshift.route.api.enabled }}

   API Route:     oc get route {{ include "boundary.controller.route.api.name" . }} -n {{ include "boundary.namespace" . }} -o jsonpath='{.spec.host}'
{{- end }}
{{- if .Values.openshift.route.cluster.enabled }}
   Cluster Route: oc get route {{ include "boundary.controller.route.cluster.name" . }} -n {{ include "boundary.namespace" . }} -o jsonpath='{.spec.host}'
{{- end }}
{{- if .Values.openshift.route.ops.enabled }}
   Ops Route:     oc get route {{ include "boundary.controller.route.ops.name" . }} -n {{ include "boundary.namespace" . }} -o jsonpath='{.spec.host}'
{{- end }}

3. To access the Boundary UI via the API Route:

   https://<API_ROUTE_HOST>
{{- else }}
2. To fetch external addresses on LoadBalancer Services:

   kubectl get svc {{ include "boundary.controller.apiServiceName" . }} -n {{ include "boundary.namespace" . }}
{{- if eq .Values.controller.service.cluster.type "LoadBalancer" }}

   kubectl get svc {{ include "boundary.controller.clusterServiceName" . }} -n {{ include "boundary.namespace" . }}
{{- end }}
{{- if eq .Values.controller.service.ops.type "LoadBalancer" }}

   kubectl get svc {{ include "boundary.controller.opsServiceName" . }} -n {{ include "boundary.namespace" . }}
{{- end }}

3. To access the Boundary UI using the API Service external address:

   {{ if .Values.tls.api.disabled }}http{{ else }}https{{ end }}://<EXTERNAL_ADDRESS>:{{ .Values.controller.service.api.port }}
{{- end }}

For more information, visit https://www.boundaryproject.io/
