Kubernetes CRI CLI: crictl-shaped client, simulator server, proxy
1(* runtime.v1 runtime status and configuration messages. The [cgroup_driver]
2 field is the CgroupDriver enum (0 SYSTEMD, 1 CGROUPFS). Empty
3 requests/responses use {!Empty.t}. Field numbers from api.proto. *)
4
5module Pb = Protobuf
6
7type condition = {
8 type_ : string;
9 status : bool;
10 reason : string;
11 message : string;
12}
13
14let condition : condition Pb.t =
15 let open Pb.Message in
16 v (fun type_ status reason message -> { type_; status; reason; message })
17 |> required 1 Pb.string ~enc:(fun r -> r.type_)
18 |> required 2 Pb.bool ~enc:(fun r -> r.status)
19 |> required 3 Pb.string ~enc:(fun r -> r.reason)
20 |> required 4 Pb.string ~enc:(fun r -> r.message)
21 |> seal
22
23type status = { conditions : condition list }
24
25let status : status Pb.t =
26 let open Pb.Message in
27 v (fun conditions -> { conditions })
28 |> repeated 1 condition ~enc:(fun r -> r.conditions)
29 |> seal
30
31type status_request = { verbose : bool }
32
33let status_request : status_request Pb.t =
34 let open Pb.Message in
35 v (fun verbose -> { verbose })
36 |> required 1 Pb.bool ~enc:(fun r -> r.verbose)
37 |> seal
38
39type handler_features = {
40 recursive_read_only_mounts : bool;
41 user_namespaces : bool;
42}
43
44let handler_features : handler_features Pb.t =
45 let open Pb.Message in
46 v (fun recursive_read_only_mounts user_namespaces ->
47 { recursive_read_only_mounts; user_namespaces })
48 |> required 1 Pb.bool ~enc:(fun r -> r.recursive_read_only_mounts)
49 |> required 2 Pb.bool ~enc:(fun r -> r.user_namespaces)
50 |> seal
51
52type handler = { name : string; features : handler_features option }
53
54let handler : handler Pb.t =
55 let open Pb.Message in
56 v (fun name features -> { name; features })
57 |> required 1 Pb.string ~enc:(fun r -> r.name)
58 |> optional 2 handler_features ~enc:(fun r -> r.features)
59 |> seal
60
61type features = {
62 supplemental_groups_policy : bool;
63 user_namespaces_host_network : bool;
64}
65
66let features : features Pb.t =
67 let open Pb.Message in
68 v (fun supplemental_groups_policy user_namespaces_host_network ->
69 { supplemental_groups_policy; user_namespaces_host_network })
70 |> required 1 Pb.bool ~enc:(fun r -> r.supplemental_groups_policy)
71 |> required 2 Pb.bool ~enc:(fun r -> r.user_namespaces_host_network)
72 |> seal
73
74type status_response = {
75 status : status option;
76 info : (string * string) list;
77 runtime_handlers : handler list;
78 features : features option;
79}
80
81let status_response : status_response Pb.t =
82 let open Pb.Message in
83 v (fun status info runtime_handlers features ->
84 { status; info; runtime_handlers; features })
85 |> optional 1 status ~enc:(fun r -> r.status)
86 |> map 2 Pb.string Pb.string ~enc:(fun r -> r.info)
87 |> repeated 3 handler ~enc:(fun r -> r.runtime_handlers)
88 |> optional 4 features ~enc:(fun r -> r.features)
89 |> seal
90
91type network_config = { pod_cidr : string }
92
93let network_config : network_config Pb.t =
94 let open Pb.Message in
95 v (fun pod_cidr -> { pod_cidr })
96 |> required 1 Pb.string ~enc:(fun r -> r.pod_cidr)
97 |> seal
98
99type config = { network_config : network_config option }
100
101let config : config Pb.t =
102 let open Pb.Message in
103 v (fun network_config -> { network_config })
104 |> optional 1 network_config ~enc:(fun r -> r.network_config)
105 |> seal
106
107type update_runtime_config_request = { config : config option }
108
109let update_runtime_config_request : update_runtime_config_request Pb.t =
110 let open Pb.Message in
111 v (fun config -> { config })
112 |> optional 1 config ~enc:(fun r -> r.config)
113 |> seal
114
115type linux_runtime_configuration = { cgroup_driver : int32 }
116
117let linux_runtime_configuration : linux_runtime_configuration Pb.t =
118 let open Pb.Message in
119 v (fun cgroup_driver -> { cgroup_driver })
120 |> required 1 Pb.int32 ~enc:(fun r -> r.cgroup_driver)
121 |> seal
122
123type config_response = { linux : linux_runtime_configuration option }
124
125let config_response : config_response Pb.t =
126 let open Pb.Message in
127 v (fun linux -> { linux })
128 |> optional 1 linux_runtime_configuration ~enc:(fun r -> r.linux)
129 |> seal