diff --git a/CHANGELOG.md b/CHANGELOG.md index 68dfb0bc..b1098b35 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,7 +27,7 @@ All notable changes to this project will be documented in this file. templates (all previously set to the placeholder value `none`). After the operator upgrade, delete each coordinator StatefulSet so that the operator immediately recreates it with the new labels ([#932]). -- Make operations infallible where dependent on static inputs ([#939]). +- Make operations infallible where dependent on static inputs ([#939], [#943]). ### Fixed @@ -48,6 +48,7 @@ All notable changes to this project will be documented in this file. [#932]: https://github.com/stackabletech/trino-operator/pull/932 [#934]: https://github.com/stackabletech/trino-operator/pull/934 [#939]: https://github.com/stackabletech/trino-operator/pull/939 +[#943]: https://github.com/stackabletech/trino-operator/pull/943 ## [26.7.0] - 2026-07-21 diff --git a/rust/operator-binary/src/authentication/password/file.rs b/rust/operator-binary/src/authentication/password/file.rs index 5b41f0f8..46ea1133 100644 --- a/rust/operator-binary/src/authentication/password/file.rs +++ b/rust/operator-binary/src/authentication/password/file.rs @@ -133,13 +133,14 @@ pub fn build_password_file_update_container( resolved_product_image: &ResolvedProductImage, volume_mounts: Vec, ) -> Result { - let mut cb_pw_file_updater = new_container_builder(&crate::crd::Container::PasswordFileUpdater); + let mut cb_pw_file_updater = + new_container_builder(crate::crd::Container::PasswordFileUpdater.name()); let mut commands = vec![]; commands.push(product_logging::framework::capture_shell_output( STACKABLE_LOG_DIR, - &crate::crd::Container::PasswordFileUpdater.to_string(), + crate::crd::Container::PasswordFileUpdater.name().as_ref(), // we do not access any of the crd config options for this and just log it to file &AutomaticContainerLogConfig::default(), )); diff --git a/rust/operator-binary/src/controller/build/graceful_shutdown.rs b/rust/operator-binary/src/controller/build/graceful_shutdown.rs index c4f875a0..3f000bd2 100644 --- a/rust/operator-binary/src/controller/build/graceful_shutdown.rs +++ b/rust/operator-binary/src/controller/build/graceful_shutdown.rs @@ -315,7 +315,7 @@ mod tests { .expect("the fixture defines a worker role group") .config; let mut pod_builder = PodBuilder::new(); - let mut trino_builder = new_container_builder(&Container::Trino); + let mut trino_builder = new_container_builder(Container::Trino.name()); add_graceful_shutdown_config( &cluster, &TrinoRole::Worker, @@ -354,7 +354,7 @@ mod tests { .expect("the fixture defines a coordinator role group") .config; let mut pod_builder = PodBuilder::new(); - let mut trino_builder = new_container_builder(&Container::Trino); + let mut trino_builder = new_container_builder(Container::Trino.name()); add_graceful_shutdown_config( &cluster, &TrinoRole::Coordinator, diff --git a/rust/operator-binary/src/controller/build/properties/config_properties.rs b/rust/operator-binary/src/controller/build/properties/config_properties.rs index e36cdf98..c8754d7d 100644 --- a/rust/operator-binary/src/controller/build/properties/config_properties.rs +++ b/rust/operator-binary/src/controller/build/properties/config_properties.rs @@ -102,7 +102,7 @@ pub fn build( LOG_PATH.to_string(), format!( "{STACKABLE_LOG_DIR}/{container}/server.airlift.json", - container = Container::Trino + container = Container::Trino.name() ), ); props.insert(LOG_COMPRESSION.to_string(), "none".to_string()); diff --git a/rust/operator-binary/src/controller/build/resource/statefulset.rs b/rust/operator-binary/src/controller/build/resource/statefulset.rs index 0baeae6c..a7597d39 100644 --- a/rust/operator-binary/src/controller/build/resource/statefulset.rs +++ b/rust/operator-binary/src/controller/build/resource/statefulset.rs @@ -159,8 +159,8 @@ pub fn build_rolegroup_statefulset( let config_map_name = resource_names.role_group_config_map().to_string(); let mut pod_builder = PodBuilder::new(); - let mut cb_prepare = new_container_builder(&Container::Prepare); - let mut cb_trino = new_container_builder(&Container::Trino); + let mut cb_prepare = new_container_builder(Container::Prepare.name()); + let mut cb_trino = new_container_builder(Container::Trino.name()); // Operator-set env vars first; the user's `envOverrides` are merged on top last and win. let mut env = EnvVarSet::new(); @@ -320,7 +320,7 @@ pub fn build_rolegroup_statefulset( { prepare_args.push(product_logging::framework::capture_shell_output( STACKABLE_LOG_DIR, - &Container::Prepare.to_string(), + Container::Prepare.name().as_ref(), log_config, )); } @@ -396,7 +396,7 @@ pub fn build_rolegroup_statefulset( if let Some(vector_log_config) = &merged_config.logging.vector_container { pod_builder.add_container(vector_container( - &Container::Vector, + Container::Vector.name(), resolved_product_image, vector_log_config, &resource_names, diff --git a/rust/operator-binary/src/crd/mod.rs b/rust/operator-binary/src/crd/mod.rs index e8e01279..b6529bd4 100644 --- a/rust/operator-binary/src/crd/mod.rs +++ b/rust/operator-binary/src/crd/mod.rs @@ -469,10 +469,9 @@ constant!(VECTOR_CONTAINER_NAME: ContainerName = "vector"); constant!(PASSWORD_FILE_UPDATER_CONTAINER_NAME: ContainerName = "password-file-updater"); constant!(TRINO_CONTAINER_NAME: ContainerName = "trino"); -impl Deref for Container { - type Target = ContainerName; - - fn deref(&self) -> &Self::Target { +impl Container { + /// The typed container name of this variant. + pub fn name(&self) -> &'static ContainerName { match self { Container::Prepare => &PREPARE_CONTAINER_NAME, Container::Vector => &VECTOR_CONTAINER_NAME, @@ -640,13 +639,12 @@ mod tests { let _ = *TRINO_CONTAINER_NAME; } - /// The typed container names behind `Container`'s `Deref` must agree with its strum `Display`, - /// which the rest of the operator still uses for log capture and container lookups. + /// The typed container names returned by `name` must agree with the strum `Display` of + /// `Container`, which operator-rs's `Logging` requires and uses in error messages. #[test] fn container_names_match_display() { for container in Container::iter() { - let container_name: &ContainerName = &container; - assert_eq!(container_name.to_string(), container.to_string()); + assert_eq!(container.name().to_string(), container.to_string()); } }