feat(collectors): DaemonSet 不再填日志路径,改为「只采集哪些命名空间」多选
用户指出的三个问题,逐条核实后的结论:
1) 「采集日志路径」对 DaemonSet 确实是多余的 —— 确认后端模板里写死了
`replacement: /var/log/pods/*$1/*.log`(按 pod UID 精确匹配容器标准输出),
表单里填的 logPath 对 DaemonSet 完全不参与渲染。
→ 选择 DaemonSet 时隐藏该字段,提交时强制置空。
2) 「可以指定采集多个命名空间」—— 后端**早就支持**:
models.Collector.TargetNamespaces + promtailNamespaceFilter(),
空数组 = 全集群。只是**前端新建弹框没暴露**(编辑弹框里有)。
→ 新建弹框补上多选 chips(全集群 / 各命名空间可点选),并补齐前后端透传:
dto.CreateCollectorRequest.TargetNamespaces
controller → services.CreateCollectorRequest.TargetNamespaces
models.Collector.TargetNamespaces
之前前端即使传了也会被 Go 静默丢弃(无该字段)。
3) 「命名空间」字段语义已在上一提交补了分类型说明:
- DaemonSet:采集器自身部署在哪个命名空间(不影响采什么)
- Sidecar:目标应用 Deployment 所在命名空间
新增 TestDaemonsetTargetNamespacesFilter:
nil → 不生成 namespaces 白名单(全集群)
["astralx"] → 生成且包含 astralx
["astralx","default"] → 两个都在
=== 实测(d45dfa18ecc5)===
前端文案「只采集这些命名空间」「不选 = 采集整个集群…」均已进包
渲染测试 3 种输入全部符合预期
注:本次 docker push latest 遇到 Docker Hub 502,v0.1 成功而 latest 仍指向旧镜像,
导致首次滚动后 Pod 仍是旧代码;重推 latest + 强制重建 Pod 后确认
Pod digest = d45dfa18ecc5 —— 记录这个坑:push 失败必须核对三方 digest。
This commit is contained in:
1 parent
87909ed403
commit
c8d026adc7
8 files changed
+104
-5
No files matched your search
@@ -243,6 +243,8 @@ export interface CreateCollectorRequest {
|
||||
namespace?: string;
|
||||
logPath?: string;
|
||||
labels?: string;
|
||||
/** DaemonSet 模式:只采集这些命名空间的 Pod 日志;空数组/不传 = 全集群 */
|
||||
targetNamespaces?: string[];
|
||||
}
|
||||
|
||||
// Dashboard Stats
|
||||
|
||||
Reference in new issue
Block a user