Getting started:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
  {{- range .paths }}
  http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
  {{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}

  export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "agentstack.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.service.type }}

     NOTE: It may take a few minutes for the LoadBalancer IP to be available.
           You can watch its status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w agentstack-server-svc'
  export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} --agentstack-server-svc --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
  echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}

  # port-forward the API
  kubectl port-forward svc/agentstack-server-svc 8333:{{.Values.service.port}} &

  {{- if .Values.ui.enabled }}
  # port-forward the UI
  kubectl port-forward svc/agentstack-ui-svc 8334:{{.Values.ui.service.port}} &
  {{- end }}

  {{- if .Values.auth.enabled }}
  # port-forward the Keycloak UI
  kubectl port-forward svc/keycloak 8336:{{ .Values.keycloak.service.port }} &
  echo "Keycloak UI available at http://localhost:8336"
  {{- end }}

{{- end }}

{{- if .Values.auth.enabled }}

{{- if or (hasPrefix "http://keycloak" .Values.auth.keycloakIssuerUrl) (hasPrefix "http://localhost" .Values.auth.nextauthUrl) (hasPrefix "http://localhost" .Values.auth.apiUrl) }}

⚠️ IMPORTANT!
  It is important to expose the following endpoints publicly and configure the values:
  values:
    auth:
      keycloakIssuerUrl: "https://keycloak.myapp.com/realms/agentstack"
      nextauthUrl: "https://myapp.com"
      apiUrl: "https://api.myapp.com"

  Use
  - ingress: https://kubernetes.io/docs/concepts/services-networking/ingress
  - gateway API: https://kubernetes.io/docs/concepts/services-networking/gateway
  - openshift routes: https://docs.redhat.com/en/documentation/openshift_container_platform/4.20/html/ingress_and_load_balancing/routes
  - or other tools to expose the services.

  Failure to configure these endpints with proper https may leave your application vulnerable.
  See more details in the deployment guide: https://agentstack.beeai.dev/stable/deploy-agent-stack/deployment-guide
{{- end}}

# Get Keycloak admin credentials:
  Username: {{ .Values.keycloak.auth.adminUser }}
  Password:
    kubectl get secret --namespace {{ .Release.Namespace }} keycloak-secret -o jsonpath="{.data.admin-password}" | base64 -d

# Setup users
  Open keycloak UI: {{ if hasPrefix "http://keycloak" .Values.auth.keycloakIssuerUrl }}"http://localhost:8336"{{ else }}{{ .Values.auth.keycloakIssuerUrl | quote }}{{ end }}

  1. Go to "Manage realms" -> "agentstack", create users under "Users" menu
  2. Assign "agentstack-admin" role to your admin user
  (optionally use .Values.keycloak.auth.seedAgentstackUsers to automate this)

# Login to agentstack server using CLI
  agentstack server login {{ .Values.auth.apiUrl }}
{{- end}}

# Setup models
  agentstack model setup

{{- if .Values.ui.enabled }}

# Open the UI in the browser
  agentstack ui
{{- end }}

📄 See the documentation for more details and troubleshooting steps: https://agentstack.beeai.dev/how-to/deployment-guide

Resources:

    📚 Documentation: https://agentstack.beeai.dev
    💬 Discord Community: https://discord.gg/NradeA6ZNF
    📝 GitHub Issues: https://github.com/i-am-bee/agentstack/issues

Upgrade platform:

    helm upgrade {{ .Release.Name }} oci://ghcr.io/i-am-bee/agentstack/chart/agentstack:<version>

{{- if .Values.phoenix.enabled }}

Important License Notice:

    When you enable Phoenix, be aware that Arize Phoenix is licensed under the Elastic License v2 (ELv2), which has
    specific terms regarding commercial use and distribution. By enabling Phoenix, you acknowledge that you are
    responsible for ensuring compliance with the ELv2 license terms for your specific use case. Please review the
    Phoenix license (https://github.com/Arize-ai/phoenix/blob/main/LICENSE) before enabling this feature in
    production environments.
{{- end }}
