@@ -22,6 +22,7 @@ use stackable_operator::{
2222 pod:: {
2323 PodBuilder ,
2424 container:: ContainerBuilder ,
25+ probe:: ProbeBuilder ,
2526 resources:: ResourceRequirementsBuilder ,
2627 security:: PodSecurityContextBuilder ,
2728 volume:: {
@@ -40,9 +41,9 @@ use stackable_operator::{
4041 DeepMerge ,
4142 api:: {
4243 apps:: v1:: { StatefulSet , StatefulSetSpec } ,
43- core:: v1:: { ConfigMap , EnvVar , HTTPGetAction , Probe } ,
44+ core:: v1:: { ConfigMap , EnvVar } ,
4445 } ,
45- apimachinery:: pkg:: { apis:: meta:: v1:: LabelSelector , util :: intstr :: IntOrString } ,
46+ apimachinery:: pkg:: apis:: meta:: v1:: LabelSelector ,
4647 } ,
4748 kube:: {
4849 Resource , ResourceExt ,
@@ -930,32 +931,33 @@ fn build_server_rolegroup_statefulset(
930931}
931932
932933fn add_superset_container_probes ( superset_cb : & mut ContainerBuilder ) {
933- let probe_action = HTTPGetAction {
934- port : IntOrString :: Int ( APP_PORT . into ( ) ) ,
935- path : Some ( "/health" . to_string ( ) ) ,
936- ..HTTPGetAction :: default ( )
937- } ;
938- let common_probe = Probe {
939- http_get : Some ( probe_action) ,
940- period_seconds : Some ( 5 ) ,
941- timeout_seconds : Some ( 5 ) ,
942- success_threshold : Some ( 1 ) ,
943- ..Probe :: default ( )
944- } ;
945- superset_cb. startup_probe ( Probe {
946- failure_threshold : Some ( 10 /* minutes */ * 60 / 5 ) ,
947- ..common_probe. clone ( )
948- } ) ;
934+ let common =
935+ ProbeBuilder :: http_get_port_scheme_path ( APP_PORT , None , Some ( "/health" . to_owned ( ) ) )
936+ . with_period ( Duration :: from_secs ( 5 ) ) ;
937+
938+ superset_cb. startup_probe (
939+ common
940+ . clone ( )
941+ . with_failure_threshold_duration ( Duration :: from_minutes_unchecked ( 10 ) )
942+ . expect ( "static period is always non-zero" )
943+ . build ( )
944+ . expect ( "static durations are not too long" ) ,
945+ ) ;
946+
949947 // Remove it from the Service immediately
950- superset_cb. readiness_probe ( Probe {
951- failure_threshold : Some ( 1 ) ,
952- ..common_probe. clone ( )
953- } ) ;
948+ superset_cb. readiness_probe (
949+ common
950+ . clone ( )
951+ . build ( )
952+ . expect ( "static durations are not too long" ) ,
953+ ) ;
954954 // But only restart it after 3 failures
955- superset_cb. readiness_probe ( Probe {
956- failure_threshold : Some ( 3 ) ,
957- ..common_probe
958- } ) ;
955+ superset_cb. liveness_probe (
956+ common
957+ . with_failure_threshold ( 3 )
958+ . build ( )
959+ . expect ( "static durations are not too long" ) ,
960+ ) ;
959961}
960962
961963fn add_authentication_volumes_and_volume_mounts (
0 commit comments