diff --git a/CHANGELOG.md b/CHANGELOG.md index e64266bb..ac91fea5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,12 +4,17 @@ All notable changes to this project will be documented in this file. ## [Unreleased] +### Added + +- Add the `config.containerdebug` field to roles and role groups ([#1081]). + ### Changed - Getting started guide uses a KRaft cluster instead of ZooKeeper and declares its topic with a KafkaTopic managed by the agent ([#1079]). [#1079]: https://github.com/stackabletech/kafka-operator/pull/1079 +[#1081]: https://github.com/stackabletech/kafka-operator/pull/1081 ## [26.11.0] - 2026-11-20 diff --git a/docs/modules/kafka/pages/usage-guide/logging.adoc b/docs/modules/kafka/pages/usage-guide/logging.adoc index 8b1bc2a2..544b0d39 100644 --- a/docs/modules/kafka/pages/usage-guide/logging.adoc +++ b/docs/modules/kafka/pages/usage-guide/logging.adoc @@ -10,6 +10,8 @@ spec: vectorAggregatorConfigMapName: vector-aggregator-discovery brokers: config: + containerdebug: + enabled: false logging: enableVectorAgent: true ---- @@ -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/kafka` 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[]. diff --git a/extra/crds.yaml b/extra/crds.yaml index 1f967db7..f5119e0b 100644 --- a/extra/crds.yaml +++ b/extra/crds.yaml @@ -88,6 +88,26 @@ spec: nullable: true pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ type: string + 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 @@ -544,6 +564,26 @@ spec: nullable: true pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$ type: string + 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 @@ -1252,6 +1292,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 @@ -1694,6 +1754,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 diff --git a/rust/operator-binary/src/controller.rs b/rust/operator-binary/src/controller.rs index de276448..3366c7de 100644 --- a/rust/operator-binary/src/controller.rs +++ b/rust/operator-binary/src/controller.rs @@ -20,7 +20,10 @@ use stackable_operator::{ resources::{NoRuntimeLimits, Resources}, }, constant, - crd::{listener, management_access::v1alpha1::TlsClientCredential}, + crd::{ + containerdebug::ValidatedContainerdebugConfig, listener, + management_access::v1alpha1::TlsClientCredential, + }, k8s_openapi::api::{ apps::v1::{Deployment, StatefulSet}, core::v1::{ConfigMap, Service, ServiceAccount}, @@ -479,6 +482,7 @@ pub struct ValidatedBrokerConfig { pub resources: Resources, pub logging: validate::ValidatedLogging, pub affinity: StackableAffinity, + pub containerdebug: ValidatedContainerdebugConfig, pub graceful_shutdown_timeout: Duration, pub requested_secret_lifetime: Duration, pub bootstrap_listener_class: ListenerClassName, @@ -493,6 +497,7 @@ pub struct ValidatedControllerConfig { pub resources: Resources, pub logging: validate::ValidatedLogging, pub affinity: StackableAffinity, + pub containerdebug: ValidatedContainerdebugConfig, pub graceful_shutdown_timeout: Duration, pub requested_secret_lifetime: Duration, } diff --git a/rust/operator-binary/src/controller/build/command.rs b/rust/operator-binary/src/controller/build/command.rs index 5b8c223c..35ed4f1d 100644 --- a/rust/operator-binary/src/controller/build/command.rs +++ b/rust/operator-binary/src/controller/build/command.rs @@ -3,6 +3,7 @@ use std::str::FromStr; use indoc::formatdoc; use stackable_operator::{ constant, + crd::containerdebug::ValidatedContainerdebugConfig, product_logging::framework::{ create_vector_shutdown_file_command, remove_vector_shutdown_file_command, }, @@ -55,13 +56,14 @@ const EXPORT_REPLICA_ID: &str = "export REPLICA_ID=$((POD_INDEX + NODE_ID_OFFSET pub fn broker_kafka_container_commands( kraft_mode: bool, kafka_security: &ValidatedKafkaSecurity, + containerdebug: &ValidatedContainerdebugConfig, ) -> String { formatdoc! {" {COMMON_BASH_TRAP_FUNCTIONS} {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} {set_realm_env} {import_opa_tls_cert} @@ -73,6 +75,9 @@ pub fn broker_kafka_container_commands( ", remove_vector_shutdown_file_command = remove_vector_shutdown_file_command(STACKABLE_LOG_DIR), file_log_directory = FILE_LOG_DIRECTORY.as_ref(), + containerdebug_command = containerdebug + .background_command(STACKABLE_LOG_DIR) + .unwrap_or_default(), create_vector_shutdown_file_command = create_vector_shutdown_file_command(STACKABLE_LOG_DIR), set_realm_env = export_kerberos_realm_command(kafka_security).unwrap_or_default(), import_opa_tls_cert = copy_opa_tls_cert_command(kafka_security), @@ -149,13 +154,14 @@ fn controller_quorum_format_flag(bootstrap_node_id: Option) -> String { pub fn controller_kafka_container_command( kafka_security: &ValidatedKafkaSecurity, bootstrap_node_id: Option, + containerdebug: &ValidatedContainerdebugConfig, ) -> String { formatdoc! {" {COMMON_BASH_TRAP_FUNCTIONS} {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} {import_opa_tls_cert} @@ -178,6 +184,9 @@ pub fn controller_kafka_container_command( ", remove_vector_shutdown_file_command = remove_vector_shutdown_file_command(STACKABLE_LOG_DIR), file_log_directory = FILE_LOG_DIRECTORY.as_ref(), + containerdebug_command = containerdebug + .background_command(STACKABLE_LOG_DIR) + .unwrap_or_default(), import_opa_tls_cert = copy_opa_tls_cert_command(kafka_security), derive_pod_index = DERIVE_POD_INDEX, export_replica_id = EXPORT_REPLICA_ID, @@ -389,6 +398,13 @@ mod tests { use indoc::indoc; use super::*; + + /// The `containerdebug` config every role group gets when it configures none. + fn default_containerdebug() -> ValidatedContainerdebugConfig { + ValidatedContainerdebugConfig::Enabled { + interval: stackable_operator::crd::containerdebug::DEFAULT_INTERVAL, + } + } use crate::controller::test_support::{kerberos, plaintext}; #[test] @@ -396,7 +412,8 @@ mod tests { // The controllers never use Kerberos: the nodes authenticate each other with their // internal pod certificates, also when Kerberos is enabled for clients. for security in [kerberos(), plaintext()] { - let command = controller_kafka_container_command(&security, None); + let command = + controller_kafka_container_command(&security, None, &default_containerdebug()); assert!(!command.contains("KERBEROS_REALM")); assert!(!command.contains("jaas.properties")); } @@ -419,7 +436,8 @@ mod tests { #[test] fn controller_command_templates_the_admin_client_config_for_pre_stop() { - let command = controller_kafka_container_command(&kerberos(), None); + let command = + controller_kafka_container_command(&kerberos(), None, &default_containerdebug()); assert!( command.contains( "cp /stackable/config/admin-client.properties /tmp/admin-client.properties" @@ -1135,7 +1153,8 @@ mod tests { /// (`--no-initial-controllers`). #[test] fn controller_kafka_container_command_branches_on_the_bootstrap_node_id() { - let command = controller_kafka_container_command(&plaintext(), Some(5)); + let command = + controller_kafka_container_command(&plaintext(), Some(5), &default_containerdebug()); assert!(command.contains(r#"if [ "$REPLICA_ID" = "5" ]; then"#)); assert!(command.contains("FORMAT_QUORUM_FLAG=--standalone")); @@ -1151,7 +1170,8 @@ mod tests { /// Without a bootstrap controller, no controller may bootstrap a quorum. #[test] fn controller_kafka_container_command_without_bootstrap_node_id_never_uses_standalone() { - let command = controller_kafka_container_command(&plaintext(), None); + let command = + controller_kafka_container_command(&plaintext(), None, &default_containerdebug()); assert!(command.contains("FORMAT_QUORUM_FLAG=--no-initial-controllers")); assert!(!command.contains("--standalone")); } diff --git a/rust/operator-binary/src/controller/build/role_group/broker.rs b/rust/operator-binary/src/controller/build/role_group/broker.rs index 7cc595db..e1951fa7 100644 --- a/rust/operator-binary/src/controller/build/role_group/broker.rs +++ b/rust/operator-binary/src/controller/build/role_group/broker.rs @@ -284,6 +284,7 @@ fn role_pod( .args(vec![broker_kafka_container_commands( cluster.cluster_config.is_kraft_mode(), kafka_security, + &config.containerdebug, )]); cb_kafka @@ -474,4 +475,74 @@ mod tests { // Kerberos, so there is no login context for the CONTROLLER listener. assert!(!jaas.contains("controller.KafkaServer")); } + + /// The kafka container starts `containerdebug` from the role group's validated config, which + /// reaches the start command through the role group's Pod. The command itself is owned (and + /// tested) by operator-rs, so only the wiring is checked here. + #[rstest::rstest] + #[case::enabled(stackable_operator::crd::containerdebug::ValidatedContainerdebugConfig::Enabled { + interval: stackable_operator::shared::time::Duration::from_minutes_unchecked(10) + })] + #[case::disabled( + stackable_operator::crd::containerdebug::ValidatedContainerdebugConfig::Disabled + )] + fn kafka_container_starts_containerdebug_from_config( + #[case] containerdebug: stackable_operator::crd::containerdebug::ValidatedContainerdebugConfig, + ) { + let expected = containerdebug.background_command( + stackable_operator::v2::product_logging::framework::STACKABLE_LOG_DIR, + ); + let cluster = crate::controller::test_support::validated_cluster( + &crate::controller::test_support::minimal_kafka( + r#" + apiVersion: kafka.stackable.tech/v1alpha1 + kind: KafkaCluster + metadata: + name: simple-kafka + namespace: default + uid: 12345678-1234-1234-1234-123456789012 + spec: + image: + productVersion: 3.9.2 + clusterConfig: + metadataManager: KRaft + controllers: + roleGroups: + default: + replicas: 1 + brokers: + roleGroups: + default: + replicas: 1 + "#, + ), + ); + let role_group_name: RoleGroupName = "default".parse().expect("valid role group name"); + let mut validated_rg = + crate::controller::test_support::broker_role_group_config(&cluster, "default").clone(); + validated_rg.config.containerdebug = containerdebug; + + let (builder, _) = + build(&cluster, &role_group_name, &validated_rg).expect("the role group builds"); + let args = builder + .build_statefulset() + .expect("the StatefulSet builds") + .spec + .and_then(|spec| spec.template.spec) + .expect("the StatefulSet has a pod spec") + .containers + .into_iter() + .find(|container| container.name == "kafka") + .and_then(|container| container.args) + .expect("the kafka container has args") + .join("\n"); + + assert_eq!( + args.lines() + .map(str::trim) + .find(|line| line.starts_with("containerdebug ")), + expected.as_deref(), + "args: {args}" + ); + } } diff --git a/rust/operator-binary/src/controller/build/role_group/controller.rs b/rust/operator-binary/src/controller/build/role_group/controller.rs index ada3da14..f4a39597 100644 --- a/rust/operator-binary/src/controller/build/role_group/controller.rs +++ b/rust/operator-binary/src/controller/build/role_group/controller.rs @@ -271,6 +271,7 @@ fn role_pod( .args(vec![controller_kafka_container_command( kafka_security, cluster.kraft_bootstrap_controller_node_id(), + &config.containerdebug, )]); cb_kafka @@ -462,4 +463,75 @@ mod tests { let _ = *CLUSTER_DOMAIN; let _ = *QUORUM_MANAGER_CONTAINER_NAME; } + + /// The kafka container starts `containerdebug` from the role group's validated config, which + /// reaches the start command through the role group's Pod. The command itself is owned (and + /// tested) by operator-rs, so only the wiring is checked here. + #[rstest::rstest] + #[case::enabled(stackable_operator::crd::containerdebug::ValidatedContainerdebugConfig::Enabled { + interval: stackable_operator::shared::time::Duration::from_minutes_unchecked(10) + })] + #[case::disabled( + stackable_operator::crd::containerdebug::ValidatedContainerdebugConfig::Disabled + )] + fn kafka_container_starts_containerdebug_from_config( + #[case] containerdebug: stackable_operator::crd::containerdebug::ValidatedContainerdebugConfig, + ) { + let expected = containerdebug.background_command( + stackable_operator::v2::product_logging::framework::STACKABLE_LOG_DIR, + ); + let cluster = crate::controller::test_support::validated_cluster( + &crate::controller::test_support::minimal_kafka( + r#" + apiVersion: kafka.stackable.tech/v1alpha1 + kind: KafkaCluster + metadata: + name: simple-kafka + namespace: default + uid: 12345678-1234-1234-1234-123456789012 + spec: + image: + productVersion: 3.9.2 + clusterConfig: + metadataManager: KRaft + controllers: + roleGroups: + default: + replicas: 1 + brokers: + roleGroups: + default: + replicas: 1 + "#, + ), + ); + let role_group_name: RoleGroupName = "default".parse().expect("valid role group name"); + let mut validated_rg = + crate::controller::test_support::controller_role_group_config(&cluster, "default") + .clone(); + validated_rg.config.containerdebug = containerdebug; + + let builder = + build(&cluster, &role_group_name, &validated_rg).expect("the role group builds"); + let args = builder + .build_statefulset() + .expect("the StatefulSet builds") + .spec + .and_then(|spec| spec.template.spec) + .expect("the StatefulSet has a pod spec") + .containers + .into_iter() + .find(|container| container.name == "kafka") + .and_then(|container| container.args) + .expect("the kafka container has args") + .join("\n"); + + assert_eq!( + args.lines() + .map(str::trim) + .find(|line| line.starts_with("containerdebug ")), + expected.as_deref(), + "args: {args}" + ); + } } diff --git a/rust/operator-binary/src/controller/validate.rs b/rust/operator-binary/src/controller/validate.rs index 76e131a5..5b22fbd9 100644 --- a/rust/operator-binary/src/controller/validate.rs +++ b/rust/operator-binary/src/controller/validate.rs @@ -129,6 +129,13 @@ pub enum Error { role_group_name: String, }, + #[snafu(display("invalid containerdebug config of {role} role group {role_group_name:?}"))] + InvalidContainerdebugConfig { + source: stackable_operator::crd::containerdebug::Error, + role: KafkaRole, + role_group_name: String, + }, + #[snafu(display( "at least one KRaft controller replica is required while any broker replicas are \ configured; a KRaft cluster with zero controllers has no metadata quorum for its \ @@ -549,6 +556,7 @@ fn validate_broker_role_group_configs( common_config: CommonConfig { affinity, + containerdebug, graceful_shutdown_timeout, requested_secret_lifetime, }, @@ -563,6 +571,12 @@ fn validate_broker_role_group_configs( resources, logging: validate_broker_logging(&logging, vector_aggregator_config_map_name)?, affinity, + containerdebug: containerdebug.validate().with_context(|_| { + InvalidContainerdebugConfigSnafu { + role: KafkaRole::Broker, + role_group_name: role_group_name.to_owned(), + } + })?, graceful_shutdown_timeout: graceful_shutdown_timeout.with_context(|| { MissingGracefulShutdownTimeoutSnafu { role: KafkaRole::Broker, @@ -605,6 +619,7 @@ fn validate_controller_role_group_configs( common_config: CommonConfig { affinity, + containerdebug, graceful_shutdown_timeout, requested_secret_lifetime, }, @@ -620,6 +635,12 @@ fn validate_controller_role_group_configs( vector_aggregator_config_map_name, )?, affinity, + containerdebug: containerdebug.validate().with_context(|_| { + InvalidContainerdebugConfigSnafu { + role: KafkaRole::Controller, + role_group_name: role_group_name.to_owned(), + } + })?, graceful_shutdown_timeout: graceful_shutdown_timeout.with_context(|| { MissingGracefulShutdownTimeoutSnafu { role: KafkaRole::Controller, @@ -1419,4 +1440,107 @@ mod tests { Ok(_) => panic!("expected a node-id hash collision error, but validation succeeded"), } } + + /// A role `config` that does not mention `containerdebug` still gets the default, so the + /// `containerdebug` field of the CRD must be optional. + #[test] + fn containerdebug_defaults_when_not_configured() { + use stackable_operator::crd::containerdebug::{ + DEFAULT_INTERVAL, ValidatedContainerdebugConfig, + }; + + let kafka = minimal_kafka( + r#" + apiVersion: kafka.stackable.tech/v1alpha1 + kind: KafkaCluster + metadata: + name: simple-kafka + namespace: default + uid: 12345678-1234-1234-1234-123456789012 + spec: + image: + productVersion: 3.9.2 + clusterConfig: + metadataManager: KRaft + controllers: + config: + gracefulShutdownTimeout: 1h + roleGroups: + default: + replicas: 1 + brokers: + config: + gracefulShutdownTimeout: 1h + roleGroups: + default: + replicas: 1 + "#, + ); + let cluster = validated_cluster(&kafka); + let expected = ValidatedContainerdebugConfig::Enabled { + interval: DEFAULT_INTERVAL, + }; + + assert_eq!( + broker_role_group_config(&cluster, "default") + .config + .containerdebug, + expected + ); + assert_eq!( + controller_role_group_config(&cluster, "default") + .config + .containerdebug, + expected + ); + } + + /// An invalid `containerdebug` config fails the validation, naming the role and role group. + #[test] + fn zero_containerdebug_interval_fails_validation() { + let kafka = minimal_kafka( + r#" + apiVersion: kafka.stackable.tech/v1alpha1 + kind: KafkaCluster + metadata: + name: simple-kafka + namespace: default + uid: 12345678-1234-1234-1234-123456789012 + spec: + image: + productVersion: 3.9.2 + clusterConfig: + metadataManager: KRaft + controllers: + config: + containerdebug: + interval: 0s + roleGroups: + default: + replicas: 1 + brokers: + roleGroups: + default: + replicas: 1 + "#, + ); + + let Err(error) = validate_with_operator_image(&kafka, None) else { + panic!("the validation should fail"); + }; + let chain: Vec = + std::iter::successors(Some(&error as &dyn std::error::Error), |error| { + error.source() + }) + .map(ToString::to_string) + .collect(); + + assert_eq!( + chain, + [ + r#"invalid containerdebug config of controller role group "default""#, + "the containerdebug interval must not be zero", + ] + ); + } } diff --git a/rust/operator-binary/src/crd/role/commons.rs b/rust/operator-binary/src/crd/role/commons.rs index 2610fe7d..a816f6d6 100644 --- a/rust/operator-binary/src/crd/role/commons.rs +++ b/rust/operator-binary/src/crd/role/commons.rs @@ -2,6 +2,7 @@ use serde::{Deserialize, Serialize}; use stackable_operator::{ commons::{affinity::StackableAffinity, opa::OpaConfig, resources::PvcConfig}, config::{fragment::Fragment, merge::Merge}, + crd::containerdebug::{default_containerdebug_config, v1alpha1::ContainerdebugConfig}, k8s_openapi::api::core::v1::PersistentVolumeClaim, schemars::{self, JsonSchema}, shared::time::Duration, @@ -37,7 +38,7 @@ impl Storage { } } -#[derive(Clone, Debug, Default, Fragment, JsonSchema, PartialEq)] +#[derive(Clone, Debug, Fragment, JsonSchema, PartialEq)] #[fragment_attrs( derive( Clone, @@ -55,6 +56,9 @@ pub struct CommonConfig { #[fragment_attrs(serde(default))] pub affinity: StackableAffinity, + #[fragment_attrs(serde(default))] + pub containerdebug: ContainerdebugConfig, + /// Time period Pods have to gracefully shut down, e.g. `30m`, `1h` or `2d`. Consult the operator documentation for details. #[fragment_attrs(serde(default))] pub graceful_shutdown_timeout: Option, @@ -77,6 +81,7 @@ impl CommonConfig { ) -> CommonConfigFragment { CommonConfigFragment { affinity: get_affinity(cluster_name, role, opa_config), + containerdebug: default_containerdebug_config(), graceful_shutdown_timeout: Some(Self::DEFAULT_GRACEFUL_SHUTDOWN_TIMEOUT), requested_secret_lifetime: Some(Self::DEFAULT_SECRET_LIFETIME), } diff --git a/rust/operator-binary/src/crd/role/controller.rs b/rust/operator-binary/src/crd/role/controller.rs index e13a0114..edd7c45b 100644 --- a/rust/operator-binary/src/crd/role/controller.rs +++ b/rust/operator-binary/src/crd/role/controller.rs @@ -55,7 +55,7 @@ impl ControllerContainer { } } -#[derive(Clone, Debug, Default, PartialEq, Fragment, JsonSchema)] +#[derive(Clone, Debug, PartialEq, Fragment, JsonSchema)] #[fragment_attrs( derive( Clone,