1+ //! Kubernetes [`Probe`] builder.
2+ //!
3+ //! The upstream [`Probe`] struct does not prevent invalid probe configurations
4+ //! which leads to surprises at runtime which can be deeply hidden.
5+ //! You need to specify at least an action and interval (in this order).
6+ //!
7+ //! ### Usage example
8+ //!
9+ //! ```
10+ //! use stackable_operator::{
11+ //! builder::pod::probe::ProbeBuilder,
12+ //! time::Duration,
13+ //! };
14+ //! # use k8s_openapi::api::core::v1::HTTPGetAction;
15+ //! # use k8s_openapi::apimachinery::pkg::util::intstr::IntOrString;
16+ //!
17+ //! let probe = ProbeBuilder::http_get_port_scheme_path(8080, None, None)
18+ //! .with_period(Duration::from_secs(10))
19+ //! .build()
20+ //! .expect("failed to build probe");
21+ //!
22+ //! assert_eq!(
23+ //! probe.http_get,
24+ //! Some(HTTPGetAction {
25+ //! port: IntOrString::Int(8080),
26+ //! ..Default::default()
27+ //! })
28+ //! );
29+ //! assert_eq!(probe.period_seconds, Some(10));
30+ //! ```
31+
132use std:: num:: TryFromIntError ;
233
334use k8s_openapi:: {
@@ -23,36 +54,6 @@ pub enum Error {
2354 PeriodIsZero { } ,
2455}
2556
26- /// Kubernetes [`Probe`] builder.
27- ///
28- /// The upstream [`Probe`] struct does not prevent invalid probe configurations
29- /// which leads to surprises at runtime which can be deeply hidden.
30- /// You need to specify at least an action and interval (in this order).
31- ///
32- /// ### Usage example
33- ///
34- /// ```
35- /// use stackable_operator::{
36- /// builder::pod::probe::ProbeBuilder,
37- /// time::Duration,
38- /// };
39- /// # use k8s_openapi::api::core::v1::HTTPGetAction;
40- /// # use k8s_openapi::apimachinery::pkg::util::intstr::IntOrString;
41- ///
42- /// let probe = ProbeBuilder::http_get_port_scheme_path(8080, None, None)
43- /// .with_period(Duration::from_secs(10))
44- /// .build()
45- /// .expect("failed to build probe");
46- ///
47- /// assert_eq!(
48- /// probe.http_get,
49- /// Some(HTTPGetAction {
50- /// port: IntOrString::Int(8080),
51- /// ..Default::default()
52- /// })
53- /// );
54- /// assert_eq!(probe.period_seconds, Some(10));
55- /// ```
5657#[ derive( Debug ) ]
5758pub struct ProbeBuilder < Action , Period > {
5859 // Mandatory field
0 commit comments