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 ([#818]).

[#818]: https://github.com/stackabletech/superset-operator/pull/818

## [26.11.0] - 2026-11-20

## [26.11.0-rc1] - 2026-11-19
Expand Down
4 changes: 4 additions & 0 deletions docs/modules/superset/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
nodes:
config:
containerdebug:
enabled: false
logging:
enableVectorAgent: true
----
Expand All @@ -22,4 +24,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/superset` 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 @@ -75,6 +75,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 @@ -452,6 +472,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 @@ -1260,6 +1300,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 @@ -1637,6 +1697,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 @@ -2015,6 +2095,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 @@ -2392,6 +2492,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
12 changes: 9 additions & 3 deletions rust/operator-binary/src/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use stackable_operator::{
resources::{NoRuntimeLimits, Resources},
},
constant,
crd::listener,
crd::{containerdebug::ValidatedContainerdebugConfig, listener},
k8s_openapi::api::{
apps::v1::{Deployment, StatefulSet},
core::v1::{ConfigMap, Service, ServiceAccount},
Expand Down Expand Up @@ -148,6 +148,7 @@ pub type SupersetRoleGroupConfig =
#[derive(Clone, Debug)]
pub struct ValidatedSupersetConfig {
pub affinity: StackableAffinity,
pub containerdebug: ValidatedContainerdebugConfig,
pub graceful_shutdown_timeout: Option<Duration>,
pub logging: ValidatedLogging,
pub resources: Resources<SupersetStorageConfig, NoRuntimeLimits>,
Expand All @@ -157,10 +158,15 @@ pub struct ValidatedSupersetConfig {

impl ValidatedSupersetConfig {
/// Builds the validated config from the merged [`SupersetConfig`], swapping in the
/// already-validated logging.
fn from_merged(merged: SupersetConfig, logging: ValidatedLogging) -> Self {
/// already-validated `containerdebug` and logging configuration.
fn from_merged(
merged: SupersetConfig,
containerdebug: ValidatedContainerdebugConfig,
logging: ValidatedLogging,
) -> Self {
Self {
affinity: merged.affinity,
containerdebug,
graceful_shutdown_timeout: merged.graceful_shutdown_timeout,
logging,
resources: merged.resources,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,10 @@ mod tests {
) -> ValidatedSupersetConfig {
ValidatedSupersetConfig {
affinity: StackableAffinity::default(),
containerdebug:
stackable_operator::crd::containerdebug::ValidatedContainerdebugConfig::Enabled {
interval: stackable_operator::crd::containerdebug::DEFAULT_INTERVAL,
},
graceful_shutdown_timeout: None,
logging: ValidatedLogging {
superset_container: ValidatedContainerLogConfigChoice::Automatic(
Expand Down
66 changes: 64 additions & 2 deletions rust/operator-binary/src/controller/build/resource/deployment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ pub fn build_rolegroup_deployment(
{remove_vector_shutdown_file_command}
prepare_signal_handlers
mkdir --parents \"${file_log_directory}\" || true
containerdebug --output={STACKABLE_LOG_DIR}/containerdebug-state.json --loop &
{containerdebug_command}

{celery_command} &

Expand All @@ -135,6 +135,10 @@ pub fn build_rolegroup_deployment(
",
log_config_file = ConfigFileName::LogConfig,
file_log_directory = super::FILE_LOG_DIRECTORY.as_ref(),
containerdebug_command = merged_config
.containerdebug
.background_command(STACKABLE_LOG_DIR)
.unwrap_or_default(),
remove_vector_shutdown_file_command =
remove_vector_shutdown_file_command(STACKABLE_LOG_DIR),
create_vector_shutdown_file_command =
Expand Down Expand Up @@ -241,7 +245,12 @@ fn beat_replicas(requested: Option<u16>) -> Option<u16> {

#[cfg(test)]
mod tests {
use super::beat_replicas;
use std::str::FromStr;

use stackable_operator::v2::types::operator::RoleGroupName;

use super::{beat_replicas, build_rolegroup_deployment};
use crate::{controller::build::test_support::validated_cluster, crd::SupersetRole};

#[test]
fn beat_replicas_clamps_to_a_single_instance() {
Expand All @@ -255,4 +264,57 @@ mod tests {
assert_eq!(beat_replicas(Some(2)), Some(1));
assert_eq!(beat_replicas(Some(100)), Some(1));
}

/// The superset container of a Celery worker or beat starts `containerdebug` from the role
/// group's validated config. The command itself is owned (and tested) by operator-rs, so only
/// the wiring is checked here.
#[rstest::rstest]
fn superset_container_starts_containerdebug_from_config(
#[values(SupersetRole::Worker, SupersetRole::Beat)] role: SupersetRole,
#[values(
stackable_operator::crd::containerdebug::ValidatedContainerdebugConfig::Enabled {
interval: stackable_operator::shared::time::Duration::from_minutes_unchecked(10)
},
stackable_operator::crd::containerdebug::ValidatedContainerdebugConfig::Disabled
)]
containerdebug: stackable_operator::crd::containerdebug::ValidatedContainerdebugConfig,
) {
let expected = containerdebug.background_command(
stackable_operator::v2::product_logging::framework::STACKABLE_LOG_DIR,
);
let cluster = validated_cluster();
let role_group_name = RoleGroupName::from_str("default").expect("valid role group name");
let role_group_configs = match role {
SupersetRole::Worker => &cluster.worker_role_group_configs,
SupersetRole::Beat => &cluster.beat_role_group_configs,
SupersetRole::Node => unreachable!("nodes are built as a StatefulSet"),
};
let mut rg = role_group_configs
.get(&role_group_name)
.expect("default role group")
.clone();
rg.config.containerdebug = containerdebug;

let deployment = build_rolegroup_deployment(&cluster, &role, &role_group_name, &rg)
.expect("deployment built");

let args = deployment
.spec
.and_then(|spec| spec.template.spec)
.expect("pod spec")
.containers
.into_iter()
.find(|container| container.name == "superset")
.and_then(|container| container.args)
.expect("the superset container has args")
.join("\n");

assert_eq!(
args.lines()
.map(str::trim)
.find(|line| line.starts_with("containerdebug ")),
expected.as_deref(),
"args: {args}"
);
}
}
Loading
Loading