Skip to content

feat(hosts): 支持配置主机 PIDs 限制#4

Open
stelin wants to merge 2 commits into
ZaneL1u:mainfrom
stelin:main
Open

feat(hosts): 支持配置主机 PIDs 限制#4
stelin wants to merge 2 commits into
ZaneL1u:mainfrom
stelin:main

Conversation

@stelin
Copy link
Copy Markdown

@stelin stelin commented Jun 2, 2026

  • 为主机资源配置新增 pids_limit 字段,并贯通控制面、 agent 契约、运行时与数据存储
  • 在创建和更新主机时补充资源参数校验,避免写入非法 的内存、CPU 与 PIDs 配置
  • 更新管理后台主机表单与相关测试,确保资源限制配置与 展示行为一致

Closes #3

- 为主机资源配置新增 pids_limit 字段,并贯通控制面、
  agent 契约、运行时与数据存储
- 在创建和更新主机时补充资源参数校验,避免写入非法
  的内存、CPU 与 PIDs 配置
- 更新管理后台主机表单与相关测试,确保资源限制配置与
  展示行为一致
@stelin
Copy link
Copy Markdown
Author

stelin commented Jun 2, 2026

@ZaneL1u 新增导入导出白名单,新增新建主机支持设置pids_limit

Copy link
Copy Markdown
Owner

@ZaneL1u ZaneL1u left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感谢提交,这个功能方向很好,pids_limit 补上后主机资源配置会完整很多。

我这边整体看下来,后端主链路和测试都已经比较扎实了,只留一个很小的建议:运行中的主机会即时 docker update,但停止状态的已有容器目前只更新数据库。Docker 的 update 其实也支持 stopped container,所以这里补一笔后,创建、运行中修改、停止后修改三条路径的语义就更一致了。

这个改动很小,但能避免 DB/UI 和实际容器配置出现漂移。辛苦看下这个 suggestion,应用后我这边就倾向合并。

Comment thread internal/controlplane/http/admin_hosts.go Outdated
}
}

func TestPatchResources_RunningHostAppliesDockerUpdateAndPersistsPidsLimit(t *testing.T) {
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个测试已经覆盖了 running 的关键路径,很好。上面的小改动应用后,如果愿意,可以顺手把这个 case 扩成 running/stopped 两个状态的表驱动测试,这样语义会更稳。这个不大,主要是给后续维护留个保护。

good

Co-authored-by: Zane <hi@zaneliu.me>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

容器启动进程限制太小

2 participants