Skip to content

Commit 4122baf

Browse files
committed
merge main and fix conflicts
2 parents 4ceb588 + 0664d80 commit 4122baf

File tree

10 files changed

+105
-150
lines changed

10 files changed

+105
-150
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
- test: ZooKeeper 3.9.2 removed ([#654]).
3939
- test: Remove HDFS `3.3.4`, `3.3.6`, and `3.4.0` ([#655]).
4040
- test: HBase 2.4.18 removed ([#659]):
41+
- Remove operator support for HBase 2.4 including the JMX exporter ([#672]).
4142

4243
[#639]: https://github.com/stackabletech/hbase-operator/pull/639
4344
[#640]: https://github.com/stackabletech/hbase-operator/pull/640
@@ -51,6 +52,7 @@
5152
[#659]: https://github.com/stackabletech/hbase-operator/pull/659
5253
[#660]: https://github.com/stackabletech/hbase-operator/pull/660
5354
[#661]: https://github.com/stackabletech/hbase-operator/pull/661
55+
[#672]: https://github.com/stackabletech/hbase-operator/pull/672
5456

5557
## [25.3.0] - 2025-03-21
5658

docs/modules/hbase/pages/usage-guide/monitoring.adoc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,3 @@ Starting with HBase 2.6 the URL for Prometheus metrics has changed.
88
This is because HBase offers now a built-in endpoint for this purpose.
99
This endpoint is available from the UI service.
1010
For example, in the case of the master service, the URL is `http://<master-service>:16010/prometheus`.
11-
The old URL `http://<master-service>:9100` is still available for HBase 2.4.

rust/operator-binary/src/config/jvm.rs

Lines changed: 9 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ use stackable_operator::{
55
};
66

77
use crate::crd::{
8-
AnyServiceConfig, CONFIG_DIR_NAME, HbaseRole, JVM_SECURITY_PROPERTIES_FILE, METRICS_PORT,
9-
v1alpha1,
8+
AnyServiceConfig, CONFIG_DIR_NAME, HbaseRole, JVM_SECURITY_PROPERTIES_FILE, v1alpha1,
109
};
1110

1211
const JAVA_HEAP_FACTOR: f32 = 0.8;
@@ -53,18 +52,11 @@ pub fn construct_role_specific_non_heap_jvm_args(
5352
hbase: &v1alpha1::HbaseCluster,
5453
hbase_role: &HbaseRole,
5554
role_group: &str,
56-
product_version: &str,
5755
) -> Result<String, Error> {
5856
let mut jvm_args = vec![format!(
5957
"-Djava.security.properties={CONFIG_DIR_NAME}/{JVM_SECURITY_PROPERTIES_FILE}"
6058
)];
6159

62-
// Starting with HBase 2.6 the JVM exporter is not needed anymore
63-
if product_version.starts_with("2.4") || product_version.starts_with("2.5") {
64-
jvm_args.push(
65-
format!("-javaagent:/stackable/jmx/jmx_prometheus_javaagent.jar={METRICS_PORT}:/stackable/jmx/{hbase_role}.yaml")
66-
);
67-
}
6860
if hbase.has_kerberos_enabled() {
6961
jvm_args.push("-Djava.security.krb5.conf=/stackable/kerberos/krb5.conf".to_owned());
7062
}
@@ -168,17 +160,11 @@ mod tests {
168160
default:
169161
replicas: 1
170162
"#;
171-
let (hbase, hbase_role, merged_config, role_group, product_version) =
172-
construct_boilerplate(input);
163+
let (hbase, hbase_role, merged_config, role_group) = construct_boilerplate(input);
173164

174165
let global_jvm_args = construct_global_jvm_args(false);
175-
let role_specific_non_heap_jvm_args = construct_role_specific_non_heap_jvm_args(
176-
&hbase,
177-
&hbase_role,
178-
&role_group,
179-
&product_version,
180-
)
181-
.unwrap();
166+
let role_specific_non_heap_jvm_args =
167+
construct_role_specific_non_heap_jvm_args(&hbase, &hbase_role, &role_group).unwrap();
182168
let hbase_heapsize_env = construct_hbase_heapsize_env(&merged_config).unwrap();
183169

184170
assert_eq!(global_jvm_args, "");
@@ -230,17 +216,11 @@ mod tests {
230216
- -Xmx40000m # This has no effect!
231217
- -Dhttps.proxyPort=1234
232218
"#;
233-
let (hbase, hbase_role, merged_config, role_group, product_version) =
234-
construct_boilerplate(input);
219+
let (hbase, hbase_role, merged_config, role_group) = construct_boilerplate(input);
235220

236221
let global_jvm_args = construct_global_jvm_args(hbase.has_kerberos_enabled());
237-
let role_specific_non_heap_jvm_args = construct_role_specific_non_heap_jvm_args(
238-
&hbase,
239-
&hbase_role,
240-
&role_group,
241-
&product_version,
242-
)
243-
.unwrap();
222+
let role_specific_non_heap_jvm_args =
223+
construct_role_specific_non_heap_jvm_args(&hbase, &hbase_role, &role_group).unwrap();
244224
let hbase_heapsize_env = construct_hbase_heapsize_env(&merged_config).unwrap();
245225

246226
assert_eq!(
@@ -260,28 +240,15 @@ mod tests {
260240

261241
fn construct_boilerplate(
262242
hbase_cluster: &str,
263-
) -> (
264-
v1alpha1::HbaseCluster,
265-
HbaseRole,
266-
AnyServiceConfig,
267-
String,
268-
String,
269-
) {
243+
) -> (v1alpha1::HbaseCluster, HbaseRole, AnyServiceConfig, String) {
270244
let hbase: v1alpha1::HbaseCluster =
271245
serde_yaml::from_str(hbase_cluster).expect("illegal test input");
272246

273247
let hbase_role = HbaseRole::RegionServer;
274248
let merged_config = hbase
275249
.merged_config(&hbase_role, "default", "my-hdfs")
276250
.unwrap();
277-
let product_version = hbase.spec.image.product_version().to_owned();
278251

279-
(
280-
hbase,
281-
hbase_role,
282-
merged_config,
283-
"default".to_owned(),
284-
product_version,
285-
)
252+
(hbase, hbase_role, merged_config, "default".to_owned())
286253
}
287254
}

rust/operator-binary/src/crd/mod.rs

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ pub const HBASE_UI_PORT_NAME_HTTP: &str = "ui-http";
6464
pub const HBASE_UI_PORT_NAME_HTTPS: &str = "ui-https";
6565
pub const HBASE_REST_PORT_NAME_HTTP: &str = "rest-http";
6666
pub const HBASE_REST_PORT_NAME_HTTPS: &str = "rest-https";
67-
pub const METRICS_PORT_NAME: &str = "metrics";
6867

6968
pub const HBASE_MASTER_PORT: u16 = 16000;
7069
// HBase always uses 16010, regardless of http or https. On 2024-01-17 we decided in Arch-meeting that we want to stick
@@ -75,9 +74,6 @@ pub const HBASE_REGIONSERVER_PORT: u16 = 16020;
7574
pub const HBASE_REGIONSERVER_UI_PORT: u16 = 16030;
7675
pub const HBASE_REST_PORT: u16 = 8080;
7776
pub const HBASE_REST_UI_PORT: u16 = 8085;
78-
// This port is only used by Hbase prior to version 2.6 with a third-party JMX exporter.
79-
// Newer versions use the same port as the UI because Hbase provides it's own metrics API
80-
pub const METRICS_PORT: u16 = 9100;
8177
pub const LISTENER_VOLUME_NAME: &str = "listener";
8278
pub const LISTENER_VOLUME_DIR: &str = "/stackable/listener";
8379

@@ -496,11 +492,10 @@ impl v1alpha1::HbaseCluster {
496492
}
497493

498494
/// Returns required port name and port number tuples depending on the role.
499-
/// Hbase versions 2.4.* will have three ports for each role
500495
/// Hbase versions 2.6.* will have two ports for each role. The metrics are available over the
501496
/// UI port.
502-
pub fn ports(&self, role: &HbaseRole, hbase_version: &str) -> Vec<(String, u16)> {
503-
let result_without_metric_port: Vec<(String, u16)> = match role {
497+
pub fn ports(&self, role: &HbaseRole) -> Vec<(String, u16)> {
498+
match role {
504499
HbaseRole::Master => vec![
505500
("master".to_string(), HBASE_MASTER_PORT),
506501
(self.ui_port_name(), HBASE_MASTER_UI_PORT),
@@ -521,14 +516,6 @@ impl v1alpha1::HbaseCluster {
521516
),
522517
(self.ui_port_name(), HBASE_REST_UI_PORT),
523518
],
524-
};
525-
if hbase_version.starts_with(r"2.4") {
526-
result_without_metric_port
527-
.into_iter()
528-
.chain(vec![(METRICS_PORT_NAME.to_string(), METRICS_PORT)])
529-
.collect()
530-
} else {
531-
result_without_metric_port
532519
}
533520
}
534521

@@ -944,7 +931,7 @@ impl Configuration for HbaseConfigFragment {
944931
HBASE_ENV_SH => {
945932
// The contents of this file cannot be built entirely here because we don't have
946933
// access to the clusterConfig or product version.
947-
// These are needed to set up Kerberos and JMX exporter settings.
934+
// These are needed to set up Kerberos.
948935
// To avoid fragmentation of the code needed to build this file, we moved the
949936
// implementation to the hbase_controller::build_hbase_env_sh() function.
950937
}
@@ -1094,7 +1081,7 @@ impl Configuration for RegionServerConfigFragment {
10941081
HBASE_ENV_SH => {
10951082
// The contents of this file cannot be built entirely here because we don't have
10961083
// access to the clusterConfig or product version.
1097-
// These are needed to set up Kerberos and JMX exporter settings.
1084+
// These are needed to set up Kerberos.
10981085
// To avoid fragmentation of the code needed to build this file, we moved the
10991086
// implementation to the hbase_controller::build_hbase_env_sh() function.
11001087
}

rust/operator-binary/src/hbase_controller.rs

Lines changed: 10 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,6 @@ pub async fn reconcile_hbase(
355355

356356
let client = &ctx.client;
357357

358-
validate_cr(hbase)?;
359-
360358
let resolved_product_image = hbase
361359
.spec
362360
.image
@@ -630,13 +628,8 @@ fn build_rolegroup_config_map(
630628
);
631629
}
632630
PropertyNameKind::File(file_name) if file_name == HBASE_ENV_SH => {
633-
let mut hbase_env_config = build_hbase_env_sh(
634-
hbase,
635-
merged_config,
636-
&hbase_role,
637-
&rolegroup.role_group,
638-
&resolved_product_image.product_version,
639-
)?;
631+
let mut hbase_env_config =
632+
build_hbase_env_sh(hbase, merged_config, &hbase_role, &rolegroup.role_group)?;
640633

641634
// configOverride come last
642635
hbase_env_config.extend(config.clone());
@@ -720,15 +713,11 @@ fn build_rolegroup_config_map(
720713
builder.add_data(SSL_CLIENT_XML, ssl_client_xml);
721714
}
722715

723-
extend_role_group_config_map(
724-
rolegroup,
725-
merged_config.logging(),
726-
&mut builder,
727-
&resolved_product_image.product_version,
728-
)
729-
.context(InvalidLoggingConfigSnafu {
730-
cm_name: rolegroup.object_name(),
731-
})?;
716+
extend_role_group_config_map(rolegroup, merged_config.logging(), &mut builder).context(
717+
InvalidLoggingConfigSnafu {
718+
cm_name: rolegroup.object_name(),
719+
},
720+
)?;
732721

733722
builder.build().map_err(|e| Error::BuildRoleGroupConfig {
734723
source: e,
@@ -746,7 +735,7 @@ fn build_rolegroup_service(
746735
resolved_product_image: &ResolvedProductImage,
747736
) -> Result<Service> {
748737
let ports = hbase
749-
.ports(hbase_role, &resolved_product_image.product_version)
738+
.ports(hbase_role)
750739
.into_iter()
751740
.map(|(name, value)| ServicePort {
752741
name: Some(name),
@@ -811,7 +800,7 @@ fn build_rolegroup_statefulset(
811800
let hbase_version = &resolved_product_image.app_version_label;
812801

813802
let ports = hbase
814-
.ports(hbase_role, &resolved_product_image.product_version)
803+
.ports(hbase_role)
815804
.into_iter()
816805
.map(|(name, value)| ContainerPort {
817806
name: Some(name),
@@ -1172,7 +1161,6 @@ fn build_hbase_env_sh(
11721161
merged_config: &AnyServiceConfig,
11731162
hbase_role: &HbaseRole,
11741163
role_group: &str,
1175-
product_version: &str,
11761164
) -> Result<BTreeMap<String, String>, Error> {
11771165
let mut result = BTreeMap::new();
11781166

@@ -1187,7 +1175,7 @@ fn build_hbase_env_sh(
11871175
construct_global_jvm_args(hbase.has_kerberos_enabled()),
11881176
);
11891177
let role_specific_non_heap_jvm_args =
1190-
construct_role_specific_non_heap_jvm_args(hbase, hbase_role, role_group, product_version)
1178+
construct_role_specific_non_heap_jvm_args(hbase, hbase_role, role_group)
11911179
.context(ConstructJvmArgumentSnafu)?;
11921180

11931181
match hbase_role {
@@ -1214,24 +1202,6 @@ fn build_hbase_env_sh(
12141202
Ok(result)
12151203
}
12161204

1217-
/// Ensures that no authorization is configured for HBase versions that do not support it.
1218-
/// In the future, such validations should be moved to the CRD CEL rules which are much more flexible
1219-
/// and have to added benefit that invalid CRs are rejected by the API server.
1220-
/// A requirement for this is that the minimum supported Kubernetes version is 1.29.
1221-
fn validate_cr(hbase: &v1alpha1::HbaseCluster) -> Result<()> {
1222-
tracing::info!("Begin CR validation");
1223-
1224-
let hbase_version = hbase.spec.image.product_version();
1225-
let authorization = hbase.spec.cluster_config.authorization.is_some();
1226-
1227-
if hbase_version.starts_with("2.4") && authorization {
1228-
tracing::error!("Invalid custom resource");
1229-
return Err(Error::AuthorizationNotSupported);
1230-
}
1231-
tracing::info!("End CR validation");
1232-
Ok(())
1233-
}
1234-
12351205
#[cfg(test)]
12361206
mod test {
12371207
use rstest::rstest;

rust/operator-binary/src/product_logging.rs

Lines changed: 12 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ pub enum Error {
4343
type Result<T, E = Error> = std::result::Result<T, E>;
4444

4545
const CONSOLE_CONVERSION_PATTERN: &str = "%d{ISO8601} %-5p [%t] %c{2}: %.1000m%n";
46-
const HBASE_LOG4J_FILE: &str = "hbase.log4j.xml";
4746
const HBASE_LOG4J2_FILE: &str = "hbase.log4j2.xml";
48-
pub const LOG4J_CONFIG_FILE: &str = "log4j.properties";
4947
pub const LOG4J2_CONFIG_FILE: &str = "log4j2.properties";
5048
pub const STACKABLE_LOG_DIR: &str = "/stackable/log";
5149
pub static CONTAINERDEBUG_LOG_DIRECTORY: std::sync::LazyLock<String> =
@@ -56,16 +54,12 @@ pub fn extend_role_group_config_map(
5654
rolegroup: &RoleGroupRef<v1alpha1::HbaseCluster>,
5755
logging: &Logging<Container>,
5856
cm_builder: &mut ConfigMapBuilder,
59-
hbase_version: &str,
6057
) -> Result<()> {
6158
if let Some(ContainerLogConfig {
6259
choice: Some(ContainerLogConfigChoice::Automatic(log_config)),
6360
}) = logging.containers.get(&Container::Hbase)
6461
{
65-
cm_builder.add_data(
66-
log4j_properties_file_name(hbase_version),
67-
log4j_config(hbase_version, log_config),
68-
);
62+
cm_builder.add_data(LOG4J2_CONFIG_FILE, log4j_config(log_config));
6963
}
7064

7165
let vector_log_config = if let Some(ContainerLogConfig {
@@ -87,41 +81,15 @@ pub fn extend_role_group_config_map(
8781
Ok(())
8882
}
8983

90-
pub fn log4j_properties_file_name(hbase_version: &str) -> &'static str {
91-
if needs_log4j2(hbase_version) {
92-
LOG4J2_CONFIG_FILE
93-
} else {
94-
LOG4J_CONFIG_FILE
95-
}
96-
}
97-
98-
fn log4j_config(hbase_version: &str, log_config: &AutomaticContainerLogConfig) -> String {
99-
if needs_log4j2(hbase_version) {
100-
product_logging::framework::create_log4j2_config(
101-
&format!("{STACKABLE_LOG_DIR}/hbase"),
102-
HBASE_LOG4J2_FILE,
103-
MAX_HBASE_LOG_FILES_SIZE
104-
.scale_to(BinaryMultiple::Mebi)
105-
.floor()
106-
.value as u32,
107-
CONSOLE_CONVERSION_PATTERN,
108-
log_config,
109-
)
110-
} else {
111-
product_logging::framework::create_log4j_config(
112-
&format!("{STACKABLE_LOG_DIR}/hbase"),
113-
HBASE_LOG4J_FILE,
114-
MAX_HBASE_LOG_FILES_SIZE
115-
.scale_to(BinaryMultiple::Mebi)
116-
.floor()
117-
.value as u32,
118-
CONSOLE_CONVERSION_PATTERN,
119-
log_config,
120-
)
121-
}
122-
}
123-
124-
// HBase 2.6 moved from log4j to log4j2
125-
fn needs_log4j2(hbase_version: &str) -> bool {
126-
!hbase_version.starts_with(r"2.4")
84+
fn log4j_config(log_config: &AutomaticContainerLogConfig) -> String {
85+
product_logging::framework::create_log4j2_config(
86+
&format!("{STACKABLE_LOG_DIR}/hbase"),
87+
HBASE_LOG4J2_FILE,
88+
MAX_HBASE_LOG_FILES_SIZE
89+
.scale_to(BinaryMultiple::Mebi)
90+
.floor()
91+
.value as u32,
92+
CONSOLE_CONVERSION_PATTERN,
93+
log_config,
94+
)
12795
}

tests/templates/kuttl/opa/30-install-hbase.yaml.j2

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ commands:
2828
appender.console.name = STDOUT
2929
appender.console.layout.type = PatternLayout
3030
appender.console.layout.pattern = [%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n
31-
log4j.properties: |
32-
# Used by HBase 2.4
33-
log4j.rootLogger=INFO, FILE
34-
log4j.appender.FILE=org.apache.log4j.FileAppender
35-
log4j.appender.FILE.File=/stackable/log/hbase/hbase.log4j.xml
36-
log4j.appender.FILE.layout=org.apache.log4j.xml.XMLLayout
3731
---
3832
apiVersion: hbase.stackable.tech/v1alpha1
3933
kind: HbaseCluster

tests/templates/kuttl/smoke/50-assert.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ metadata:
55
name: test-hbase
66
commands:
77
- script: kubectl exec --namespace=$NAMESPACE hbase-test-runner-0 -- python /tmp/test-hbase.py http://test-hbase-restserver-default-metrics:8080
8+
- script: kubectl exec --namespace=$NAMESPACE hbase-test-runner-0 -- python /tmp/test_prometheus_metrics.py $NAMESPACE
89
timeout: 240

tests/templates/kuttl/smoke/50-test-hbase.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ apiVersion: kuttl.dev/v1beta1
33
kind: TestStep
44
commands:
55
- script: kubectl cp --namespace=$NAMESPACE ./test-hbase.py hbase-test-runner-0:/tmp
6+
- script: kubectl cp --namespace=$NAMESPACE ./test_prometheus_metrics.py hbase-test-runner-0:/tmp

0 commit comments

Comments
 (0)