MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / kubectl

Function kubectl

e2e/rust/tests/user_namespaces.rs:24–41  ·  view source on GitHub ↗
(args: &[&str])

Source from the content-addressed store, hash-verified

22use tokio::process::Child;
23
24async fn kubectl(args: &[&str]) -> Result<String, String> {
25 let output = tokio::process::Command::new("docker")
26 .args(["exec", "openshell-cluster-openshell", "kubectl"])
27 .args(args)
28 .stdout(Stdio::piped())
29 .stderr(Stdio::piped())
30 .output()
31 .await
32 .map_err(|e| format!("failed to run kubectl: {e}"))?;
33
34 let stdout = String::from_utf8_lossy(&output.stdout).to_string();
35 let stderr = String::from_utf8_lossy(&output.stderr).to_string();
36
37 if !output.status.success() {
38 return Err(format!("kubectl {args:?} failed: {stdout}{stderr}"));
39 }
40 Ok(stdout)
41}
42
43async fn set_user_namespaces(enable: bool) -> Result<(), String> {
44 let env_arg = if enable {

Callers 5

set_user_namespacesFunction · 0.85
delete_sandboxFunction · 0.85
wait_for_sandboxFunction · 0.85
wait_for_sandbox_podFunction · 0.85

Calls 1

successMethod · 0.45

Tested by

no test coverage detected