diff --git a/kube-client/src/client/kubelet_debug.rs b/kube-client/src/client/kubelet_debug.rs index 0ba1cb52f..a44f30e66 100644 --- a/kube-client/src/client/kubelet_debug.rs +++ b/kube-client/src/client/kubelet_debug.rs @@ -3,7 +3,7 @@ use crate::{ client::AsyncBufRead, Client, Error, Result, }; -use kube_core::{node_proxy::KubeletDebugParams, Request}; +use kube_core::{kubelet_debug::KubeletDebugParams, Request}; use std::fmt::Debug; /// Methods to access debug endpoints directly on `kubelet` @@ -16,7 +16,7 @@ use std::fmt::Debug; /// ## Warning /// These methods require direct and insecure access to `kubelet` and is only available under the `kubelet_debug` feature. /// End-to-end usage is explored in the [pod_log_node_proxy](./examples/pod_log_node_proxy.rs) example. -#[cfg(feature = "kubelet_debug")] +#[cfg(feature = "kubelet-debug")] impl Client { /// Attach to pod directly from the node /// @@ -24,10 +24,12 @@ impl Client { /// This method uses the insecure `kubelet_debug` interface. pub async fn node_attach( &self, - node_proxy_params: &KubeletDebugParams<'_>, + kubelet_debug_params: &KubeletDebugParams<'_>, container: &str, + ap: &AttachParams, ) -> Result { - let mut req = Request::node_attach(node_proxy_params, container, ap).map_err(Error::BuildRequest)?; + let mut req = + Request::node_attach(kubelet_debug_params, container, ap).map_err(Error::BuildRequest)?; req.extensions_mut().insert("node_attach"); let stream = self.connect(req).await?; Ok(AttachedProcess::new(stream, ap)) @@ -39,7 +41,7 @@ impl Client { /// This method uses the insecure `kubelet_debug` interface. pub async fn node_exec( &self, - node_proxy_params: &KubeletDebugParams<'_>, + kubelet_debug_params: &KubeletDebugParams<'_>, container: &str, command: I, ap: &AttachParams, @@ -49,7 +51,7 @@ impl Client { T: Into, { let mut req = - Request::node_exec(node_proxy_params, container, command, ap).map_err(Error::BuildRequest)?; + Request::node_exec(kubelet_debug_params, container, command, ap).map_err(Error::BuildRequest)?; req.extensions_mut().insert("node_exec"); let stream = self.connect(req).await?; Ok(AttachedProcess::new(stream, ap)) @@ -61,10 +63,10 @@ impl Client { /// This method uses the insecure `kubelet_debug` interface. pub async fn node_portforward( &self, - node_proxy_params: &KubeletDebugParams<'_>, + kubelet_debug_params: &KubeletDebugParams<'_>, ports: &[u16], ) -> Result { - let mut req = Request::node_portforward(node_proxy_params, ports).map_err(Error::BuildRequest)?; + let mut req = Request::node_portforward(kubelet_debug_params, ports).map_err(Error::BuildRequest)?; req.extensions_mut().insert("node_portforward"); let stream = self.connect(req).await?; Ok(Portforwarder::new(stream, ports)) @@ -76,11 +78,11 @@ impl Client { /// This method uses the insecure `kubelet_debug` interface. pub async fn node_logs( &self, - node_proxy_params: &KubeletDebugParams<'_>, + kubelet_debug_params: &KubeletDebugParams<'_>, container: &str, lp: &LogParams, ) -> Result { - let mut req = Request::node_logs(node_proxy_params, container, lp).map_err(Error::BuildRequest)?; + let mut req = Request::node_logs(kubelet_debug_params, container, lp).map_err(Error::BuildRequest)?; req.extensions_mut().insert("node_log"); self.request_stream(req).await } diff --git a/kube-client/src/client/mod.rs b/kube-client/src/client/mod.rs index 643822a9f..6aeb735a7 100644 --- a/kube-client/src/client/mod.rs +++ b/kube-client/src/client/mod.rs @@ -36,7 +36,7 @@ pub use auth::Error as AuthError; pub use config_ext::ConfigExt; pub mod middleware; -#[cfg(feature = "kubelet_debug")] mod kubelet_debug; +#[cfg(feature = "kubelet-debug")] mod kubelet_debug; #[cfg(any(feature = "rustls-tls", feature = "openssl-tls"))] mod tls; #[cfg(feature = "openssl-tls")] diff --git a/kube-core/src/kubelet_debug.rs b/kube-core/src/kubelet_debug.rs index 4e8f1b0cf..8a1056f2b 100644 --- a/kube-core/src/kubelet_debug.rs +++ b/kube-core/src/kubelet_debug.rs @@ -34,13 +34,13 @@ impl KubeletDebugParams<'_> { impl Request { /// Attach to pod directly from the node pub fn node_attach( - node_proxy_params: &KubeletDebugParams<'_>, + kubelet_debug_params: &KubeletDebugParams<'_>, container: &str, ap: &AttachParams, ) -> Result>, Error> { ap.validate()?; - let target = format!("/attach/{}/{container}?", node_proxy_params.with_uid()); + let target = format!("/attach/{}/{container}?", kubelet_debug_params.with_uid()); let mut qp = form_urlencoded::Serializer::new(target); ap.append_to_url_serializer_local(&mut qp); @@ -50,7 +50,7 @@ impl Request { /// Execute a command in a pod directly from the node pub fn node_exec( - node_proxy_params: &KubeletDebugParams<'_>, + kubelet_debug_params: &KubeletDebugParams<'_>, container: &str, command: I, ap: &AttachParams, @@ -61,7 +61,7 @@ impl Request { { ap.validate()?; - let target = format!("/exec/{}/{container}?", node_proxy_params.with_uid()); + let target = format!("/exec/{}/{container}?", kubelet_debug_params.with_uid()); let mut qp = form_urlencoded::Serializer::new(target); ap.append_to_url_serializer_local(&mut qp); @@ -75,7 +75,7 @@ impl Request { /// Forward ports of a pod directly from the node pub fn node_portforward( - node_proxy_params: &KubeletDebugParams<'_>, + kubelet_debug_params: &KubeletDebugParams<'_>, ports: &[u16], ) -> Result>, Error> { if ports.is_empty() { @@ -99,7 +99,7 @@ impl Request { } } - let base_url = format!("/portForward/{}?", node_proxy_params.with_uid()); + let base_url = format!("/portForward/{}?", kubelet_debug_params.with_uid()); let mut qp = form_urlencoded::Serializer::new(base_url); qp.append_pair( "port", @@ -111,12 +111,15 @@ impl Request { /// Stream logs directly from node pub fn node_logs( - node_proxy_params: &KubeletDebugParams<'_>, + kubelet_debug_params: &KubeletDebugParams<'_>, container: &str, lp: &LogParams, ) -> Result>, Error> { // Node logs is the only one that doesn't accept an uid for pod - let target = format!("/containerLogs/{}/{container}?", node_proxy_params.without_uid()); + let target = format!( + "/containerLogs/{}/{container}?", + kubelet_debug_params.without_uid() + ); let mut qp = form_urlencoded::Serializer::new(target);