Zoekt chart
- Tier: Premium, Ultimate
- Offering: GitLab.com, GitLab Self-Managed
- Status: Limited availability
This feature is in limited availability. For more information, see epic 9404. Provide feedback in issue 420920.
Zoekt chart with a Linux package instance
Use the Zoekt chart to connect Zoekt to a Linux package instance.
Prerequisites:
- A dedicated Zoekt cluster based on current sizing recommendations.
To use the Zoekt chart with a Linux package instance:
Create a namespace called
zoekt:kubectl create namespace zoektClone the
gitlab-zoektchart locally and change to its directory:git clone https://gitlab.com/gitlab-org/cloud-native/charts/gitlab-zoekt.git cd gitlab-zoektEnable a load balancer. Because the Zoekt chart is a headless service, a load balancer is required.
In
values.yaml:Use the
gitlab_shellsecret from the/etc/gitlab/gitlab-secrets.jsonfile to create thekubectlsecret:kubectl create secret generic gitlab-zoekt-secret --from-literal=secret-key="<gitlab-shell-secret>" -n zoektAdd the secret:
internalApi: secretName: 'gitlab-zoekt-secret' secretKey: 'secret-key'Add the GitLab instance URL and service URL with a load balancer IP port of
:8080:internalApi: gitlabUrl: 'https://<gitlab_url>' # Internal URL to connect to GitLab serviceUrl: 'http://<loadbalancer_internal_ip>:8080' # URL to reach Zoekt service - LB internal URL
In GitLab, change the Gitaly listening interface:
gitaly['configuration'] = { listen_addr: '0.0.0.0:8075', storage: [ { name: 'default', path: '/var/opt/gitlab/git-data/repositories', }, ] } gitlab_rails['repositories_storages'] = { 'default' => { 'gitaly_address' => 'tcp://<gitlab_url>:8075' }, }Install Zoekt by using
helm:helm install gitlab-zoekt . -f values.yaml --version <latest_version> --namespace zoektConfirm the pods were created. You should have both the gateway and
gitlab-zoekt-0pods:kubectl get pods NAME READY STATUS RESTARTS AGE gitlab-zoekt-0 3/3 Running 0 13d gitlab-zoekt-gateway-b78dbc78-hzw28 1/1 Running 0 13dInstall or upgrade the GitLab Helm chart if you make further changes to
values.yaml.To index a top-level group, do one of the following:
Index a specific top-level group manually:
node = ::Search::Zoekt::Node.online.last namespace = Namespace.find_by_full_path('<top-level-group-to-index>') Search::Zoekt::EnabledNamespace.find_or_create_by(namespace: namespace)
Zoekt chart with the GitLab Helm chart
The Zoekt chart provides support for
exact code search.
You can install the chart by setting gitlab-zoekt.install to true.
For more information, see gitlab-zoekt.
Enable the Zoekt chart
To enable the Zoekt chart, set the following values:
--set gitlab-zoekt.install=true \
--set gitlab-zoekt.replicas=2 \ # Number of Zoekt pods. If you want to use only one pod, you can skip this setting.
--set gitlab-zoekt.indexStorage=128Gi # Disk size for the Zoekt node. Zoekt requires up to three times the repository's default branch's storage size, depending on the number of large and binary files.Set CPU and memory usage
You can define requests and limits for the Zoekt chart by modifying the GitLab.com default settings.
Configure Zoekt in GitLab
To configure Zoekt for a top-level group in GitLab:
Connect to the Rails console of the toolbox pod:
kubectl exec <toolbox pod name> -it -c toolbox -- gitlab-rails console -e productionTo index a top-level group, do one of the following:
Index a specific top-level group manually:
node = ::Search::Zoekt::Node.online.last namespace = Namespace.find_by_full_path('<top-level-group-to-index>') Search::Zoekt::EnabledNamespace.find_or_create_by(namespace: namespace)node = ::Search::Zoekt::Node.online.last namespace = Namespace.find_by_full_path('<top-level-group-to-index>') enabled_namespace = Search::Zoekt::EnabledNamespace.find_or_create_by(namespace: namespace) replica = enabled_namespace.replicas.find_or_create_by(namespace_id: enabled_namespace.root_namespace_id) replica.ready! node.indices.create!(zoekt_enabled_namespace_id: enabled_namespace.id, namespace_id: namespace.id, zoekt_replica_id: replica.id, state: :ready)
Zoekt can now index projects in that group after any project is updated or created. For the initial indexing, wait at least a few minutes for Zoekt to start indexing the namespace.