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

@@ -78,6 +78,9 @@ const collectors = {
cluster: 'Target Cluster',
clusterPlaceholder: 'Select a cluster',
namespace: 'Namespace',
namespaceHintSidecar: 'The namespace where the TARGET Deployment lives. The platform finds that Deployment there and injects a Fluent Bit sidecar; collected logs also carry this namespace label. It is NOT a log filter.',
namespaceHintDaemonset: 'The namespace where the Promtail DaemonSet is deployed. The DaemonSet collects container logs from ALL namespaces in the cluster — it does not filter by namespace (usually just the Loki namespace, e.g. log).',
namespaceHintHost: 'Not used in host mode.',
nsPickCluster: 'Select a cluster first',
nsLoading: 'Loading namespaces…',
nsPick: 'Select a namespace',
@@ -82,6 +82,9 @@ const collectors = {
cluster: '目标集群',
clusterPlaceholder: '选择集群',
namespace: '命名空间',
namespaceHintSidecar: '填「目标应用(Deployment)所在的命名空间」。平台会在该命名空间里找到目标 Deployment 并注入 Fluent Bit sidecar,采集到的日志也会打上这个 namespace 标签。它不是日志过滤条件。',
namespaceHintDaemonset: '填「Promtail DaemonSet 部署到哪个命名空间」。DaemonSet 会采集整个集群所有命名空间的容器日志,不按命名空间过滤(一般就用 Loki 所在的 log)。',
namespaceHintHost: '主机模式不使用该字段。',
nsPickCluster: '先选择集群',
nsLoading: '加载命名空间…',
nsPick: '选择命名空间',
@@ -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')}