{{/*
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements.  See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/}}

************************************************************************
*                                                                      *
*                 SkyWalking Helm Chart by SkyWalking Team             *
*                                                                      *
************************************************************************

Thank you for installing {{ .Chart.Name }}.

Your release is named {{ .Release.Name }}.

Learn more, please visit https://skywalking.apache.org/

{{- if not .Values.ui.enabled }}
The web UI is disabled in this release (ui.enabled=false). No UI Deployment,
Service, ConfigMap, Ingress, or PVC was created. OAP is still reachable on
its GraphQL port (default 12800) for any external UI you point at it.
{{- else }}
Get the UI URL by running these commands:
{{- if .Values.ui.ingress.enabled }}
{{- $tls := .Values.ui.ingress.tls }}
{{- range .Values.ui.ingress.hosts }}
{{- $entry := . }}
{{- $host := first (splitList "/" $entry) }}
{{- $scheme := "http" }}
{{- range $tls }}
{{- if or (empty (.hosts | default list)) (has $host (.hosts | default list)) }}{{ $scheme = "https" }}{{ end }}
{{- end }}
  {{ $scheme }}://{{ $entry }}{{ $.Values.ui.ingress.path }}
{{- end }}
{{- else if contains "NodePort" .Values.ui.service.type }}
  export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "skywalking.ui.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.ui.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 {{ include "skywalking.ui.fullname" . }} -n {{ .Release.Namespace }}'
  export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "skywalking.ui.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
  echo http://$SERVICE_IP:{{ .Values.ui.service.externalPort }}
{{- else if contains "ClusterIP" .Values.ui.service.type }}
  echo "Visit http://127.0.0.1:8080 to use your application"
  kubectl port-forward svc/{{ include "skywalking.ui.fullname" . }} 8080:{{ .Values.ui.service.externalPort }} --namespace {{ .Release.Namespace }}
{{- end }}

NOTE on Horizon UI auth:

The web UI is Apache SkyWalking Horizon UI. There is no built-in
"admin/admin" fallback, and no login is configured by default.

The BFF does NOT fail closed: with no users it still boots, serves the login
page, and answers the readiness probe — so the pod reports Ready and nobody
can log in. Configure users before you rely on it. See the README "Web UI"
section for:

  - a copy-pastable demo snippet (publicly-known admin/admin hash)
  - the production Secret + ${VAR} interpolation pattern

Running against OAP 10.x? Set BOTH:

  --set ui.config.templates.mode=readonly
  --set oap.ports.admin=null

Horizon reads dashboard templates from OAP 11's /ui-management REST API by
default, and OAP 10 does not serve it. The admin host is an OAP 11 addition
too -- on 10.x port 17128 is the AI-pipeline URI-recognition server, so leaving
it exposed points Horizon at the wrong service.

Full horizon.yaml config reference:
  https://github.com/apache/skywalking-horizon-ui/blob/main/docs/setup/horizon-yaml.md

Horizon is configured by environment variable: the image's /app/horizon.yaml is
fully env-tokenized, and this chart mounts nothing over it unless you set
`ui.config`. Use `ui.extraEnv` and `ui.envFromSecret`.
{{- end }}

