-
Notifications
You must be signed in to change notification settings - Fork 118
Description
In a commit some time ago, it had been changed how env variables are being passed to the container: 76f436f
The change expects the shim implementation to set the env during run_wasi and therefore skip libcontainer DefaultExecutor.setup_envs using a no-op implementation.
This misses to handle the case of native Linux containers, where simply no env is set, because obviously, there is no responsible shim.
Environment is for example crucial when running a Linux container sidecar of a WASM container pod in Knative (queue-proxy), which fails in the current state because of the described behaviour.
A fix for this would be deciding in the LibcontainerExecutor implementation whether to skip env setup based on the container type.
To determine the container type, the OCI spec needs to be available. (https://github.com/youki-dev/youki/blob/8ce850c2bba192c5170c3c51ce1ea65c1c057231/crates/libcontainer/src/workload/mod.rs#L81)
This would require a change in the youki/libcontainer API, to provide an additional parameter in DefaultExecutor.setup_envs.
If this (breaking?) libcontainer change is considered viable, I can create a PR there.
An alternative approach without libcontainer changes would be:
- not replacing the DefaultExecutor setup_envs with a no op
- therefore enabling process env setup by default
- clearing env before executing run_wasi in exec
This commit shows how it would look like:
toobeeh@04f1a5b
Personally I don't think this internal fix should be preferred, since set vars -> clear vars is unnecessary overhead for the default behaviour of running a WASM container.
If it should be good enough for a hotfix/temporary workaround, I may open a PR though.
I tested the version at mentioned commit and it solves the problem I am having with knative (queue-proxy sidecar).