docs(collectors): 采集策略弹框「命名空间」补分类型说明
CI / Backend (go vet + test) (push) Canceled after 0s
CI / Frontend (lint + build + test) (push) Canceled after 0s

用户困惑:这个字段到底是"只采集指定命名空间"还是"组件要部署的命名空间"?
查代码后确认——**同一个字段在三种采集类型下含义完全不同**:

  k8s-fluentbit-sidecar:
      = 目标应用 Deployment 所在的命名空间。
        平台会 Deployments(ns).Get(target) 然后 patch 注入 fluent-bit sidecar,
        同时把它作为日志的 namespace 标签。
        **不是**日志过滤条件。

  k8s-daemonset:
      = Promtail DaemonSet 部署到哪个命名空间。
        DaemonSet 挂载 /var/log/pods,采集**整个集群所有命名空间**的容器日志,
        不按命名空间做过滤。一般就填 Loki 所在的 log。

  host-promtail:不使用该字段。

原来这三种情况共用一句"命名空间",用户只能猜。
现在字段下方按类型显示对应说明(min-h-4 固定高度,不抖动)。

实测:三条提示文案均已进包(6fe430f59eef)。
This commit is contained in:
opsx committed 2026-10-30 15:53:08 +00:00
1 parent a14bdb5e07
commit 87909ed403
3 files changed
+15

No files matched your search

@@ -389,6 +389,15 @@ export const CollectorFormDialog = memo(function CollectorFormDialog({
)}
</FormControl>
<FormMessage />
{/* 这个字段在不同采集类型下含义完全不同,必须写清楚,
否则用户会以为它是"日志过滤条件"。 */}
<p className="mt-1 min-h-4 text-xs text-muted-foreground">
{isSidecarType
? t('form.namespaceHintSidecar')
: collectorType === 'k8s-daemonset'
? t('form.namespaceHintDaemonset')
: t('form.namespaceHintHost')}
</p>
{isSidecarType && <div className="flex items-center gap-2 text-xs">
<Button type="button" variant="link" size="sm" className="h-auto p-0" onClick={() => setManualNamespace((value) => !value)}>
{manualNamespace ? t('form.pickFromCluster') : t('form.manualInput')}