summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2022-07-04 17:24:24 +0200
committerPaul Holzinger <pholzing@redhat.com>2022-07-04 17:24:24 +0200
commit3fbe93371258704e56dc741218b4faa399395f8a (patch)
treead7570ee796e2d54fee0c635f3fc1fd039bd6833 /pkg
parenta406b950e4f8cf64bdd2c1e03a8480d4b5f97226 (diff)
downloadpodman-3fbe93371258704e56dc741218b4faa399395f8a.tar.gz
podman-3fbe93371258704e56dc741218b4faa399395f8a.tar.bz2
podman-3fbe93371258704e56dc741218b4faa399395f8a.zip
envVarValueResourceFieldRef: use int64 for value
int can be 32 or 64 bit depending on the architecture. The total memory is int64 so we have to use int64 for the value as well otherwise we get an overflow on 32 bit systems. Fixes #14819 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'pkg')
-rw-r--r--pkg/specgen/generate/kube/kube.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/pkg/specgen/generate/kube/kube.go b/pkg/specgen/generate/kube/kube.go
index 689c740f0..39e15f950 100644
--- a/pkg/specgen/generate/kube/kube.go
+++ b/pkg/specgen/generate/kube/kube.go
@@ -810,8 +810,8 @@ func envVarValueResourceFieldRef(env v1.EnvVar, opts *CtrSpecGenOptions) (*strin
}
// k8s rounds up the result to the nearest integer
- intValue := int(math.Ceil(value.AsApproximateFloat64() / divisor.AsApproximateFloat64()))
- stringValue := strconv.Itoa(intValue)
+ intValue := int64(math.Ceil(value.AsApproximateFloat64() / divisor.AsApproximateFloat64()))
+ stringValue := strconv.FormatInt(intValue, 10)
return &stringValue, nil
}