@@ -15,8 +15,11 @@ pub enum Error {
15
15
#[ snafu( display( "failed to list nodes" ) ) ]
16
16
ListNodes { source : kube:: Error } ,
17
17
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
+ } ,
20
23
21
24
#[ snafu( display( "failed to fetch kubelet config from node {node:?}" ) ) ]
22
25
FetchNodeKubeletConfig { source : kube:: Error , node : String } ,
@@ -27,7 +30,9 @@ pub enum Error {
27
30
#[ snafu( display( "failed to deserialize kubelet config JSON" ) ) ]
28
31
KubeletConfigJson { source : serde_json:: Error } ,
29
32
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
+ ) ) ]
31
36
EmptyKubernetesNodesList ,
32
37
}
33
38
@@ -54,15 +59,18 @@ impl KubeletConfig {
54
59
let node = nodes. iter ( ) . next ( ) . context ( EmptyKubernetesNodesListSnafu ) ?;
55
60
let node_name = node. name_any ( ) ;
56
61
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
+ } ) ?;
61
69
62
70
let resp = client
63
71
. request :: < ProxyConfigResponse > ( req)
64
72
. await
65
- . context ( FetchNodeKubeletConfigSnafu { node : name } ) ?;
73
+ . context ( FetchNodeKubeletConfigSnafu { node : node_name } ) ?;
66
74
67
75
Ok ( resp. kubeletconfig )
68
76
}
0 commit comments