From 87909ed403e4f172fbba78f2dceeda1ac291e148 Mon Sep 17 00:00:00 2001 From: opsx Date: Fri, 30 Oct 2026 15:53:08 +0000 Subject: [PATCH] =?UTF-8?q?docs(collectors):=20=E9=87=87=E9=9B=86=E7=AD=96?= =?UTF-8?q?=E7=95=A5=E5=BC=B9=E6=A1=86=E3=80=8C=E5=91=BD=E5=90=8D=E7=A9=BA?= =?UTF-8?q?=E9=97=B4=E3=80=8D=E8=A1=A5=E5=88=86=E7=B1=BB=E5=9E=8B=E8=AF=B4?= =?UTF-8?q?=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 用户困惑:这个字段到底是"只采集指定命名空间"还是"组件要部署的命名空间"? 查代码后确认——**同一个字段在三种采集类型下含义完全不同**: 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)。 --- frontend/src/i18n/locales/en/collectors.ts | 3 +++ frontend/src/i18n/locales/zh/collectors.ts | 3 +++ .../pages/collectors/components/CollectorFormDialog.tsx | 9 +++++++++ 3 files changed, 15 insertions(+) diff --git a/frontend/src/i18n/locales/en/collectors.ts b/frontend/src/i18n/locales/en/collectors.ts index d7b88f7..d4b6a32 100644 --- a/frontend/src/i18n/locales/en/collectors.ts +++ b/frontend/src/i18n/locales/en/collectors.ts @@ -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', diff --git a/frontend/src/i18n/locales/zh/collectors.ts b/frontend/src/i18n/locales/zh/collectors.ts index 28592aa..83b740b 100644 --- a/frontend/src/i18n/locales/zh/collectors.ts +++ b/frontend/src/i18n/locales/zh/collectors.ts @@ -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: '选择命名空间', diff --git a/frontend/src/pages/collectors/components/CollectorFormDialog.tsx b/frontend/src/pages/collectors/components/CollectorFormDialog.tsx index 3342b93..aa39460 100644 --- a/frontend/src/pages/collectors/components/CollectorFormDialog.tsx +++ b/frontend/src/pages/collectors/components/CollectorFormDialog.tsx @@ -389,6 +389,15 @@ export const CollectorFormDialog = memo(function CollectorFormDialog({ )} + {/* 这个字段在不同采集类型下含义完全不同,必须写清楚, + 否则用户会以为它是"日志过滤条件"。 */} +

+ {isSidecarType + ? t('form.namespaceHintSidecar') + : collectorType === 'k8s-daemonset' + ? t('form.namespaceHintDaemonset') + : t('form.namespaceHintHost')} +

{isSidecarType &&