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

podman info - print available cgroup controllers #10306

Closed
aojea opened this issue May 11, 2021 · 4 comments · Fixed by #10387
Closed

podman info - print available cgroup controllers #10306

aojea opened this issue May 11, 2021 · 4 comments · Fixed by #10387
Labels
Good First Issue This issue would be a good issue for a first time contributor to undertake. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@aojea
Copy link
Contributor

aojea commented May 11, 2021

Opening a new issue with from:

Originally posted by @afbjorklund in #10289 (comment)

If i understand correctly, they had some different original requirements anyway:

		// Unlike `docker info`, `podman info` does not print available cgroup controllers.
		// So we parse "cgroup.subtree_control" file by ourselves.

So maybe they were more interested in cgroupVersion, and some new fields ?

	MemoryLimit     bool     `json:"MemoryLimit"`
	PidsLimit       bool     `json:"PidsLimit"`
	CPUShares       bool     `json:"CPUShares"`

kubernetes-sigs/kind#2233

@afbjorklund
Copy link
Contributor

afbjorklund commented May 11, 2021

The complete list is available at github.com/docker/docker/pkg/sysinfo

    v.MemoryLimit = sysInfo.MemoryLimit
    v.SwapLimit = sysInfo.SwapLimit
    v.KernelMemory = sysInfo.KernelMemory
    v.KernelMemoryTCP = sysInfo.KernelMemoryTCP
    v.OomKillDisable = sysInfo.OomKillDisable
    v.CPUCfsPeriod = sysInfo.CPUCfsPeriod
    v.CPUCfsQuota = sysInfo.CPUCfsQuota
    v.CPUShares = sysInfo.CPUShares
    v.CPUSet = sysInfo.Cpuset
    v.PidsLimit = sysInfo.PidsLimit

https://github.com/moby/moby/tree/master/pkg/sysinfo

@rhatdan
Copy link
Member

rhatdan commented May 12, 2021

Care to open a PR to fix?

@rhatdan rhatdan added the Good First Issue This issue would be a good issue for a first time contributor to undertake. label May 12, 2021
@rhatdan
Copy link
Member

rhatdan commented May 12, 2021

Do you want podman info to report all of this information?

@afbjorklund
Copy link
Contributor

afbjorklund commented May 13, 2021

Do you want podman info to report all of this information?

The request from kind was for three new fields. Maybe add swap* too ?

// dockerInfo corresponds to `docker info --format '{{json .}}'`
type dockerInfo struct {
        CgroupDriver    string   `json:"CgroupDriver"`  // "systemd", "cgroupfs", "none"
        CgroupVersion   string   `json:"CgroupVersion"` // e.g. "2"
        MemoryLimit     bool     `json:"MemoryLimit"`
        PidsLimit       bool     `json:"PidsLimit"`
        CPUShares       bool     `json:"CPUShares"`
        SecurityOptions []string `json:"SecurityOptions"`
}

It is mostly used for producing warnings, when running rootless / cgroups v2:

        if info.Rootless {
                if !info.Cgroup2 {
                        return errors.New("running kind with rootless provider requires cgroup v2, see https://kind.sigs.k8s.io/docs/user/rootless/")
                }
                if !info.SupportsMemoryLimit || !info.SupportsPidsLimit || !info.SupportsCPUShares {
                        return errors.New("running kind with rootless provider requires setting systemd property \"Delegate=yes\", see https://kind.sigs.k8s.io/docs/user/rootless/")
                }
        }

* mostly because it defaults to not being enabled, when running on Ubuntu

WARNING: No swap limit support


The current code was trying to parse /sys itself, which is why it failed when running with podman-remote.

https://github.com/kubernetes-sigs/kind/blob/main/pkg/cluster/internal/providers/docker/provider.go#L308

https://github.com/kubernetes-sigs/kind/blob/main/pkg/cluster/internal/providers/podman/provider.go#L367

If the three fields were available in the info JSON, it would not have to resort to such desperate measures.

@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 21, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 21, 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. 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.

3 participants