@@ -18,7 +18,7 @@ use crate::utils::k8s::{self, Client, ListParamsExt};
1818#[ derive( Debug , Snafu ) ]
1919pub enum Error {
2020 #[ snafu( display( "failed to fetch data from Kubernetes API" ) ) ]
21- KubeClientFetch { source : k8s:: Error } ,
21+ KubeClientFetch { source : Box < k8s:: Error > } ,
2222
2323 #[ snafu( display( "missing namespace for service {service:?}" ) ) ]
2424 MissingServiceNamespace { service : String } ,
@@ -62,6 +62,7 @@ pub async fn get_endpoints(
6262 }
6363 Err ( err) => Err ( err) ,
6464 }
65+ . map_err ( Box :: new)
6566 . context ( KubeClientFetchSnafu ) ?;
6667
6768 let mut endpoints = IndexMap :: new ( ) ;
@@ -95,6 +96,7 @@ pub async fn get_endpoints(
9596 let services = client
9697 . list_services ( Some ( object_namespace) , & list_params)
9798 . await
99+ . map_err ( Box :: new)
98100 . context ( KubeClientFetchSnafu ) ?;
99101
100102 for service in services {
@@ -161,6 +163,7 @@ pub async fn get_endpoint_urls_for_nodeport(
161163 let endpoints = client
162164 . get_endpoints ( service_namespace, service_name)
163165 . await
166+ . map_err ( Box :: new)
164167 . context ( KubeClientFetchSnafu ) ?;
165168
166169 let node_name = match & endpoints. subsets {
@@ -288,7 +291,11 @@ async fn get_node_ip(client: &Client, node_name: &str) -> Result<String, Error>
288291// TODO(sbernauer): Add caching. Not going to do so now, as listener-op
289292// will replace this code entirely anyway.
290293async fn get_node_name_ip_mapping ( client : & Client ) -> Result < HashMap < String , String > , Error > {
291- let nodes = client. list_nodes ( ) . await . context ( KubeClientFetchSnafu ) ?;
294+ let nodes = client
295+ . list_nodes ( )
296+ . await
297+ . map_err ( Box :: new)
298+ . context ( KubeClientFetchSnafu ) ?;
292299
293300 let mut result = HashMap :: new ( ) ;
294301 for node in nodes {
0 commit comments