diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2022-09-10 17:40:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-10 17:40:01 +0200 |
commit | b9cbc0c09a68be7bb55048a494753c77c08bfbd3 (patch) | |
tree | 56d170865163d8cb177ea9144c7859f2b0c047eb /pkg/specgen/generate | |
parent | 2d8417d86a7edf11bce5527f311bb951a651d40e (diff) | |
parent | b8108d06b431018b4022879a2504a44ee95e6911 (diff) | |
download | podman-b9cbc0c09a68be7bb55048a494753c77c08bfbd3.tar.gz podman-b9cbc0c09a68be7bb55048a494753c77c08bfbd3.tar.bz2 podman-b9cbc0c09a68be7bb55048a494753c77c08bfbd3.zip |
Merge pull request #15728 from tyler92/fix-cpu-millis-limit
Fix CPU usage limitation in play kube for non integer values
Diffstat (limited to 'pkg/specgen/generate')
-rw-r--r-- | pkg/specgen/generate/kube/kube.go | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/pkg/specgen/generate/kube/kube.go b/pkg/specgen/generate/kube/kube.go index 9fd0adecf..7d85fd2f3 100644 --- a/pkg/specgen/generate/kube/kube.go +++ b/pkg/specgen/generate/kube/kube.go @@ -207,12 +207,9 @@ func ToSpecGen(ctx context.Context, opts *CtrSpecGenOptions) (*specgen.SpecGener s.SeccompProfilePath = opts.SeccompPaths.FindForContainer(opts.Container.Name) s.ResourceLimits = &spec.LinuxResources{} - milliCPU, err := quantityToInt64(opts.Container.Resources.Limits.Cpu()) - if err != nil { - return nil, fmt.Errorf("failed to set CPU quota: %w", err) - } + milliCPU := opts.Container.Resources.Limits.Cpu().MilliValue() if milliCPU > 0 { - period, quota := util.CoresToPeriodAndQuota(float64(milliCPU)) + period, quota := util.CoresToPeriodAndQuota(float64(milliCPU) / 1000) s.ResourceLimits.CPU = &spec.LinuxCPU{ Quota: "a, Period: &period, |