{{- if .Values.printNotes }}
{{- if .Values.server.enabled }}
{{- $ctx := dict "helm" . "appKey" "server" "style" "plain" }}
{{- $fullname := include "vm.plain.fullname" $ctx }}
{{- $ns := include "vm.namespace" $ctx }}
{{- $url := include "vm.url" $ctx }}
The VictoriaTraces write api can be accessed via port {{ .Values.server.service.servicePort }} on the following DNS name from within your cluster:
    {{- range $id := until (int .Values.server.replicaCount) }}
    {{- $_ := set $ctx "appIdx" $id }}
    {{ include "vm.fqdn" $ctx }}
    {{- end }}

Traces Ingestion:
  Get the VictoriaTraces service URL by running these commands in the same shell:

{{- if contains "NodePort" .Values.server.service.type }}
    export NODE_PORT=$(kubectl get --namespace {{ $ns }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ $fullname }})
    export NODE_IP=$(kubectl get nodes --namespace {{ $ns }} -o jsonpath="{.items[0].status.addresses[0].address}")
    echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.server.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 --namespace {{ $ns }} -w {{ $fullname }}'

    export SERVICE_IP=$(kubectl get svc --namespace {{ $ns }} {{ $fullname }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
    echo http://$SERVICE_IP:{{ .Values.server.service.servicePort }}
{{- else if contains "ClusterIP"  .Values.server.service.type }}
    export POD_NAME=$(kubectl get pods --namespace {{ $ns }} -l "app={{ include "vm.app.name" $ctx }}" -o jsonpath="{.items[0].metadata.name}")
    kubectl --namespace {{ $ns }} port-forward $POD_NAME {{ .Values.server.service.servicePort }}
{{- end }}

  Write URL inside the kubernetes cluster:
    {{ $url }}<protocol-specific-write-endpoint>

  All supported write endpoints can be found at https://docs.victoriametrics.com/victoriatraces/data-ingestion/

Read Data:
  The following URL can be used to query data:
    {{ $url }}
{{- end }}
{{- end }}
