1. Index a repo:

   $ kubectl exec {{ include "gitlab-zoekt.notesDefaultPodName" . }} -c zoekt-indexer -- curl -s -d '{"GitalyConnectionInfo":{"Address":"tcp://gitaly.host:2305","Storage":"default","Path":"@hashed/a/b/c.git"},"RepoId":7,"FileSizeLimit":2097152,"Timeout":"10m"}' 'http://127.0.0.1:{{ .Values.gateway.listen.port }}/indexer/index'

2. Search:

   $ kubectl exec {{ include "gitlab-zoekt.notesDefaultPodName" . }} -c zoekt-indexer -- curl -s -d '{"Q":"gitlab-zoekt-indexer-update"}' 'http://127.0.0.1:{{ .Values.gateway.listen.port }}/api/search'

3. Search with gateway service URL:

   $ kubectl exec {{ include "gitlab-zoekt.notesDefaultPodName" . }} -c zoekt-indexer -- curl -s -d '{"Q":"gitlab-zoekt-indexer-update"}' 'http://gitlab-zoekt-gateway:{{ .Values.gateway.listen.port }}/api/search'

4. Index with gateway service URL:

   $ kubectl exec {{ include "gitlab-zoekt.notesDefaultPodName" . }} -c zoekt-indexer -- curl -s -d '{"GitalyConnectionInfo":{"Address":"tcp://gitaly.host:2305","Storage":"default","Path":"@hashed/a/b/c.git"},"RepoId":7,"FileSizeLimit":2097152,"Timeout":"10m"}' 'http://gitlab-zoekt-gateway:{{ .Values.gateway.listen.port }}/indexer/index'

   Please note that you need a Gitaly instance to actually index a repository. The example above can be used to verify that you can the indexer even though it errors out with 'cannot find a default branch'.

5. You can also reach a specific replica through service URL:

   $ kubectl exec {{ include "gitlab-zoekt.notesDefaultPodName" . }} -c zoekt-indexer -- curl -s -d '{"Q":"gitlab-zoekt-indexer-update"}' 'http://gitlab-zoekt-gateway:{{ .Values.gateway.listen.port }}/nodes/{{ include "gitlab-zoekt.notesDefaultPodName" . }}.gitlab-zoekt.{{ .Release.Namespace }}.svc.cluster.local/api/search'

{{- if (eq .Values.service.type "LoadBalancer") }}
6. You're using LoadBalancer service. To verify that it is accessible, you can perform a search:

   $ kubectl exec {{ include "gitlab-zoekt.notesDefaultPodName" . }} -c zoekt-indexer -- curl -s -d '{"Q":"gitlab-zoekt-indexer-update"}' 'http://{{ .Values.service.loadBalancerIP }}:{{ .Values.gateway.listen.port }}/api/search'

{{- end }}
{{- if .Values.ingress.enabled }}
6. Get the IP of the ingress by running these commands:
   $ kubectl get ingress gitlab-zoekt

   NOTE: It may take a few minutes for the LoadBalancer IP to be available.
7. Then do a search via the Ingress

   $ curl -H 'Host: gitlab-zoekt.local' -d '{"Q":"gitlab-zoekt-indexer-update"}' 'http://<IP_ADDRESS>:{{ .Values.gateway.listen.port }}/api/search'
{{- end }}
