Skip to content
Merged
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ All notable changes to this project will be documented in this file.
StatefulSets created by older operator versions cannot be updated in place: after the
operator upgrade, delete each metastore StatefulSet so that the operator immediately recreates it with
the new labels ([#748]).
- Make operations infallible where dependent on static inputs ([#759]).
- Make operations infallible where dependent on static inputs ([#759], [#764]).

### Fixed

Expand All @@ -44,6 +44,7 @@ All notable changes to this project will be documented in this file.
[#748]: https://github.com/stackabletech/hive-operator/pull/748
[#754]: https://github.com/stackabletech/hive-operator/pull/754
[#759]: https://github.com/stackabletech/hive-operator/pull/759
[#764]: https://github.com/stackabletech/hive-operator/pull/764

## [26.7.0] - 2026-07-21

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ pub(crate) fn build_metastore_rolegroup_statefulset(
let merged_config = &rg.config;
let hive_opa_config = cluster.cluster_config.hive_opa_config.as_ref();

let mut container_builder = new_container_builder(&Container::Hive.to_container_name());
let mut container_builder = new_container_builder(Container::Hive.name());

// Operator-set env vars first; the user's `envOverrides` are merged on top last and win.
let mut env = EnvVarSet::new()
Expand Down Expand Up @@ -455,7 +455,7 @@ pub(crate) fn build_metastore_rolegroup_statefulset(
// default, is started first and can provide any dependencies that vector expects
if let Some(vector_log_config) = &rg.config.logging.vector_container {
pod_builder.add_container(vector_container(
&Container::Vector.to_container_name(),
Container::Vector.name(),
resolved_product_image,
vector_log_config,
&resource_names,
Expand Down Expand Up @@ -612,7 +612,7 @@ mod tests {
.expect("the pod template has a spec")
.containers
.into_iter()
.find(|container| container.name == Container::Hive.to_container_name().to_string())
.find(|container| container.name == Container::Hive.name().to_string())
.expect("the hive container exists")
.env
.expect("the hive container has env vars")
Expand Down
27 changes: 23 additions & 4 deletions rust/operator-binary/src/crd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,11 +293,18 @@ pub enum Container {
Vector,
}

// Typed container names. They must match the strum `Display` (kebab-case) of the variants above,
// which is pinned by a unit test.
constant!(HIVE_CONTAINER_NAME: ContainerName = "hive");
constant!(VECTOR_CONTAINER_NAME: ContainerName = "vector");

impl Container {
/// The type-safe container name for this variant (matching its kebab-case serialization).
pub fn to_container_name(&self) -> ContainerName {
ContainerName::from_str(&self.to_string())
.expect("a Container variant name is a valid container name")
/// The typed container name of this variant.
pub fn name(&self) -> &'static ContainerName {
match self {
Container::Hive => &HIVE_CONTAINER_NAME,
Container::Vector => &VECTOR_CONTAINER_NAME,
}
}
}

Expand Down Expand Up @@ -396,6 +403,7 @@ pub struct HiveClusterStatus {
#[cfg(test)]
mod tests {
use stackable_operator::versioned::test_utils::RoundtripTestData;
use strum::IntoEnumIterator;

use super::*;

Expand All @@ -408,6 +416,17 @@ mod tests {
let _ = *STACKABLE_CONFIG_MOUNT_DIR_NAME;
let _ = *STACKABLE_LOG_DIR_NAME;
let _ = *STACKABLE_LOG_CONFIG_MOUNT_DIR_NAME;
let _ = *HIVE_CONTAINER_NAME;
let _ = *VECTOR_CONTAINER_NAME;
}

/// The typed container names returned by `name` must agree with the strum `Display`
/// of `Container`, which the logging configuration still uses as the per-container key.
#[test]
fn container_names_match_display() {
for container in Container::iter() {
assert_eq!(container.name().to_string(), container.to_string());
}
}

impl RoundtripTestData for v1alpha1::HiveClusterSpec {
Expand Down
Loading