@@ -68,6 +68,94 @@ pub struct ContainerSpec {
6868 pub args : Vec < String > ,
6969
7070 pub resources : Option < ContainerRes > ,
71+
72+ #[ serde( rename = "livenessProbe" , default ) ]
73+ pub liveness_probe : Option < Probe > ,
74+
75+ #[ serde( rename = "readinessProbe" , default ) ]
76+ pub readiness_probe : Option < Probe > ,
77+
78+ #[ serde( rename = "startupProbe" , default ) ]
79+ pub startup_probe : Option < Probe > ,
80+ }
81+
82+ #[ derive( Debug , Serialize , Deserialize , Clone , PartialEq , Eq ) ]
83+ #[ serde( rename_all = "camelCase" ) ]
84+ pub enum ProbeAction {
85+ Exec ( ExecAction ) ,
86+ HttpGet ( HttpGetAction ) ,
87+ TcpSocket ( TcpSocketAction ) ,
88+ }
89+
90+ #[ derive( Debug , Serialize , Deserialize , Clone , PartialEq , Eq , Default ) ]
91+ pub struct Probe {
92+ pub action : Option < ProbeAction > ,
93+
94+ #[ serde( rename = "initialDelaySeconds" , default ) ]
95+ pub initial_delay_seconds : Option < u32 > ,
96+
97+ #[ serde( rename = "periodSeconds" , default ) ]
98+ pub period_seconds : Option < u32 > ,
99+
100+ #[ serde( rename = "timeoutSeconds" , default ) ]
101+ pub timeout_seconds : Option < u32 > ,
102+
103+ #[ serde( rename = "successThreshold" , default ) ]
104+ pub success_threshold : Option < u32 > ,
105+
106+ #[ serde( rename = "failureThreshold" , default ) ]
107+ pub failure_threshold : Option < u32 > ,
108+ }
109+
110+ impl Probe {
111+ /// Validates that the probe has exactly one action specified
112+ pub fn validate ( & self ) -> Result < ( ) , String > {
113+ match & self . action {
114+ Some ( _) => Ok ( ( ) ) ,
115+ None => Err (
116+ "probe must specify exactly one action (exec, httpGet, or tcpSocket)" . to_string ( ) ,
117+ ) ,
118+ }
119+ }
120+ }
121+
122+ #[ derive( Debug , Serialize , Deserialize , Clone , PartialEq , Eq , Default ) ]
123+ pub struct ExecAction {
124+ #[ serde( default ) ]
125+ pub command : Vec < String > ,
126+ }
127+
128+ #[ derive( Debug , Serialize , Deserialize , Clone , PartialEq , Eq ) ]
129+ pub struct HttpGetAction {
130+ #[ serde( default = "default_http_path" ) ]
131+ pub path : String ,
132+
133+ pub port : u16 ,
134+
135+ #[ serde( default ) ]
136+ pub host : Option < String > ,
137+ }
138+
139+ fn default_http_path ( ) -> String {
140+ "/" . to_string ( )
141+ }
142+
143+ impl Default for HttpGetAction {
144+ fn default ( ) -> Self {
145+ Self {
146+ path : default_http_path ( ) ,
147+ port : 0 ,
148+ host : None ,
149+ }
150+ }
151+ }
152+
153+ #[ derive( Debug , Serialize , Deserialize , Clone , PartialEq , Eq , Default ) ]
154+ pub struct TcpSocketAction {
155+ pub port : u16 ,
156+
157+ #[ serde( default ) ]
158+ pub host : Option < String > ,
71159}
72160
73161#[ derive( Debug , Serialize , Deserialize , Clone , PartialEq , Eq ) ]
@@ -102,6 +190,46 @@ pub struct PodTask {
102190pub struct PodStatus {
103191 #[ serde( rename = "podIP" ) ]
104192 pub pod_ip : Option < String > ,
193+
194+ #[ serde( rename = "containerStatuses" , default ) ]
195+ pub container_statuses : Vec < ContainerStatus > ,
196+ }
197+
198+ #[ derive( Debug , Serialize , Deserialize , Clone , Default , PartialEq , Eq ) ]
199+ pub struct ContainerStatus {
200+ pub name : String ,
201+
202+ #[ serde( rename = "readinessProbe" , default ) ]
203+ pub readiness_probe : Option < ContainerProbeStatus > ,
204+
205+ #[ serde( rename = "livenessProbe" , default ) ]
206+ pub liveness_probe : Option < ContainerProbeStatus > ,
207+
208+ #[ serde( rename = "startupProbe" , default ) ]
209+ pub startup_probe : Option < ContainerProbeStatus > ,
210+ }
211+
212+ #[ derive( Debug , Serialize , Deserialize , Clone , Copy , PartialEq , Eq , Default ) ]
213+ #[ serde( rename_all = "PascalCase" ) ]
214+ pub enum ProbeCondition {
215+ #[ default]
216+ Pending ,
217+ Ready ,
218+ Failing ,
219+ }
220+
221+ #[ derive( Debug , Serialize , Deserialize , Clone , Default , PartialEq , Eq ) ]
222+ pub struct ContainerProbeStatus {
223+ pub state : ProbeCondition ,
224+
225+ #[ serde( rename = "consecutiveSuccesses" , default ) ]
226+ pub consecutive_successes : u32 ,
227+
228+ #[ serde( rename = "consecutiveFailures" , default ) ]
229+ pub consecutive_failures : u32 ,
230+
231+ #[ serde( rename = "lastError" , default ) ]
232+ pub last_error : Option < String > ,
105233}
106234
107235#[ derive( Debug , Serialize , Deserialize , Clone , Default , PartialEq , Eq ) ]
0 commit comments