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 @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

### Added

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

[#907]: https://github.com/stackabletech/druid-operator/pull/907

## [26.11.0] - 2026-11-20

## [26.11.0-rc1] - 2026-11-19
Expand Down
4 changes: 4 additions & 0 deletions docs/modules/druid/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
brokers:
config:
containerdebug:
enabled: false
logging:
enableVectorAgent: true
coordinators:
Expand Down Expand Up @@ -38,4 +40,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/druid` 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[].
200 changes: 200 additions & 0 deletions extra/crds.yaml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion rust/operator-binary/src/controller/build/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ pub(crate) fn containers_and_volumes(inputs: &RoleGroupInputs) -> Result<Contain
// They are merged in last so that they override any operator-set environment variable.
let env_vars = env_vars.merge(inputs.env_overrides.clone());

main_container_commands.push(role.main_container_start_command());
main_container_commands.push(role.main_container_start_command(&inputs.containerdebug));
cb_druid
.image_from_product_image(resolved_product_image)
.command(vec![
Expand Down
81 changes: 81 additions & 0 deletions rust/operator-binary/src/controller/build/resource/statefulset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,4 +252,85 @@ spec:
..Volume::default()
}
}

/// The `druid` container of every role starts `containerdebug` from the validated config of
/// its own role group. The command itself is owned (and tested) by operator-rs, so only the
/// wiring is checked here.
#[test]
fn every_role_starts_containerdebug_from_its_own_config() {
use stackable_operator::{
crd::containerdebug::{DEFAULT_INTERVAL, ValidatedContainerdebugConfig},
shared::time::Duration,
v2::product_logging::framework::STACKABLE_LOG_DIR,
};

let yaml = MINIMAL_DRUID_YAML
.replace(
" coordinators:\n roleGroups:",
" coordinators:\n config:\n containerdebug:\n enabled: false\n roleGroups:",
)
.replace(
" brokers:\n roleGroups:",
" brokers:\n config:\n containerdebug:\n interval: 10m\n roleGroups:",
);
let cluster = validated_cluster(&druid_from_yaml(&yaml));
let default_group = RoleGroupName::from_str("default").expect("valid role group name");

for (role, containerdebug) in [
(
DruidRole::Coordinator,
ValidatedContainerdebugConfig::Disabled,
),
(
DruidRole::Broker,
ValidatedContainerdebugConfig::Enabled {
interval: Duration::from_minutes_unchecked(10),
},
),
(
DruidRole::Historical,
ValidatedContainerdebugConfig::Enabled {
interval: DEFAULT_INTERVAL,
},
),
(
DruidRole::MiddleManager,
ValidatedContainerdebugConfig::Enabled {
interval: DEFAULT_INTERVAL,
},
),
(
DruidRole::Router,
ValidatedContainerdebugConfig::Enabled {
interval: DEFAULT_INTERVAL,
},
),
] {
let stateful_set =
build_statefulset(&role_group_builder(&cluster, &role, &default_group))
.expect("the StatefulSet builds");
let args = stateful_set
.spec
.expect("the StatefulSet has a spec")
.template
.spec
.expect("the pod template has a spec")
.containers
.into_iter()
.find(|container| container.name == Container::Druid.name().as_ref())
.expect("the druid container exists")
.args
.expect("the druid container has args")
.join("\n");

assert_eq!(
args.lines()
.map(str::trim)
.find(|line| line.starts_with("containerdebug "))
.map(ToOwned::to_owned),
containerdebug.background_command(STACKABLE_LOG_DIR),
"{role}: {args}"
);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ pub(crate) fn build<'a>(
resources,
logging,
affinity,
containerdebug,
graceful_shutdown_timeout,
requested_secret_lifetime,
} = &rg_config.config;
Expand All @@ -45,6 +46,7 @@ pub(crate) fn build<'a>(
heap,
direct_memory: Some(direct_memory),
logging: logging.clone(),
containerdebug: containerdebug.clone(),
listener: Some(group_listener_name(&cluster.name, &ROLE)),
role_pod_volumes: Vec::new(),
role_druid_mounts: Vec::new(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pub(crate) fn build<'a>(
resources,
logging,
affinity,
containerdebug,
graceful_shutdown_timeout,
requested_secret_lifetime,
} = &rg_config.config;
Expand All @@ -52,6 +53,7 @@ pub(crate) fn build<'a>(
heap,
direct_memory: None,
logging: logging.clone(),
containerdebug: containerdebug.clone(),
listener: Some(group_listener_name(&cluster.name, &ROLE)),
role_pod_volumes: Vec::new(),
role_druid_mounts: Vec::new(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub(crate) fn build<'a>(
resources,
logging,
affinity,
containerdebug,
graceful_shutdown_timeout,
requested_secret_lifetime,
} = &rg_config.config;
Expand All @@ -59,6 +60,7 @@ pub(crate) fn build<'a>(
heap: derived_settings.heap_memory(),
direct_memory: Some(derived_settings.direct_access_memory()),
logging: logging.clone(),
containerdebug: containerdebug.clone(),
listener: None,
role_pod_volumes: vec![segment_cache_volume(segment_cache)],
role_druid_mounts: vec![segment_cache_volume_mount()],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ pub(crate) fn build<'a>(
resources,
logging,
affinity,
containerdebug,
graceful_shutdown_timeout,
requested_secret_lifetime,
} = &rg_config.config;
Expand All @@ -156,6 +157,7 @@ pub(crate) fn build<'a>(
heap,
direct_memory: None,
logging: logging.clone(),
containerdebug: containerdebug.clone(),
listener: None,
role_pod_volumes: Vec::new(),
role_druid_mounts: Vec::new(),
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 @@ -18,6 +18,7 @@ use std::collections::BTreeMap;
use snafu::{ResultExt, Snafu};
use stackable_operator::{
commons::affinity::StackableAffinity,
crd::containerdebug::ValidatedContainerdebugConfig,
k8s_openapi::api::{
apps::v1::StatefulSet,
core::v1::{
Expand Down Expand Up @@ -89,6 +90,8 @@ pub(crate) struct RoleGroupInputs<'a> {
/// Router.
pub(crate) direct_memory: Option<MemoryQuantity>,
pub(crate) logging: ValidatedLogging,
/// Starts (or not) the `containerdebug` process in the background of the `druid` container.
pub(crate) containerdebug: ValidatedContainerdebugConfig,
/// The role's group Listener name; `Some` for Brokers, Coordinators and Routers. Drives the
/// listener claim template, its mount on the `druid` container and the listener scope of the
/// TLS volume.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ pub(crate) fn build<'a>(
resources,
logging,
affinity,
containerdebug,
graceful_shutdown_timeout,
requested_secret_lifetime,
} = &rg_config.config;
Expand All @@ -45,6 +46,7 @@ pub(crate) fn build<'a>(
heap,
direct_memory: Some(direct_memory),
logging: logging.clone(),
containerdebug: containerdebug.clone(),
listener: Some(group_listener_name(&cluster.name, &ROLE)),
role_pod_volumes: Vec::new(),
role_druid_mounts: Vec::new(),
Expand Down
Loading
Loading