@@ -15,8 +15,11 @@ pub enum Error {
1515 #[ snafu( display( "failed to list nodes" ) ) ]
1616 ListNodes { source : kube:: Error } ,
1717
18- #[ snafu( display( "failed to build \" /proxy/configz\" request" ) ) ]
19- ConfigzRequest { source : http:: Error } ,
18+ #[ snafu( display( "failed to build \" /api/v1/nodes/{node_name}/proxy/configz\" request" ) ) ]
19+ ConfigzRequest {
20+ source : http:: Error ,
21+ node_name : String ,
22+ } ,
2023
2124 #[ snafu( display( "failed to fetch kubelet config from node {node:?}" ) ) ]
2225 FetchNodeKubeletConfig { source : kube:: Error , node : String } ,
@@ -27,7 +30,9 @@ pub enum Error {
2730 #[ snafu( display( "failed to deserialize kubelet config JSON" ) ) ]
2831 KubeletConfigJson { source : serde_json:: Error } ,
2932
30- #[ snafu( display( "empty Kubernetes nodes list" ) ) ]
33+ #[ snafu( display(
34+ "empty Kubernetes nodes list. At least one node is required to fetch the cluster domain from the kubelet config"
35+ ) ) ]
3136 EmptyKubernetesNodesList ,
3237}
3338
@@ -54,15 +59,18 @@ impl KubeletConfig {
5459 let node = nodes. iter ( ) . next ( ) . context ( EmptyKubernetesNodesListSnafu ) ?;
5560 let node_name = node. name_any ( ) ;
5661
57- let url = format ! ( "/api/v1/nodes/{name_name}/proxy/configz" ) ;
58- let req = http:: Request :: get ( url)
59- . body ( Default :: default ( ) )
60- . context ( ConfigzRequestSnafu ) ?;
62+ let url = format ! ( "/api/v1/nodes/{node_name}/proxy/configz" ) ;
63+ let req =
64+ http:: Request :: get ( url)
65+ . body ( Default :: default ( ) )
66+ . context ( ConfigzRequestSnafu {
67+ node_name : node_name. clone ( ) ,
68+ } ) ?;
6169
6270 let resp = client
6371 . request :: < ProxyConfigResponse > ( req)
6472 . await
65- . context ( FetchNodeKubeletConfigSnafu { node : name } ) ?;
73+ . context ( FetchNodeKubeletConfigSnafu { node : node_name } ) ?;
6674
6775 Ok ( resp. kubeletconfig )
6876 }
0 commit comments