opencontainers / runc

CLI tool for spawning and running containers according to the OCI specification
https://www.opencontainers.org/
Apache License 2.0
11.58k stars 2.06k forks source link

libct/userns: assorted (godoc) improvements #4330

Closed thaJeztah closed 1 day ago

thaJeztah commented 4 days ago

libct/userns: change RunningInUserNS to a wrapper instead of an alias

This was a poor decision on my side; 4316df8b53cce2933d7f0f3cf4bf87da67459835 (https://github.com/opencontainers/runc/pull/2850) moved this utility to a separate package, and split the exported function from the implementation (and stubs). Out of convenience, I used an alias for the latter part, but there's two downsides to that;

This patch changes it to a regular function, acting as a wrapper for the underlying implementations. While at it, also slightly touching up the GoDoc to describe its functionality / behavior.

libct/userns: make fuzzer Linux-only, and remove stub for uidMapInUserNS

The fuzzer for this only runs on Linux; rename the file to be Linux-only so that we don't have to stub out the uidMapInUserNS function.

libct/userns: implement RunningInUserNS with sync.OnceValue

Now that we dropped support for go < 1.21, we can use this; moving the sync.once out of the runningInUserNS() implementation would also allow for it to be more easily tested if we'd decide to.

thaJeztah commented 2 days ago

I think CentOS 7 may be really gone now?

⚠️ Failed to start an instance: INVALID_ARGUMENT: Not Found 404 Not Found
POST [https://compute.googleapis.com:443/compute/v1/projects/cirrus-ci-community/zones/us-central1-c/instances](https://compute.googleapis.com/compute/v1/projects/cirrus-ci-community/zones/us-central1-c/instances)
{
"error": {
"code": 404,
"message": "The resource 'projects/centos-cloud/global/images/family/centos-7' was not found",
"errors": [
{
"message": "The resource 'projects/centos-cloud/global/images/family/centos-7' was not found",
"domain": "global",
"reason": "notFound"
}
]
}
}