
** Please be patient while the chart is being deployed **

Thanos chart was deployed enabling the following components:

{{- if .Values.querier.enabled }}
- Thanos Querier
{{- end }}
{{- if .Values.bucketweb.enabled }}
- Thanos Bucket Web
{{- end }}
{{- if .Values.compactor.enabled }}
- Thanos Compactor
{{- end }}
{{- if .Values.ruler.enabled }}
- Thanos Ruler
{{- end }}
{{- if .Values.storegateway.enabled }}
- Thanos Store Gateway
{{- end }}

{{- if .Values.querier.enabled }}

Thanos Querier can be accessed through following DNS name from within your cluster:

    {{ include "thanos.fullname" . }}-querier.{{ .Release.Namespace }}.svc.{{ .Values.clusterDomain }} (port {{ .Values.querier.service.http.port }})

To access Thanos Querier from outside the cluster execute the following commands:

{{- if .Values.querier.ingress.enabled }}

1. Get the Thanos Querier URL and associate Thanos Querier hostname to your cluster external IP:

   export CLUSTER_IP=$(minikube ip) # On Minikube. Use: `kubectl cluster-info` on others K8s clusters
   echo "Thanos Querier URL: http{{ if .Values.querier.ingress.tls }}s{{ end }}://{{ .Values.querier.ingress.hostname }}/"
   echo "$CLUSTER_IP  {{ .Values.querier.ingress.hostname }}" | sudo tee -a /etc/hosts

{{- else }}

1. Get the Thanos Querier URL by running these commands:

{{- if contains "NodePort" .Values.querier.service.type }}

    export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "thanos.fullname" . }}-querier)
    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.querier.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 --namespace {{ .Release.Namespace }} svc -w {{ include "thanos.fullname" . }}-querier'

    export SERVICE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].port}" services {{ include "thanos.fullname" . }}-querier)
    export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "thanos.fullname" . }}-querier -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
    echo "http://${SERVICE_IP}:${SERVICE_PORT}"

{{- else if contains "ClusterIP" .Values.querier.service.type }}

    export SERVICE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].port}" services {{ include "thanos.fullname" . }}-querier)
    kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ include "thanos.fullname" . }}-querier ${SERVICE_PORT}:${SERVICE_PORT} &
    echo "http://127.0.0.1:${SERVICE_PORT}"

{{- end }}
{{- end }}

2. Open a browser and access Thanos Querier using the obtained URL.

{{- else }}

WARNING: You deployed Thanos whitout enabling Thanos Querier!!

{{- end }}

{{- include "thanos.validateValues" . }}
{{- include "thanos.checkRollingTags" . }}
