Skip to content

Commit 637c806

Browse files
committed
chore: Switch WebUI liveness probe to tcp socket instead of httpGet
1 parent a49b429 commit 637c806

File tree

1 file changed

+32
-39
lines changed

1 file changed

+32
-39
lines changed

rust/operator-binary/src/container.rs

Lines changed: 32 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,8 @@ use stackable_operator::{
4545
k8s_openapi::{
4646
api::core::v1::{
4747
ConfigMapKeySelector, ConfigMapVolumeSource, Container, ContainerPort,
48-
EmptyDirVolumeSource, EnvVar, EnvVarSource, HTTPGetAction, ObjectFieldSelector,
49-
PersistentVolumeClaim, Probe, ResourceRequirements, TCPSocketAction, Volume,
50-
VolumeMount,
48+
EmptyDirVolumeSource, EnvVar, EnvVarSource, ObjectFieldSelector, PersistentVolumeClaim,
49+
Probe, ResourceRequirements, TCPSocketAction, Volume, VolumeMount,
5150
},
5251
apimachinery::pkg::util::intstr::IntOrString,
5352
},
@@ -958,38 +957,28 @@ wait_for_termination $!
958957
initial_delay_seconds: i32,
959958
failure_threshold: i32,
960959
) -> Option<Probe> {
961-
match self {
962-
ContainerConfig::Hdfs {
963-
web_ui_http_port_name,
964-
web_ui_https_port_name,
965-
web_ui_path,
966-
..
967-
} => {
968-
let http_get_action = if hdfs.has_https_enabled() {
969-
HTTPGetAction {
970-
port: IntOrString::String(web_ui_https_port_name.to_string()),
971-
scheme: Some("HTTPS".into()),
972-
path: Some(web_ui_path.to_string()),
973-
..HTTPGetAction::default()
974-
}
975-
} else {
976-
HTTPGetAction {
977-
port: IntOrString::String(web_ui_http_port_name.to_string()),
978-
scheme: Some("HTTP".into()),
979-
path: Some(web_ui_path.to_string()),
980-
..HTTPGetAction::default()
981-
}
982-
};
983-
Some(Probe {
984-
http_get: Some(http_get_action),
985-
period_seconds: Some(period_seconds),
986-
initial_delay_seconds: Some(initial_delay_seconds),
987-
failure_threshold: Some(failure_threshold),
988-
..Probe::default()
989-
})
990-
}
991-
_ => None,
992-
}
960+
let ContainerConfig::Hdfs {
961+
web_ui_http_port_name,
962+
web_ui_https_port_name,
963+
..
964+
} = self
965+
else {
966+
return None;
967+
};
968+
969+
let port = if hdfs.has_https_enabled() {
970+
web_ui_https_port_name
971+
} else {
972+
web_ui_http_port_name
973+
};
974+
975+
Some(Probe {
976+
tcp_socket: Some(Self::tcp_socket_action_for_port(*port)),
977+
period_seconds: Some(period_seconds),
978+
initial_delay_seconds: Some(initial_delay_seconds),
979+
failure_threshold: Some(failure_threshold),
980+
..Probe::default()
981+
})
993982
}
994983

995984
/// Creates a probe for the IPC/RPC port
@@ -1001,10 +990,7 @@ wait_for_termination $!
1001990
) -> Option<Probe> {
1002991
match self {
1003992
ContainerConfig::Hdfs { ipc_port_name, .. } => Some(Probe {
1004-
tcp_socket: Some(TCPSocketAction {
1005-
port: IntOrString::String(ipc_port_name.to_string()),
1006-
..TCPSocketAction::default()
1007-
}),
993+
tcp_socket: Some(Self::tcp_socket_action_for_port(*ipc_port_name)),
1008994
period_seconds: Some(period_seconds),
1009995
initial_delay_seconds: Some(initial_delay_seconds),
1010996
failure_threshold: Some(failure_threshold),
@@ -1014,6 +1000,13 @@ wait_for_termination $!
10141000
}
10151001
}
10161002

1003+
fn tcp_socket_action_for_port(port: impl Into<String>) -> TCPSocketAction {
1004+
TCPSocketAction {
1005+
port: IntOrString::String(port.into()),
1006+
..Default::default()
1007+
}
1008+
}
1009+
10171010
/// Return the container volumes.
10181011
fn volumes(
10191012
&self,

0 commit comments

Comments
 (0)