Skip to content

Commit 62bb979

Browse files
authored
feat!: Support configuring JVM arguments (#620)
* feat!: Support configuring JVM arguments * changelog * Remove commented out code * Improve docs * rustdoc * Make version detection more robust
1 parent 8f1bc4e commit 62bb979

File tree

10 files changed

+558
-126
lines changed

10 files changed

+558
-126
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
config property `requestedSecretLifetime`. This helps reducing frequent Pod restarts ([#598]).
99
- Run a `containerdebug` process in the background of each HBase container to collect debugging information ([#605]).
1010
- Aggregate emitted Kubernetes events on the CustomResources ([#612]).
11+
- Support configuring JVM arguments ([#620]).
12+
13+
### Removed
14+
15+
- BREAKING: The field `config.hbaseOpts` has been removed. Use JVM argument overrides instead to configure additional JVM arguments ([#620]).
1116

1217
### Changed
1318

@@ -17,6 +22,7 @@
1722
[#605]: https://github.com/stackabletech/hbase-operator/pull/605
1823
[#611]: https://github.com/stackabletech/hbase-operator/pull/611
1924
[#612]: https://github.com/stackabletech/hbase-operator/pull/612
25+
[#620]: https://github.com/stackabletech/hbase-operator/pull/620
2026

2127
## [24.11.1] - 2025-01-09
2228

deploy/helm/hbase-operator/crds/crds.yaml

Lines changed: 156 additions & 18 deletions
Large diffs are not rendered by default.

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,21 @@ The HBaseCluster Stacklet does not support environment variable overrides with t
9595

9696
The HBase Stacklet and operator also support Pod overrides, allowing you to override any property that you can set on a Kubernetes Pod.
9797
Read the xref:concepts:overrides.adoc#pod-overrides[Pod overrides documentation] to learn more about this feature.
98+
99+
== JVM argument overrides
100+
101+
Stackable operators automatically determine the set of needed JVM arguments, such as memory settings or trust- and keystores.
102+
Using JVM argument overrides you can configure the JVM arguments xref:concepts:overrides.adoc#jvm-argument-overrides[according to the concepts page].
103+
104+
One thing that is different for Kafka, is that all heap-related arguments will be passed in via the env variable `HBASE_HEAPSIZE`, all the other ones via `HBASE_OPTS`, `HBASE_MASTER_OPTS`, `HBASE_REGIONSERVER_OPTS` and `HBASE_REST_OPTS`.
105+
The `HBASE_HEAPSIZE` variable is documented as follows in the https://cwiki.apache.org/confluence/display/HADOOP2/Hbase+FAQ+Operations[HBase FAQs]:
106+
107+
> Set the HBASE_HEAPSIZE environment variable in ${HBASE_HOME}/conf/hbase-env.sh if your install needs to run with a larger heap.
108+
> HBASE_HEAPSIZE is like HADOOP_HEAPSIZE in that its value is the desired heap size in MB.
109+
> The surrounding '-Xmx' and 'm' needed to make up the maximum heap size java option are added by the hbase start script
110+
> (See how HBASE_HEAPSIZE is used in the ${HBASE_HOME}/bin/hbase script for clarification).
111+
112+
Looking at `bin/hbase`, you can actually add the `m` suffix to make the unit more clear, the script will detect this https://github.com/apache/hbase/blob/777010361abb203b8b17673d84acf4f7f1d0283a/bin/hbase#L165[here] and work correctly.
113+
114+
Because of this, it is not possible to change `-XmS` and `-XmX` via JVM argument overrides.
115+
You need to envOverride `HBASE_HEAPSIZE` instead.

rust/crd/src/lib.rs

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ use stackable_operator::{
2121
kube::{runtime::reflector::ObjectRef, CustomResource, ResourceExt},
2222
product_config_utils::Configuration,
2323
product_logging::{self, spec::Logging},
24-
role_utils::{
25-
GenericProductSpecificCommonConfig, GenericRoleConfig, Role, RoleGroup, RoleGroupRef,
26-
},
24+
role_utils::{GenericRoleConfig, JavaCommonConfig, Role, RoleGroup, RoleGroupRef},
2725
schemars::{self, JsonSchema},
2826
status::condition::{ClusterCondition, HasStatusCondition},
2927
time::Duration,
@@ -51,16 +49,10 @@ pub const HBASE_SITE_XML: &str = "hbase-site.xml";
5149
pub const SSL_SERVER_XML: &str = "ssl-server.xml";
5250
pub const SSL_CLIENT_XML: &str = "ssl-client.xml";
5351

54-
pub const HBASE_MANAGES_ZK: &str = "HBASE_MANAGES_ZK";
55-
pub const HBASE_MASTER_OPTS: &str = "HBASE_MASTER_OPTS";
56-
pub const HBASE_REGIONSERVER_OPTS: &str = "HBASE_REGIONSERVER_OPTS";
57-
pub const HBASE_REST_OPTS: &str = "HBASE_REST_OPTS";
58-
5952
pub const HBASE_CLUSTER_DISTRIBUTED: &str = "hbase.cluster.distributed";
6053
pub const HBASE_ROOTDIR: &str = "hbase.rootdir";
6154
pub const HBASE_UNSAFE_REGIONSERVER_HOSTNAME_DISABLE_MASTER_REVERSEDNS: &str =
6255
"hbase.unsafe.regionserver.hostname.disable.master.reversedns";
63-
pub const HBASE_HEAPSIZE: &str = "HBASE_HEAPSIZE";
6456

6557
pub const HBASE_UI_PORT_NAME_HTTP: &str = "ui-http";
6658
pub const HBASE_UI_PORT_NAME_HTTPS: &str = "ui-https";
@@ -81,8 +73,6 @@ pub const HBASE_REST_UI_PORT: u16 = 8085;
8173
// Newer versions use the same port as the UI because Hbase provides it's own metrics API
8274
pub const METRICS_PORT: u16 = 9100;
8375

84-
pub const JVM_HEAP_FACTOR: f32 = 0.8;
85-
8676
#[derive(Snafu, Debug)]
8777
pub enum Error {
8878
#[snafu(display("the role [{role}] is invalid and does not exist in HBase"))]
@@ -137,15 +127,15 @@ pub struct HbaseClusterSpec {
137127
/// The HBase master process is responsible for assigning regions to region servers and
138128
/// manages the cluster.
139129
#[serde(default, skip_serializing_if = "Option::is_none")]
140-
pub masters: Option<Role<HbaseConfigFragment>>,
130+
pub masters: Option<Role<HbaseConfigFragment, GenericRoleConfig, JavaCommonConfig>>,
141131

142132
/// Region servers hold the data and handle requests from clients for their region.
143133
#[serde(default, skip_serializing_if = "Option::is_none")]
144-
pub region_servers: Option<Role<HbaseConfigFragment>>,
134+
pub region_servers: Option<Role<HbaseConfigFragment, GenericRoleConfig, JavaCommonConfig>>,
145135

146136
/// Rest servers provide a REST API to interact with.
147137
#[serde(default, skip_serializing_if = "Option::is_none")]
148-
pub rest_servers: Option<Role<HbaseConfigFragment>>,
138+
pub rest_servers: Option<Role<HbaseConfigFragment, GenericRoleConfig, JavaCommonConfig>>,
149139
}
150140

151141
#[derive(Clone, Debug, Default, Deserialize, Eq, JsonSchema, PartialEq, Serialize)]
@@ -325,7 +315,6 @@ impl HbaseRole {
325315

326316
HbaseConfigFragment {
327317
hbase_rootdir: None,
328-
hbase_opts: None,
329318
resources,
330319
logging: product_logging::spec::default_logging(),
331320
affinity: get_affinity(cluster_name, self, hdfs_discovery_cm_name),
@@ -413,12 +402,13 @@ pub enum Container {
413402
pub struct HbaseConfig {
414403
#[serde(default, skip_serializing_if = "Option::is_none")]
415404
pub hbase_rootdir: Option<String>,
416-
#[serde(default, skip_serializing_if = "Option::is_none")]
417-
pub hbase_opts: Option<String>,
405+
418406
#[fragment_attrs(serde(default))]
419407
pub resources: Resources<HbaseStorageConfig, NoRuntimeLimits>,
408+
420409
#[fragment_attrs(serde(default))]
421410
pub logging: Logging<Container>,
411+
422412
#[fragment_attrs(serde(default))]
423413
pub affinity: StackableAffinity,
424414

@@ -538,7 +528,10 @@ impl HbaseCluster {
538528
}
539529
}
540530

541-
pub fn get_role(&self, role: &HbaseRole) -> Option<&Role<HbaseConfigFragment>> {
531+
pub fn get_role(
532+
&self,
533+
role: &HbaseRole,
534+
) -> Option<&Role<HbaseConfigFragment, GenericRoleConfig, JavaCommonConfig>> {
542535
match role {
543536
HbaseRole::Master => self.spec.masters.as_ref(),
544537
HbaseRole::RegionServer => self.spec.region_servers.as_ref(),
@@ -550,7 +543,7 @@ impl HbaseCluster {
550543
pub fn get_role_group(
551544
&self,
552545
rolegroup_ref: &RoleGroupRef<HbaseCluster>,
553-
) -> Result<&RoleGroup<HbaseConfigFragment, GenericProductSpecificCommonConfig>, Error> {
546+
) -> Result<&RoleGroup<HbaseConfigFragment, JavaCommonConfig>, Error> {
554547
let role_variant =
555548
HbaseRole::from_str(&rolegroup_ref.role).with_context(|_| InvalidRoleSnafu {
556549
role: rolegroup_ref.role.to_owned(),

0 commit comments

Comments
 (0)