--bug=161152015 【CMDB-v3.14.x】batch_create_kube_pod 接口无法写入 Container requests/limits 资源配额 - #8684
Open
yuyudeqiu wants to merge 4 commits into
Open
Conversation
yuyudeqiu
marked this pull request as ready for review
July 27, 2026 12:06
Contributor
Author
|
补充说明一下当前实现的边界:本次没有完整搬入 Kubernetes resource.Quantity 的解析逻辑。当前 JSON/BSON 反序列化仅将输入字符串保存到缓存字段 s,不会填充数值字段 i/d,也不会校验输入是否符合 Kubernetes Quantity 格式;null 场景直接返回。相关限制已在代码注释中明确。 Kubernetes 的完整实现还涉及字符串拆解、suffix/单位识别、精度与大数处理、溢出和取整,以及 canonicalization。以项目当前使用的 K8s v0.24.2 为参考,相关核心实现分布在 quantity.go、suffix.go、amount.go、math.go 和 scale_int.go,直接完整移植会显著扩大本次修复范围。因此本 PR 先满足 Container requests/limits 字符串资源配额的 JSON/BSON 写入和读取需求;如果后续需要 Quantity 的格式校验、数值计算或规范化输出,再单独评估直接复用 k8s.io/apimachinery/pkg/api/resource.Quantity 或进行完整重构。 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
新加的功能:
优化的功能:
修复的问题:
"cpu":"500m")的问题。Quantity类型缺少标准 JSON 编解码,现仅将 Container 的limits和requests改为字符串资源映射,保留原有 JSON/BSON tag,不影响其他 Kubernetes 类型使用的ResourceList。