INNER CODE UNIT · Rust

Some

kubie-org/kubie · src/kubectl.rs:16

    if let Some(kubeconfig) = kubeconfig.into() {
        temp_config_file = tempfile::Builder::new()
            .prefix("kubie-config")
            .suffix(".yaml")
            .tempfile()?;
        kubeconfig.write_to_file(temp_config_file.path())?;
        cmd.env("KUBECONFIG", temp_config_file.path());
    } else {
        cmd.env(
            "KUBECONFIG",
            env::var("KUBIE_KUBECONFIG").context("KUBIE_KUBECONFIG variable is not set")?,
        );
    }

    let result = cmd.output()?;
    if !result.status.success() {
        let stderr = str::from_utf8(&result.stderr).unwrap_or("could not decode stderr of kubectl as utf-8");
        return Err(anyhow!("Error calling kubectl:\n{}", stderr));

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…