Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## [Unreleased]

### Added

- Add the `config.containerdebug` field to roles and role groups ([#839]).

[#839]: https://github.com/stackabletech/hbase-operator/pull/839

## [26.11.0] - 2026-11-20

## [26.11.0-rc1] - 2026-11-19
Expand Down
4 changes: 4 additions & 0 deletions docs/modules/hbase/pages/usage-guide/logging.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ spec:
vectorAggregatorConfigMapName: vector-aggregator-discovery
masters:
config:
containerdebug:
enabled: false
logging:
enableVectorAgent: true
regionServers:
Expand All @@ -30,4 +32,6 @@ Overriding `FILE_LOG_DIRECTORY` with `envOverrides` therefore changes how these
The agent only collects files one level below `/stackable/log`, so a sibling directory such as `/stackable/log/hbase` relabels the events instead of dropping them, while any deeper or shallower path stops the aggregation.
A path outside `/stackable/log` also leaves the size-capped log volume.

The `containerdebug` process can be configured or turned off per role and role group, as described in xref:concepts:observability/containerdebug.adoc#configuration[].

Further information on how to configure logging, can be found in xref:concepts:logging.adoc[].
120 changes: 120 additions & 0 deletions extra/crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,26 @@ spec:
type: object
x-kubernetes-preserve-unknown-fields: true
type: object
containerdebug:
default:
enabled: null
interval: null
description: |-
Configures the `containerdebug` tool, which periodically logs information about the container
environment (such as network interfaces, DNS lookups and disk usage) in the background of the
product container.
properties:
enabled:
description: Whether `containerdebug` runs in the background of the product container. Defaults to `true`.
nullable: true
type: boolean
interval:
description: |-
Time between two runs of `containerdebug`, e.g. `30m`, `1h` or `2d`. Must not be zero.
Defaults to `30m`.
nullable: true
type: string
type: object
gracefulShutdownTimeout:
description: Time period Pods have to gracefully shut down, e.g. `30m`, `1h` or `2d`. Consult the operator documentation for details.
nullable: true
Expand Down Expand Up @@ -710,6 +730,26 @@ spec:
type: object
x-kubernetes-preserve-unknown-fields: true
type: object
containerdebug:
default:
enabled: null
interval: null
description: |-
Configures the `containerdebug` tool, which periodically logs information about the container
environment (such as network interfaces, DNS lookups and disk usage) in the background of the
product container.
properties:
enabled:
description: Whether `containerdebug` runs in the background of the product container. Defaults to `true`.
nullable: true
type: boolean
interval:
description: |-
Time between two runs of `containerdebug`, e.g. `30m`, `1h` or `2d`. Must not be zero.
Defaults to `30m`.
nullable: true
type: string
type: object
gracefulShutdownTimeout:
description: Time period Pods have to gracefully shut down, e.g. `30m`, `1h` or `2d`. Consult the operator documentation for details.
nullable: true
Expand Down Expand Up @@ -1137,6 +1177,26 @@ spec:
type: object
x-kubernetes-preserve-unknown-fields: true
type: object
containerdebug:
default:
enabled: null
interval: null
description: |-
Configures the `containerdebug` tool, which periodically logs information about the container
environment (such as network interfaces, DNS lookups and disk usage) in the background of the
product container.
properties:
enabled:
description: Whether `containerdebug` runs in the background of the product container. Defaults to `true`.
nullable: true
type: boolean
interval:
description: |-
Time between two runs of `containerdebug`, e.g. `30m`, `1h` or `2d`. Must not be zero.
Defaults to `30m`.
nullable: true
type: string
type: object
gracefulShutdownTimeout:
description: Time period Pods have to gracefully shut down, e.g. `30m`, `1h` or `2d`. Consult the operator documentation for details.
nullable: true
Expand Down Expand Up @@ -1597,6 +1657,26 @@ spec:
type: object
x-kubernetes-preserve-unknown-fields: true
type: object
containerdebug:
default:
enabled: null
interval: null
description: |-
Configures the `containerdebug` tool, which periodically logs information about the container
environment (such as network interfaces, DNS lookups and disk usage) in the background of the
product container.
properties:
enabled:
description: Whether `containerdebug` runs in the background of the product container. Defaults to `true`.
nullable: true
type: boolean
interval:
description: |-
Time between two runs of `containerdebug`, e.g. `30m`, `1h` or `2d`. Must not be zero.
Defaults to `30m`.
nullable: true
type: string
type: object
gracefulShutdownTimeout:
description: Time period Pods have to gracefully shut down, e.g. `30m`, `1h` or `2d`. Consult the operator documentation for details.
nullable: true
Expand Down Expand Up @@ -2045,6 +2125,26 @@ spec:
type: object
x-kubernetes-preserve-unknown-fields: true
type: object
containerdebug:
default:
enabled: null
interval: null
description: |-
Configures the `containerdebug` tool, which periodically logs information about the container
environment (such as network interfaces, DNS lookups and disk usage) in the background of the
product container.
properties:
enabled:
description: Whether `containerdebug` runs in the background of the product container. Defaults to `true`.
nullable: true
type: boolean
interval:
description: |-
Time between two runs of `containerdebug`, e.g. `30m`, `1h` or `2d`. Must not be zero.
Defaults to `30m`.
nullable: true
type: string
type: object
gracefulShutdownTimeout:
description: Time period Pods have to gracefully shut down, e.g. `30m`, `1h` or `2d`. Consult the operator documentation for details.
nullable: true
Expand Down Expand Up @@ -2470,6 +2570,26 @@ spec:
type: object
x-kubernetes-preserve-unknown-fields: true
type: object
containerdebug:
default:
enabled: null
interval: null
description: |-
Configures the `containerdebug` tool, which periodically logs information about the container
environment (such as network interfaces, DNS lookups and disk usage) in the background of the
product container.
properties:
enabled:
description: Whether `containerdebug` runs in the background of the product container. Defaults to `true`.
nullable: true
type: boolean
interval:
description: |-
Time between two runs of `containerdebug`, e.g. `30m`, `1h` or `2d`. Must not be zero.
Defaults to `30m`.
nullable: true
type: string
type: object
gracefulShutdownTimeout:
description: Time period Pods have to gracefully shut down, e.g. `30m`, `1h` or `2d`. Consult the operator documentation for details.
nullable: true
Expand Down
18 changes: 18 additions & 0 deletions rust/operator-binary/src/controller/build/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use snafu::{ResultExt, Snafu};
use stackable_operator::{
builder::pod::volume::VolumeBuilder,
constant,
crd::containerdebug::ValidatedContainerdebugConfig,
k8s_openapi::{
api::core::v1::{
ConfigMapVolumeSource, Container, ContainerPort, PersistentVolumeClaim, Probe,
Expand Down Expand Up @@ -57,6 +58,10 @@ constant!(HADOOP_CONF_DIR_ENV: EnvVarName = "HADOOP_CONF_DIR");
constant!(pub(crate) REGION_MOVER_OPTS_ENV: EnvVarName = "REGION_MOVER_OPTS");
constant!(pub(crate) RUN_REGION_MOVER_ENV: EnvVarName = "RUN_REGION_MOVER");
constant!(STACKABLE_LOG_DIR_ENV: EnvVarName = "STACKABLE_LOG_DIR");
// Read by hbase-entrypoint.sh, which starts `containerdebug`. Images without support for them
// ignore both and run `containerdebug` every 30 minutes.
constant!(CONTAINERDEBUG_ENABLED_ENV: EnvVarName = "CONTAINERDEBUG_ENABLED");
constant!(CONTAINERDEBUG_INTERVAL_ENV: EnvVarName = "CONTAINERDEBUG_INTERVAL");
constant!(FILE_LOG_DIRECTORY_ENV: EnvVarName = "FILE_LOG_DIRECTORY");
constant!(FILE_LOG_MAX_FILES_ENV: EnvVarName = "FILE_LOG_MAX_FILES");
constant!(FILE_LOG_ROTATION_PERIOD_ENV: EnvVarName = "FILE_LOG_ROTATION_PERIOD");
Expand Down Expand Up @@ -160,6 +165,7 @@ pub(crate) fn containers_and_volumes(inputs: &RoleGroupInputs) -> Result<Contain
// Rotation is opt-in, so without these the file would grow unbounded.
.with_value(&FILE_LOG_ROTATION_PERIOD_ENV, "hourly")
.with_value(&FILE_LOG_MAX_FILES_ENV, "2")
.merge(containerdebug_env_vars(&inputs.containerdebug))
// Empty when Kerberos is disabled.
.merge(kerberos::kerberos_env_vars(cluster))
// apply overrides last of all; `EnvVarSet` is keyed by name, so iteration is already
Expand Down Expand Up @@ -287,6 +293,18 @@ pub(crate) fn containers_and_volumes(inputs: &RoleGroupInputs) -> Result<Contain
})
}

/// The environment variables with which hbase-entrypoint.sh starts `containerdebug`, or not.
fn containerdebug_env_vars(containerdebug: &ValidatedContainerdebugConfig) -> EnvVarSet {
match containerdebug {
ValidatedContainerdebugConfig::Enabled { interval } => EnvVarSet::new()
.with_value(&CONTAINERDEBUG_ENABLED_ENV, "true")
.with_value(&CONTAINERDEBUG_INTERVAL_ENV, interval.to_string()),
ValidatedContainerdebugConfig::Disabled => {
EnvVarSet::new().with_value(&CONTAINERDEBUG_ENABLED_ENV, "false")
}
}
}

/// Returns the container command.
fn command() -> Vec<String> {
vec![
Expand Down
59 changes: 59 additions & 0 deletions rust/operator-binary/src/controller/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ pub(crate) fn role_group_selector(
mod tests {
use std::collections::BTreeMap;

use indoc::indoc;
use stackable_operator::{
k8s_openapi::api::{apps::v1::StatefulSetSpec, core::v1::PodSpec},
kube::Resource,
Expand Down Expand Up @@ -447,6 +448,64 @@ mod tests {
}
}

/// The entrypoint script of the image starts `containerdebug` from these variables, so every
/// role passes on its own validated config.
#[test]
fn every_role_passes_its_containerdebug_config_to_the_entrypoint() {
let cluster = test_utils::validated_cluster_from(&test_utils::hbase_from_yaml(indoc! {r#"
---
apiVersion: hbase.stackable.tech/v1alpha1
kind: HbaseCluster
metadata:
name: hbase
namespace: default
uid: c2c8c5c0-0b5a-4b1e-9f3e-1a2b3c4d5e6f
spec:
image:
productVersion: 2.6.3
clusterConfig:
hdfsConfigMapName: simple-hdfs
zookeeperConfigMapName: simple-znode
masters:
config:
containerdebug:
enabled: false
roleGroups:
default:
replicas: 1
regionServers:
config:
containerdebug:
interval: 10m
roleGroups:
default:
replicas: 1
restServers:
roleGroups:
default:
replicas: 1
"#}));
let resources = build(&cluster, &test_utils::cluster_info()).expect("build succeeds");

for (role, expected_enabled, expected_interval) in [
(HbaseRole::Master, "false", None),
(HbaseRole::RegionServer, "true", Some("10m")),
(HbaseRole::RestServer, "true", Some("30m")),
] {
let env = hbase_container_env(stateful_set_spec(&resources, &cluster, &role));
assert_eq!(
env.get("CONTAINERDEBUG_ENABLED").map(String::as_str),
Some(expected_enabled),
"{role:?} CONTAINERDEBUG_ENABLED",
);
assert_eq!(
env.get("CONTAINERDEBUG_INTERVAL").map(String::as_str),
expected_interval,
"{role:?} CONTAINERDEBUG_INTERVAL",
);
}
}

/// Each role's `hbase-site.xml` carries only its own bind settings, and its `hbase-env.sh`
/// its own `*_OPTS` variable.
#[test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ pub(crate) fn inputs<'a>(
resources,
logging,
affinity,
containerdebug,
graceful_shutdown_timeout,
requested_secret_lifetime,
listener_class,
Expand All @@ -66,6 +67,7 @@ pub(crate) fn inputs<'a>(
resources: resources.clone(),
hbase_rootdir: hbase_rootdir.clone(),
logging: logging.clone(),
containerdebug: containerdebug.clone(),
listener,
region_mover_opts: String::new(),
run_region_mover: false,
Expand Down
3 changes: 3 additions & 0 deletions rust/operator-binary/src/controller/build/role_group/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use stackable_operator::{
affinity::StackableAffinity,
resources::{NoRuntimeLimits, Resources},
},
crd::containerdebug::ValidatedContainerdebugConfig,
k8s_openapi::api::{
apps::v1::StatefulSet,
core::v1::{ConfigMap, Container, PersistentVolumeClaim, PodTemplateSpec, Service, Volume},
Expand Down Expand Up @@ -89,6 +90,8 @@ pub(crate) struct RoleGroupInputs<'a> {
pub(crate) resources: Resources<HbaseStorageConfig, NoRuntimeLimits>,
pub(crate) hbase_rootdir: String,
pub(crate) logging: ValidatedLogging,
/// Passed to the entrypoint script of the image, which starts `containerdebug`.
pub(crate) containerdebug: ValidatedContainerdebugConfig,
pub(crate) listener: ListenerPlacement,
/// Set on every role because the entrypoint runs under `set -u`; only RegionServers run the
/// mover, so only they have a non-empty value.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ pub(crate) fn inputs<'a>(
resources,
logging,
affinity,
containerdebug,
graceful_shutdown_timeout,
requested_secret_lifetime,
listener_class,
Expand All @@ -67,6 +68,7 @@ pub(crate) fn inputs<'a>(
resources: resources.clone(),
hbase_rootdir: hbase_rootdir.clone(),
logging: logging.clone(),
containerdebug: containerdebug.clone(),
listener,
region_mover_opts: region_mover::region_mover_args(&rg_config.config),
run_region_mover: region_mover.run_before_shutdown,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pub(crate) fn inputs<'a>(
resources,
logging,
affinity,
containerdebug,
graceful_shutdown_timeout,
requested_secret_lifetime,
listener_class,
Expand All @@ -57,6 +58,7 @@ pub(crate) fn inputs<'a>(
resources: resources.clone(),
hbase_rootdir: hbase_rootdir.clone(),
logging: logging.clone(),
containerdebug: containerdebug.clone(),
listener,
region_mover_opts: String::new(),
run_region_mover: false,
Expand Down
Loading
Loading