refactor: update Swagger serving and processing method#11052
refactor: update Swagger serving and processing method#11052wanghe-fit2cloud merged 10 commits into1Panel-dev:dev-v2from
Conversation
|
Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
What this PR does / why we need it?
重构swagger逻辑,老版本的swagger file还在用老方案来存储嵌入文件,把整个 swagger 塞进了内存,导致占用过量无用的开销。
swaggergo 的 files 有 v2 版本用了 embed FS来按需加载,但是包装器gin-swagger没有适配。只好自己造轮子
Summary of your change
现在 core 启动时不会加载这些文件,如果用户不去访问 swagger 内容,就不会有这些东西加进内存,可以节约接近 20M 的内存开支。
但是更建议把 swagger 拆出来单独做一个服务而不是塞进 core, 这玩意99%的用户都用不上。
Please indicate you've done the following: