Skip to content

Commit 7a2756b

Browse files
committed
wip: experimental command
1 parent f8cc1c7 commit 7a2756b

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

rust/operator-binary/src/hbase_controller.rs

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use std::{
88
};
99

1010
use const_format::concatcp;
11+
use indoc::formatdoc;
1112
use product_config::{
1213
types::PropertyNameKind,
1314
writer::{to_hadoop_xml, to_java_properties_string, PropertiesWriterError},
@@ -861,14 +862,24 @@ fn build_rolegroup_statefulset(
861862
},
862863
]);
863864

865+
let role_name = hbase_role.cli_role_name();
864866
let mut hbase_container = ContainerBuilder::new("hbase").expect("ContainerBuilder not created");
865867
hbase_container
866868
.image_from_product_image(resolved_product_image)
867-
.command(vec!["/stackable/hbase/bin/hbase-entrypoint.sh".to_string()])
868-
.args(vec![
869-
hbase_role.cli_role_name(),
870-
hbase_service_domain_name(hbase, rolegroup_ref, cluster_info)?,
871-
hbase.service_port(hbase_role).to_string(),
869+
.command(command())
870+
.args(vec![formatdoc!{"
871+
{export_address}
872+
{export_port}
873+
{export_hostname}
874+
{entrypoint} {role} {domain} {port}",
875+
export_address = format!("export HBASE_CONF_hbase_{role_name}_hostname=$(cat /stackable/listener/default-address/address);").to_string(),
876+
export_port = format!("export HBASE_CONF_hbase_{role_name}_port=$(cat /stackable/listener/default-address/ports/ui-http);").to_string(),
877+
export_hostname = "export HOSTNAME=$(cat /stackable/listener/default-address/address);".to_string(),
878+
entrypoint = "/stackable/hbase/bin/hbase-entrypoint.sh".to_string(),
879+
role = role_name,
880+
domain = hbase_service_domain_name(hbase, rolegroup_ref, cluster_info)?,
881+
port = hbase.service_port(hbase_role).to_string(),
882+
}
872883
])
873884
.add_env_vars(merged_env)
874885
// Needed for the `containerdebug` process to log it's tracing information to.
@@ -1059,6 +1070,17 @@ fn build_rolegroup_statefulset(
10591070
})
10601071
}
10611072

1073+
/// Returns the container command.
1074+
fn command() -> Vec<String> {
1075+
vec![
1076+
"/bin/bash".to_string(),
1077+
"-x".to_string(),
1078+
"-euo".to_string(),
1079+
"pipefail".to_string(),
1080+
"-c".to_string(),
1081+
]
1082+
}
1083+
10621084
fn write_hbase_env_sh<'a, T>(properties: T) -> String
10631085
where
10641086
T: Iterator<Item = (&'a String, &'a String)>,

0 commit comments

Comments
 (0)