summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2020-10-05 12:15:04 +0200
committerGitHub <noreply@github.com>2020-10-05 12:15:04 +0200
commit436dda23852a367807d86e98b7a59f09a82c1802 (patch)
tree8e177f67269228aeba64e61a60f9b252f81a3038 /libpod
parenta9d572f40f006a69b9d0634afea142d37c071474 (diff)
parent62607e7f27458a9ecacb6ffc4b4a7f777f94a0bc (diff)
downloadpodman-436dda23852a367807d86e98b7a59f09a82c1802.tar.gz
podman-436dda23852a367807d86e98b7a59f09a82c1802.tar.bz2
podman-436dda23852a367807d86e98b7a59f09a82c1802.zip
Merge pull request #7913 from andylibrian/kube-generate-support-resource-limits-7855
Add support for resource memory limit to generate kube
Diffstat (limited to 'libpod')
-rw-r--r--libpod/kube.go16
1 files changed, 14 insertions, 2 deletions
diff --git a/libpod/kube.go b/libpod/kube.go
index f83e99d82..6df79e394 100644
--- a/libpod/kube.go
+++ b/libpod/kube.go
@@ -303,12 +303,24 @@ func containerToV1Container(c *Container) (v1.Container, []v1.Volume, error) {
// This should not be applicable
//container.EnvFromSource =
kubeContainer.Env = envVariables
- // TODO enable resources when we can support naming conventions
- //container.Resources
kubeContainer.SecurityContext = kubeSec
kubeContainer.StdinOnce = false
kubeContainer.TTY = c.config.Spec.Process.Terminal
+ // TODO add CPU limit support.
+ if c.config.Spec.Linux != nil &&
+ c.config.Spec.Linux.Resources != nil &&
+ c.config.Spec.Linux.Resources.Memory != nil &&
+ c.config.Spec.Linux.Resources.Memory.Limit != nil {
+ if kubeContainer.Resources.Limits == nil {
+ kubeContainer.Resources.Limits = v1.ResourceList{}
+ }
+
+ qty := kubeContainer.Resources.Limits.Memory()
+ qty.Set(*c.config.Spec.Linux.Resources.Memory.Limit)
+ kubeContainer.Resources.Limits[v1.ResourceMemory] = *qty
+ }
+
return kubeContainer, kubeVolumes, nil
}