Merge pull request #9552 from glours/fix-deploy-cpus-issue

Fix deploy cpus issue and support pids limit
This commit is contained in:
Guillaume Lours 2022-06-14 11:41:35 +02:00 committed by GitHub
commit 57975094cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -595,8 +595,12 @@ func setLimits(limits *types.Resource, resources *container.Resources) {
resources.Memory = int64(limits.MemoryBytes)
}
if limits.NanoCPUs != "" {
i, _ := strconv.ParseInt(limits.NanoCPUs, 10, 64)
resources.NanoCPUs = i
if f, err := strconv.ParseFloat(limits.NanoCPUs, 64); err == nil {
resources.NanoCPUs = int64(f * 1e9)
}
}
if limits.PIds > 0 {
resources.PidsLimit = &limits.PIds
}
}