Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for resource CPU limits to generate kube #7855

Closed
xordspar0 opened this issue Sep 30, 2020 · 4 comments · Fixed by #7974
Closed

Add support for resource CPU limits to generate kube #7855

xordspar0 opened this issue Sep 30, 2020 · 4 comments · Fixed by #7974
Assignees
Labels
Good First Issue This issue would be a good issue for a first time contributor to undertake. kind/feature Categorizes issue or PR as related to a new feature. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@xordspar0
Copy link
Contributor

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind feature

Description

PR #7853 adds support for resource limits to podman play kube, but podman generate kube still lacks support for generating Kubernetes configuration that retains resource limits.

Steps to reproduce the issue:

  1. Create a container that has resource limits. For example: podman container create --name test1 --memory 10Mi alpine

  2. Generate Kubernetes config for the pod: podman generate kube test1

Describe the results you received:

Currently there are no limits specified in the output.

Describe the results you expected:

The limits should be in the spec at spec.template.spec.containers[].resources.

Additional information you deem important (e.g. issue happens only occasionally):

Output of podman version:

Version:      2.2.0-dev
API Version:  2.0.0
Go Version:   go1.15.2
Git Commit:   1d7cb7f477a4d9ea10d3ec08edac3327d7802c6c
Built:        Wed Sep 30 14:47:14 2020
OS/Arch:      linux/amd64

Output of podman info --debug:

host:                                                                               
  arch: amd64                                                                       
  buildahVersion: 1.16.1                                                            
  cgroupManager: systemd                                                            
  cgroupVersion: v2                                                                 
  conmon:                                                                           
    package: Unknown                                                                
    path: /usr/bin/conmon                                                           
    version: 'conmon version 2.0.21, commit: 35a2fa83022e56e18af7e6a865ba5d7165fa2a4a'                                                                                  
  cpus: 16                                                                          
  distribution:                                                                     
    distribution: arch                                                              
    version: unknown                                                                
  eventLogger: journald                                                             
  hostname: j-desktop-arch                                                          
  idMappings:                                                                       
    gidmap:                                                                         
    - container_id: 0                                                               
      host_id: 100                                                                  
      size: 1                                                                       
    - container_id: 1 
      host_id: 100000 
      size: 65536
    uidmap:
    - container_id: 0 
      host_id: 1000
      size: 1
    - container_id: 1 
      host_id: 100000 
      size: 65536
  kernel: 5.8.12-arch1-1
  linkmode: dynamic
  memFree: 904261632
  memTotal: 15714328576
  ociRuntime:
    name: crun
    package: Unknown
    path: /usr/bin/crun
    version: |-
      crun version 0.15
      commit: 56ca95e61639510c7dbd39ff512f80f626404969
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +YAJL
  os: linux
  remoteSocket:
    path: /run/user/1000/podman/podman.sock
  rootless: true
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: Unknown
    version: |-
      slirp4netns version 1.1.4
      commit: b66ffa8e262507e37fca689822d23430f3357fe8
      libslirp: 4.3.1 
      SLIRP_CONFIG_VERSION_MAX: 3
  swapFree: 0
  swapTotal: 0
  uptime: 25h 57m 10.25s (Approximately 1.04 days)
registries:
  search:
  - docker.io
  - registry.fedoraproject.org
  - quay.io
  - registry.access.redhat.com
  - registry.centos.org
store:
  configFile: /home/jordan/.config/containers/storage.conf
  containerStore:
    number: 1
    paused: 0
    running: 0
    stopped: 1
  graphDriverName: vfs
  graphOptions: {}
  graphRoot: /home/jordan/.local/share/containers/storage
  graphStatus: {}
  imageStore:
    number: 16
  runRoot: /run/user/1000
  volumePath: /home/jordan/.local/share/containers/storage/volumes
version:
  APIVersion: 2.0.0
  Built: 1601135437
  BuiltTime: Sat Sep 26 10:50:37 2020
  GitCommit: 9f6d6ba0b314d86521b66183c9ce48eaa2da1de2
  GoVersion: go1.15.2
  OsArch: linux/amd64
  Version: 2.1.1

Package info (e.g. output of rpm -q podman or apt list podman): I'm on git master

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide?

Yes

Additional environment details (AWS, VirtualBox, physical, etc.):

@openshift-ci-robot openshift-ci-robot added the kind/feature Categorizes issue or PR as related to a new feature. label Sep 30, 2020
@rhatdan rhatdan added the Good First Issue This issue would be a good issue for a first time contributor to undertake. label Oct 1, 2020
@andylibrian
Copy link
Contributor

/assign

andylibrian added a commit to andylibrian/podman that referenced this issue Oct 4, 2020
@rhatdan rhatdan changed the title Add support for resource limits to generate kube Add support for resource CPU limits to generate kube Oct 5, 2020
@rhatdan
Copy link
Member

rhatdan commented Oct 5, 2020

I think we still need CPU Limites added correct? @andylibrian ?

@andylibrian
Copy link
Contributor

@rhatdan Yes. Memory limit is straightforward to generate, but for CPU it seems that there is a conversion involved. Is it cpu-quota / cpu-period?

@mheon
Copy link
Member

mheon commented Oct 6, 2020

The logic we use in podman inspect is https://github.com/containers/podman/blob/master/libpod/container_inspect.go#L552-L558

andylibrian added a commit to andylibrian/podman that referenced this issue Oct 8, 2020
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Good First Issue This issue would be a good issue for a first time contributor to undertake. kind/feature Categorizes issue or PR as related to a new feature. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants