Zoekt chart

  • Tier: 专业版, 旗舰版
  • Offering: JihuLab.com, 私有化部署
  • Status: Beta
History
    • 引入于极极狐GitLab 15.9,作为 beta功能,使用名为 index_code_with_zoektsearch_code_with_zoekt 功能标志。默认禁用。
    • 在极狐GitLab 16.6 中,在 JihuLab.com 上启用。
    • 功能标志 index_code_with_zoektsearch_code_with_zoekt 在极狐GitLab 17.1 中被移除。
此功能处于 [beta](https://gitlab.cn/docs/jh/policy/development_stages_support/#beta),会在不通知的情况下进行变更。

Zoekt chart 提供了对精确代码搜索的支持。你可以通过将 gitlab-zoekt.install 设置为 true 来安装该 chart。

启用 Zoekt chart#

要启用 Zoekt chart,请设置以下值:

shell
--set gitlab-zoekt.install=true \ --set gitlab-zoekt.replicas=2 \ # Zoekt pod 的数量。如果你只想使用一个 pod,可以跳过此设置。 --set gitlab-zoekt.indexStorage=128Gi # Zoekt 节点的磁盘大小。Zoekt 需要最多为代码库默认分支存储大小的三倍,具体取决于大型和二进制文件的数量。

设置 CPU 和内存使用#

你可以通过修改以下 JihuLab.com 默认设置来定义 Zoekt chart 的请求和限制:

yaml
1 webserver: 2 resources: 3 requests: 4 cpu: 4 5 memory: 32Gi 6 limits: 7 cpu: 16 8 memory: 128Gi 9 indexer: 10 resources: 11 requests: 12 cpu: 4 13 memory: 6Gi 14 limits: 15 cpu: 16 16 memory: 12Gi 17 gateway: 18 resources: 19 requests: 20 cpu: 2 21 memory: 512Mi 22 limits: 23 cpu: 4 24 memory: 1Gi

在极狐GitLab中配置 Zoekt#

History
    • 在极狐GitLab 16.6 中分片重命名为节点。

要在极狐GitLab中为顶层群组配置 Zoekt:

  1. 连接到 toolbox pod 的 Rails 控制台:

    shell
    kubectl exec <toolbox pod name> -it -c toolbox -- gitlab-rails console -e production
  2. 启用精确代码搜索

  3. 设置索引:

shell
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) node.indices.create!(zoekt_enabled_namespace_id: enabled_namespace.id, namespace_id: namespace.id, zoekt_replica_id: replica.id)
shell
1 node = ::Search::Zoekt::Node.online.last 2 namespace = Namespace.find_by_full_path('<top-level-group-to-index>') 3 enabled_namespace = Search::Zoekt::EnabledNamespace.find_or_create_by(namespace: namespace) 4 replica = enabled_namespace.replicas.find_or_create_by(namespace_id: enabled_namespace.root_namespace_id) 5 replica.ready! 6 node.indices.create!(zoekt_enabled_namespace_id: enabled_namespace.id, namespace_id: namespace.id, zoekt_replica_id: replica.id, state: :ready)

Zoekt 可以在任何项目更新或创建后开始为该群组中的项目建立索引。对于初始索引,请等待至少几分钟,以便 Zoekt 开始为命名空间建立索引。