bug: Kubernetes user namespace E2E uses incompatible kubectl setup
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 8.7k
- Forks
- 1.3k
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 253
Description
Agent Diagnostic
Loaded skill: create-github-issue.
Investigation findings:
- The
user_namespacesRust E2E target is declared ine2e/rust/Cargo.tomlwithrequired-features = ["e2e-kubernetes"]. - On
main,mise run e2e:kubernetesdid not normally execute this target becausee2e/rust/e2e-kubernetes.shdefaulted toe2e,e2e-host-gateway, withoute2e-kubernetes. - When the target is selected, the test setup is incompatible with the repo-controlled Kubernetes E2E flow.
e2e/rust/tests/user_namespaces.rsinvokeskubectlasdocker exec openshell-cluster-openshell kubectl, bute2e/with-kube-gateway.sh, the CI kind workflow, and the local k3d flow use hostkubectl --context ...; they do not create a Docker container namedopenshell-cluster-openshell. - Even after replacing that hardcoded
docker exec, the test mutates the gateway StatefulSet withkubectl set env, which triggers a gateway rollout whilewith-kube-gateway.shis holdingkubectl port-forwardsessions to the gateway service/statefulset. That can break the CLI endpoint used byopenshell sandbox createand surface as a generic sandbox creation timeout.
Relevant files:
e2e/rust/tests/user_namespaces.rse2e/rust/e2e-kubernetes.she2e/with-kube-gateway.sh.github/workflows/e2e-kubernetes-test.yml
Description
Actual behavior: When the Kubernetes user namespace E2E test is selected, it is likely to fail before exercising user namespace behavior because it shells out through a hardcoded Docker container name that the standard CI/local Kubernetes setup does not create. If that is fixed directly, the test can still be flaky or fail because it restarts the gateway in the middle of the run and disrupts active port-forwards.
Expected behavior: The user namespace E2E test should run against the same Kubernetes setup as the rest of mise run e2e:kubernetes, using the configured kube context and installing the gateway with user namespaces enabled before the test command starts. It should not perform a mid-test gateway rollout.
Reproduction Steps
- Ensure the
user_namespacestarget is selected by running Kubernetes E2E with thee2e-kubernetesfeature, or by targeting the test directly. - Run the Kubernetes E2E path against the repo-managed kind/k3d setup.
- Observe that the test's
kubectlhelper attemptsdocker exec openshell-cluster-openshell kubectl ...instead of using the configured kube context. - If the
kubectlhelper is patched ad hoc, observe thatkubectl set env statefulset/openshellperforms a gateway rollout during the test and can break the wrapper's port-forwarded gateway endpoint.
Environment
- OS: Linux CI / local Kubernetes E2E hosts
- Kubernetes E2E setup:
e2e/with-kube-gateway.shusing kind in CI or k3d/existing context locally - OpenShell: current
mainand branches that selecte2e-kubernetesby default
Logs
Expected failure mode when selected under the standard setup:
kubectl [..] failed: Error response from daemon: No such container: openshell-cluster-openshell
Potential follow-on failure mode after replacing the hardcoded Docker exec:
sandbox <name> did not appear within 60s
Suggested Fix
- Replace the test-local
docker exec openshell-cluster-openshell kubectlhelper with a shared E2E helper that uses the same kube context aswith-kube-gateway.sh. - Add a wrapper-level way to install the Helm chart with
server.enableUserNamespaces=truebefore tests start, for example anOPENSHELL_E2E_KUBE_ENABLE_USER_NAMESPACES=1switch that appends the appropriate Helm--set. - Remove the mid-test
kubectl set env/ gateway rollout fromuser_namespaces.rs. - Keep the test focused on creating a sandbox, waiting for the Sandbox CR/pod, inspecting
spec.hostUsers=falseand the expected capabilities, and cleaning up.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with e2e/rust/tests/user_namespaces.rs and compare its kubectl and gateway setup with e2e/rust/e2e-kubernetes.sh, e2e/with-kube-gateway.sh, and .github/workflows/e2e-kubernetes-test.yml. Run the Kubernetes E2E path with the repo-managed kind or k3d setup; done means the test uses the configured kube context, enables user namespaces before startup, avoids a mid-test rollout, and verifies the sandbox behavior successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, helm, kubernetes, rust
- Domain
- devops, infrastructure, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100