Skip to content

Commit

Permalink
fix: Vector graceful shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
sbernauer committed Oct 27, 2023
1 parent 691c836 commit 49463e9
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 28 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,5 @@ strum = { version = "0.25", features = ["derive"] }
tokio = { version = "1.29", features = ["full"] }
tracing = "0.1"

# [patch."https://github.com/stackabletech/operator-rs.git"]
# stackable-operator = { git = "https://github.com/stackabletech//operator-rs.git", branch = "main" }
[patch."https://github.com/stackabletech/operator-rs.git"]
stackable-operator = { git = "https://github.com/stackabletech//operator-rs.git", branch = "docs/vector-process" }
55 changes: 31 additions & 24 deletions rust/operator-binary/src/hbase_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ use stackable_operator::{
product_image_selection::ResolvedProductImage,
rbac::{build_rbac_resources, service_account_name},
},
k8s_openapi::{api::core::v1::Volume, DeepMerge},
k8s_openapi::{
api::{
apps::v1::{StatefulSet, StatefulSetSpec},
core::v1::{
ConfigMap, ConfigMapVolumeSource, ContainerPort, HTTPGetAction, Probe, Service,
ServicePort, ServiceSpec, TCPSocketAction,
ServicePort, ServiceSpec, TCPSocketAction, Volume,
},
},
apimachinery::pkg::{apis::meta::v1::LabelSelector, util::intstr::IntOrString},
DeepMerge,
},
kube::{runtime::controller::Action, Resource},
labels::{role_group_selector_labels, role_selector_labels, ObjectLabels},
Expand All @@ -50,6 +50,7 @@ use stackable_operator::{
product_config_utils::{transform_all_roles_to_config, validate_all_roles_and_groups_config},
product_logging::{
self,
framework::{create_vector_shutdown_file_command, remove_vector_shutdown_file_command},
spec::{
ConfigMapLogConfig, ContainerLogConfig, ContainerLogConfigChoice,
CustomContainerLogConfig,
Expand All @@ -61,6 +62,7 @@ use stackable_operator::{
statefulset::StatefulSetConditionBuilder,
},
time::Duration,
utils::COMMON_BASH_TRAP_FUNCTIONS,
};
use std::{
collections::{BTreeMap, HashMap},
Expand Down Expand Up @@ -679,28 +681,33 @@ fn build_rolegroup_statefulset(
"pipefail".to_string(),
"-c".to_string(),
])
.args(vec![[
format!("mkdir -p {}", CONFIG_DIR_NAME),
format!(
"cp {}/hdfs-site.xml {}",
HDFS_DISCOVERY_TMP_DIR, CONFIG_DIR_NAME
),
format!(
"cp {}/core-site.xml {}",
HDFS_DISCOVERY_TMP_DIR, CONFIG_DIR_NAME
),
format!("cp {}/* {}", HBASE_CONFIG_TMP_DIR, CONFIG_DIR_NAME),
format!("cp {HBASE_LOG_CONFIG_TMP_DIR}/{LOG4J_CONFIG_FILE} {CONFIG_DIR_NAME}",),
format!(
"bin/hbase {} start",
match hbase_role {
HbaseRole::Master => "master",
HbaseRole::RegionServer => "regionserver",
HbaseRole::RestServer => "rest",
}
),
]
.join(" && ")])
.args(vec![format!(
"\
mkdir -p {CONFIG_DIR_NAME}
cp {HDFS_DISCOVERY_TMP_DIR}/hdfs-site.xml {CONFIG_DIR_NAME}
cp {HDFS_DISCOVERY_TMP_DIR}/core-site.xml {CONFIG_DIR_NAME}
cp {HBASE_CONFIG_TMP_DIR}/* {CONFIG_DIR_NAME}
cp {HBASE_LOG_CONFIG_TMP_DIR}/{LOG4J_CONFIG_FILE} {CONFIG_DIR_NAME}
{COMMON_BASH_TRAP_FUNCTIONS}
{remove_vector_shutdown_file_command}
prepare_signal_handlers
bin/hbase {hbase_role_name_in_command} start &
wait_for_termination
{create_vector_shutdown_file_command}
",
hbase_role_name_in_command = match hbase_role {
HbaseRole::Master => "master",
HbaseRole::RegionServer => "regionserver",
// Of course it is not called "restserver", so we need to have this match
// instead of just letting the Display impl do it's thing ;P
HbaseRole::RestServer => "rest",
},
remove_vector_shutdown_file_command =
remove_vector_shutdown_file_command(STACKABLE_LOG_DIR),
create_vector_shutdown_file_command =
create_vector_shutdown_file_command(STACKABLE_LOG_DIR),
)])
.add_env_var("HBASE_CONF_DIR", CONFIG_DIR_NAME)
// required by phoenix (for cases where Kerberos is enabled): see https://issues.apache.org/jira/browse/PHOENIX-2369
.add_env_var("HADOOP_CONF_DIR", CONFIG_DIR_NAME)
Expand Down

0 comments on commit 49463e9

Please sign in to comment.