Skip to content

Commit 1027e54

Browse files
committed
fix: move product logging to build step
1 parent 1cd0401 commit 1027e54

5 files changed

Lines changed: 13 additions & 10 deletions

File tree

rust/operator-binary/src/controller/build/config_map.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ use stackable_operator::{
1010
use crate::{
1111
config::writer::PropertiesWriterError,
1212
controller::build::properties::{
13-
ConfigFileName, hbase_env, hbase_site, security_properties, ssl_client, ssl_server,
13+
ConfigFileName, hbase_env, hbase_site, logging::extend_role_group_config_map,
14+
security_properties, ssl_client, ssl_server,
1415
},
1516
crd::{HbaseRole, v1alpha1},
1617
hbase_controller::{ValidatedCluster, build_recommended_labels},
17-
product_logging::extend_role_group_config_map,
1818
};
1919

2020
#[derive(Snafu, Debug)]

rust/operator-binary/src/product_logging.rs renamed to rust/operator-binary/src/controller/build/properties/logging.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,13 @@ use stackable_operator::{
1111
};
1212

1313
use crate::{
14+
controller::build::properties::ConfigFileName,
1415
crd::{Container, v1alpha1},
15-
hbase_controller::MAX_HBASE_LOG_FILES_SIZE,
16+
hbase_controller::{MAX_HBASE_LOG_FILES_SIZE, STACKABLE_LOG_DIR},
1617
};
1718

1819
const CONSOLE_CONVERSION_PATTERN: &str = "%d{ISO8601} %-5p [%t] %c{2}: %.1000m%n";
1920
const HBASE_LOG4J2_FILE: &str = "hbase.log4j2.xml";
20-
pub const LOG4J2_CONFIG_FILE: &str = "log4j2.properties";
21-
pub const STACKABLE_LOG_DIR: &str = "/stackable/log";
22-
pub static CONTAINERDEBUG_LOG_DIRECTORY: std::sync::LazyLock<String> =
23-
std::sync::LazyLock::new(|| format!("{STACKABLE_LOG_DIR}/containerdebug"));
2421

2522
/// Extend the role group ConfigMap with logging and Vector configurations
2623
pub fn extend_role_group_config_map(
@@ -32,7 +29,7 @@ pub fn extend_role_group_config_map(
3229
choice: Some(ContainerLogConfigChoice::Automatic(log_config)),
3330
}) = logging.containers.get(&Container::Hbase)
3431
{
35-
cm_builder.add_data(LOG4J2_CONFIG_FILE, log4j_config(log_config));
32+
cm_builder.add_data(ConfigFileName::Log4j2.to_string(), log4j_config(log_config));
3633
}
3734

3835
let vector_log_config = if let Some(ContainerLogConfig {

rust/operator-binary/src/controller/build/properties/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use stackable_operator::v2::config_overrides::KeyValueConfigOverrides;
99

1010
pub mod hbase_env;
1111
pub mod hbase_site;
12+
pub mod logging;
1213
pub mod security_properties;
1314
pub mod ssl_client;
1415
pub mod ssl_server;
@@ -43,6 +44,8 @@ pub enum ConfigFileName {
4344
SslClient,
4445
#[strum(serialize = "security.properties")]
4546
Security,
47+
#[strum(serialize = "log4j2.properties")]
48+
Log4j2,
4649
}
4750

4851
#[cfg(test)]
@@ -56,6 +59,7 @@ mod tests {
5659
assert_eq!(ConfigFileName::SslServer.to_string(), "ssl-server.xml");
5760
assert_eq!(ConfigFileName::SslClient.to_string(), "ssl-client.xml");
5861
assert_eq!(ConfigFileName::Security.to_string(), "security.properties");
62+
assert_eq!(ConfigFileName::Log4j2.to_string(), "log4j2.properties");
5963
}
6064
}
6165

rust/operator-binary/src/hbase_controller.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ use crate::{
6363
},
6464
kerberos::{self, add_kerberos_pod_config},
6565
operations::{graceful_shutdown::add_graceful_shutdown_config, pdb::add_pdbs},
66-
product_logging::{CONTAINERDEBUG_LOG_DIRECTORY, STACKABLE_LOG_DIR},
6766
security::opa::HbaseOpaConfig,
6867
zookeeper::ZookeeperConnectionInformation,
6968
};
@@ -75,6 +74,10 @@ pub const MAX_HBASE_LOG_FILES_SIZE: MemoryQuantity = MemoryQuantity {
7574
unit: BinaryMultiple::Mebi,
7675
};
7776

77+
pub const STACKABLE_LOG_DIR: &str = "/stackable/log";
78+
pub static CONTAINERDEBUG_LOG_DIRECTORY: std::sync::LazyLock<String> =
79+
std::sync::LazyLock::new(|| format!("{STACKABLE_LOG_DIR}/containerdebug"));
80+
7881
// These constants are hard coded in hbase-entrypoint.sh
7982
// You need to change them there too.
8083
const HDFS_DISCOVERY_TMP_DIR: &str = "/stackable/tmp/hdfs";

rust/operator-binary/src/main.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ mod crd;
4343
mod hbase_controller;
4444
mod kerberos;
4545
mod operations;
46-
mod product_logging;
4746
mod security;
4847
mod webhooks;
4948
mod zookeeper;

0 commit comments

Comments
 (0)