Skip to content

Commit c8a2644

Browse files
committed
wip: will move startup logic to hbase-entrypoint.sh
1 parent 652999e commit c8a2644

File tree

1 file changed

+53
-6
lines changed

1 file changed

+53
-6
lines changed

rust/operator-binary/src/hbase_controller.rs

Lines changed: 53 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,39 @@ fn build_rolegroup_config_map(
584584
hbase_site_config
585585
.extend(hbase_opa_config.map_or(vec![], |config| config.hbase_site_config()));
586586

587+
match hbase_role {
588+
HbaseRole::Master => {
589+
hbase_site_config.insert(
590+
"hbase.master.hostname".to_string(),
591+
"${HBASE_SERVICE_HOST}".to_string(),
592+
);
593+
hbase_site_config.insert(
594+
"hbase.master.port".to_string(),
595+
"${HBASE_SERVICE_PORT}".to_string(),
596+
)
597+
}
598+
HbaseRole::RegionServer => {
599+
hbase_site_config.insert(
600+
"hbase.regionserver.hostname".to_string(),
601+
"${HBASE_SERVICE_HOST}".to_string(),
602+
);
603+
hbase_site_config.insert(
604+
"hbase.regionserver.port".to_string(),
605+
"${HBASE_SERVICE_PORT}".to_string(),
606+
)
607+
}
608+
HbaseRole::RestServer => {
609+
hbase_site_config.insert(
610+
"hbase.rest.hostname".to_string(),
611+
"${HBASE_SERVICE_HOST}".to_string(),
612+
);
613+
hbase_site_config.insert(
614+
"hbase.rest.port".to_string(),
615+
"${HBASE_SERVICE_PORT}".to_string(),
616+
)
617+
}
618+
};
619+
587620
// configOverride come last
588621
hbase_site_config.extend(config.clone());
589622
hbase_site_xml = to_hadoop_xml(
@@ -868,7 +901,15 @@ fn build_rolegroup_statefulset(
868901
.image_from_product_image(resolved_product_image)
869902
.command(command())
870903
.args(vec![formatdoc! {"
904+
{wait}
905+
{list}
906+
{update_host}
907+
{update_port}
871908
{entrypoint} {role} {domain} {port}",
909+
wait = "until [ -f /stackable/conf/hbase-site.xml ]; do sleep 1; done;".to_string(),
910+
list = "ls -al /stackable/conf/hbase-site.xml".to_string(),
911+
update_host = "sed -i 's|\\${HBASE_SERVICE_HOST}|${HBASE_SERVICE_HOST}|g' /stackable/conf/hbase-site.xml".to_string(),
912+
update_port = "sed -i 's|\\${HBASE_SERVICE_PORT}|${HBASE_SERVICE_PORT}|g' /stackable/conf/hbase-site.xml".to_string(),
872913
entrypoint = "/stackable/hbase/bin/hbase-entrypoint.sh".to_string(),
873914
role = role_name,
874915
domain = hbase_service_domain_name(hbase, rolegroup_ref, cluster_info)?,
@@ -1137,21 +1178,27 @@ fn build_hbase_env_sh(
11371178
construct_role_specific_non_heap_jvm_args(hbase, hbase_role, role_group, product_version)
11381179
.context(ConstructJvmArgumentSnafu)?;
11391180
let port_name = &hbase.ui_port_name();
1181+
1182+
result.insert(
1183+
"HBASE_SERVICE_HOST".to_owned(),
1184+
format!("$(cat {LISTENER_VOLUME_DIR}/default-address/address)"),
1185+
);
1186+
result.insert(
1187+
"HBASE_SERVICE_PORT".to_owned(),
1188+
format!("$(cat {LISTENER_VOLUME_DIR}/default-address/ports/{port_name})"),
1189+
);
1190+
11401191
match hbase_role {
11411192
HbaseRole::Master => {
11421193
result.insert(
11431194
"HBASE_MASTER_OPTS".to_string(),
1144-
format!(
1145-
"{role_specific_non_heap_jvm_args} -Dhbase.master.hostname=$(cat {LISTENER_VOLUME_DIR}/default-address/address) -Dhbase.master.port=$(cat {LISTENER_VOLUME_DIR}/default-address/ports/{port_name})"
1146-
)
1195+
role_specific_non_heap_jvm_args,
11471196
);
11481197
}
11491198
HbaseRole::RegionServer => {
11501199
result.insert(
11511200
"HBASE_REGIONSERVER_OPTS".to_string(),
1152-
format!(
1153-
"{role_specific_non_heap_jvm_args} -Dhbase.regionserver.hostname=$(cat {LISTENER_VOLUME_DIR}/default-address/address) -Dhbase.regionserver.port=$(cat {LISTENER_VOLUME_DIR}/default-address/ports/{port_name})"
1154-
)
1201+
role_specific_non_heap_jvm_args,
11551202
);
11561203
}
11571204
HbaseRole::RestServer => {

0 commit comments

Comments
 (0)