Skip to content

Commit 8aa0173

Browse files
author
Ben Anson
committed
CP-36097 REQ-403 get-config API
Motivation for this API is so that xapi can obtain a cluster's certificate. Xapi will then give that certificate to any joiners. This is necessary in order for joining to work when tls client verification is enabled Add `encode_cluster_config` and `decode_cluster_config` for convenience Signed-off-by: Ben Anson <[email protected]>
1 parent a280f1d commit 8aa0173

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

cluster/cluster_interface.ml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ type cluster_config = {
6666
}
6767
[@@deriving rpcty]
6868

69+
let encode_cluster_config x =
70+
Rpcmarshal.marshal cluster_config.Rpc.Types.ty x |> Jsonrpc.to_string
71+
72+
let decode_cluster_config x =
73+
Jsonrpc.of_string x |> Rpcmarshal.unmarshal cluster_config.Rpc.Types.ty
74+
6975
type cluster_config_and_all_members = cluster_config * all_members
7076
[@@deriving rpcty]
7177

@@ -243,4 +249,10 @@ module LocalAPI (R : RPC) = struct
243249
declare "diagnostics"
244250
["Returns diagnostic information about the cluster"]
245251
(debug_info_p @-> returning diagnostics_p err)
252+
253+
let get_config =
254+
let cluster_config_p = Param.mk ~name:"cluster_config" cluster_config in
255+
declare "get-config"
256+
["Returns local cluster config"]
257+
(debug_info_p @-> returning cluster_config_p err)
246258
end

0 commit comments

Comments
 (0)