@@ -45,9 +45,8 @@ use stackable_operator::{
45
45
k8s_openapi:: {
46
46
api:: core:: v1:: {
47
47
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 ,
51
50
} ,
52
51
apimachinery:: pkg:: util:: intstr:: IntOrString ,
53
52
} ,
@@ -158,15 +157,6 @@ pub enum ContainerConfig {
158
157
web_ui_http_port_name : & ' static str ,
159
158
/// Port name of the web UI HTTPS port, used for the liveness probe.
160
159
web_ui_https_port_name : & ' static str ,
161
- /// Path of the web UI URL; The path defaults to / in Kubernetes
162
- /// and the kubelet follows redirects. The default would work if
163
- /// the location header is set properly but that is not the case
164
- /// for the DataNode. On a TLS-enabled DataNode, calling
165
- /// https://127.0.0.1:9865/ redirects to the non-TLS URL
166
- /// http://127.0.0.1:9865/index.html which causes the liveness
167
- /// probe to fail. So it is best to not rely on the location
168
- /// header but instead provide the resolved path directly.
169
- web_ui_path : & ' static str ,
170
160
/// The JMX Exporter metrics port.
171
161
metrics_port : u16 ,
172
162
} ,
@@ -958,38 +948,29 @@ wait_for_termination $!
958
948
initial_delay_seconds : i32 ,
959
949
failure_threshold : i32 ,
960
950
) -> 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
- }
951
+ let ContainerConfig :: Hdfs {
952
+ web_ui_http_port_name,
953
+ web_ui_https_port_name,
954
+ ..
955
+ } = self
956
+ else {
957
+ return None ;
958
+ } ;
959
+
960
+ let port = if hdfs. has_https_enabled ( ) {
961
+ web_ui_https_port_name
962
+ } else {
963
+ web_ui_http_port_name
964
+ } ;
965
+
966
+ Some ( Probe {
967
+ // Use tcp_socket instead of http_get so that the probe is independent of the authentication settings.
968
+ tcp_socket : Some ( Self :: tcp_socket_action_for_port ( * port) ) ,
969
+ period_seconds : Some ( period_seconds) ,
970
+ initial_delay_seconds : Some ( initial_delay_seconds) ,
971
+ failure_threshold : Some ( failure_threshold) ,
972
+ ..Probe :: default ( )
973
+ } )
993
974
}
994
975
995
976
/// Creates a probe for the IPC/RPC port
@@ -1001,10 +982,7 @@ wait_for_termination $!
1001
982
) -> Option < Probe > {
1002
983
match self {
1003
984
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
- } ) ,
985
+ tcp_socket : Some ( Self :: tcp_socket_action_for_port ( * ipc_port_name) ) ,
1008
986
period_seconds : Some ( period_seconds) ,
1009
987
initial_delay_seconds : Some ( initial_delay_seconds) ,
1010
988
failure_threshold : Some ( failure_threshold) ,
@@ -1014,6 +992,13 @@ wait_for_termination $!
1014
992
}
1015
993
}
1016
994
995
+ fn tcp_socket_action_for_port ( port : impl Into < String > ) -> TCPSocketAction {
996
+ TCPSocketAction {
997
+ port : IntOrString :: String ( port. into ( ) ) ,
998
+ ..Default :: default ( )
999
+ }
1000
+ }
1001
+
1017
1002
/// Return the container volumes.
1018
1003
fn volumes (
1019
1004
& self ,
@@ -1390,7 +1375,6 @@ impl From<HdfsRole> for ContainerConfig {
1390
1375
ipc_port_name : SERVICE_PORT_NAME_RPC ,
1391
1376
web_ui_http_port_name : SERVICE_PORT_NAME_HTTP ,
1392
1377
web_ui_https_port_name : SERVICE_PORT_NAME_HTTPS ,
1393
- web_ui_path : "/dfshealth.html" ,
1394
1378
metrics_port : DEFAULT_NAME_NODE_METRICS_PORT ,
1395
1379
} ,
1396
1380
HdfsRole :: DataNode => Self :: Hdfs {
@@ -1400,7 +1384,6 @@ impl From<HdfsRole> for ContainerConfig {
1400
1384
ipc_port_name : SERVICE_PORT_NAME_IPC ,
1401
1385
web_ui_http_port_name : SERVICE_PORT_NAME_HTTP ,
1402
1386
web_ui_https_port_name : SERVICE_PORT_NAME_HTTPS ,
1403
- web_ui_path : "/datanode.html" ,
1404
1387
metrics_port : DEFAULT_DATA_NODE_METRICS_PORT ,
1405
1388
} ,
1406
1389
HdfsRole :: JournalNode => Self :: Hdfs {
@@ -1410,7 +1393,6 @@ impl From<HdfsRole> for ContainerConfig {
1410
1393
ipc_port_name : SERVICE_PORT_NAME_RPC ,
1411
1394
web_ui_http_port_name : SERVICE_PORT_NAME_HTTP ,
1412
1395
web_ui_https_port_name : SERVICE_PORT_NAME_HTTPS ,
1413
- web_ui_path : "/journalnode.html" ,
1414
1396
metrics_port : DEFAULT_JOURNAL_NODE_METRICS_PORT ,
1415
1397
} ,
1416
1398
}
0 commit comments