Skip to content

Commit df4abc0

Browse files
committed
refactor according to review
1 parent 6276387 commit df4abc0

File tree

1 file changed

+13
-9
lines changed
  • crates/stackable-operator/src/builder/pod

1 file changed

+13
-9
lines changed

crates/stackable-operator/src/builder/pod/probe.rs

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,35 +41,39 @@ pub enum ProbeAction {
4141
TcpSocket(TCPSocketAction),
4242
}
4343

44-
impl<Period> ProbeBuilder<(), Period> {
44+
impl ProbeBuilder<(), ()> {
4545
/// This probe action executes the specified command
4646
pub fn with_exec_action_helper(
4747
self,
4848
command: impl IntoIterator<Item = impl Into<String>>,
49-
) -> ProbeBuilder<ProbeAction, Period> {
49+
) -> ProbeBuilder<ProbeAction, ()> {
5050
self.with_exec_action(ExecAction {
5151
command: Some(command.into_iter().map(Into::into).collect()),
5252
})
5353
}
5454

5555
/// There is a convenience helper: [`Self::with_exec_action_helper`].
56-
pub fn with_exec_action(self, exec_action: ExecAction) -> ProbeBuilder<ProbeAction, Period> {
56+
pub fn with_exec_action(self, exec_action: ExecAction) -> ProbeBuilder<ProbeAction, ()> {
5757
self.with_action(ProbeAction::Exec(exec_action))
5858
}
5959

60-
pub fn with_grpc_action(self, grpc_action: GRPCAction) -> ProbeBuilder<ProbeAction, Period> {
60+
pub fn with_grpc_action(self, grpc_action: GRPCAction) -> ProbeBuilder<ProbeAction, ()> {
6161
self.with_action(ProbeAction::Grpc(grpc_action))
6262
}
6363

64+
// Note: Ideally we also have a builder for `HTTPGetAction`, but that is lot's of effort we
65+
// don't want to spend now.
6466
/// This probe action does an HTTP GET request to the specified port. Optionally, you can
6567
/// configure the path, otherwise the Kubernetes default is used.
6668
pub fn with_http_get_action_helper(
6769
self,
6870
port: u16,
71+
scheme: Option<String>,
6972
path: Option<String>,
70-
) -> ProbeBuilder<ProbeAction, Period> {
73+
) -> ProbeBuilder<ProbeAction, ()> {
7174
self.with_http_get_action(HTTPGetAction {
7275
path,
76+
scheme,
7377
port: IntOrString::Int(port.into()),
7478
..Default::default()
7579
})
@@ -79,20 +83,20 @@ impl<Period> ProbeBuilder<(), Period> {
7983
pub fn with_http_get_action(
8084
self,
8185
http_get_action: HTTPGetAction,
82-
) -> ProbeBuilder<ProbeAction, Period> {
86+
) -> ProbeBuilder<ProbeAction, ()> {
8387
self.with_action(ProbeAction::HttpGet(http_get_action))
8488
}
8589

8690
pub fn with_tcp_socket_action(
8791
self,
8892
tcp_socket_action: TCPSocketAction,
89-
) -> ProbeBuilder<ProbeAction, Period> {
93+
) -> ProbeBuilder<ProbeAction, ()> {
9094
self.with_action(ProbeAction::TcpSocket(tcp_socket_action))
9195
}
9296

9397
/// Action-specific functions (e.g. [`Self::with_exec_action`] or [`Self::with_http_get_action`])
9498
/// are recommended instead.
95-
pub fn with_action(self, action: ProbeAction) -> ProbeBuilder<ProbeAction, Period> {
99+
pub fn with_action(self, action: ProbeAction) -> ProbeBuilder<ProbeAction, ()> {
96100
let Self {
97101
action: (),
98102
period,
@@ -244,7 +248,7 @@ mod tests {
244248
#[test]
245249
fn test_probe_builder_minimal() {
246250
let probe = ProbeBuilder::default()
247-
.with_http_get_action_helper(8080, None)
251+
.with_http_get_action_helper(8080, None, None)
248252
.with_period(Duration::from_secs(10))
249253
.build();
250254

0 commit comments

Comments
 (0)