Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions crates/stackable-operator/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ All notable changes to this project will be documented in this file.

- BREAKING: Add a new CLI flag/env to disabling CRD maintenance: `--disable-crd-maintenance` ([#1085]).

### Removed

- BREAKING: Remove the Merge implementation for PodTemplateSpec ([#1087]).
It was broken because the instance was overriden by the given defaults.
This function is not used by the Stackable operators.

[#1085]: https://github.com/stackabletech/operator-rs/pull/1085
[#1087]: https://github.com/stackabletech/operator-rs/pull/1087

## [0.96.0] - 2025-08-25

Expand Down
65 changes: 1 addition & 64 deletions crates/stackable-operator/src/config/merge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ use std::{
};

use k8s_openapi::{
DeepMerge,
api::core::v1::{NodeAffinity, PodAffinity, PodAntiAffinity, PodTemplateSpec},
api::core::v1::{NodeAffinity, PodAffinity, PodAntiAffinity},
apimachinery::pkg::{api::resource::Quantity, apis::meta::v1::LabelSelector},
};
pub use stackable_operator_derive::Merge;
Expand Down Expand Up @@ -87,11 +86,6 @@ impl<K: Hash + Eq + Clone, V: Merge + Clone> Merge for HashMap<K, V> {
}
}
}
impl Merge for PodTemplateSpec {
fn merge(&mut self, defaults: &Self) {
self.merge_from(defaults.clone())
}
}

/// Moving version of [`Merge::merge`], to produce slightly nicer test output
pub fn merge<T: Merge>(mut overrides: T, defaults: &T) -> T {
Expand Down Expand Up @@ -163,8 +157,6 @@ impl<T: Atomic> Merge for Option<T> {
mod tests {
use std::collections::{BTreeMap, HashMap};

use k8s_openapi::api::core::v1::{PodSpec, PodTemplateSpec};

use super::{Merge, merge};

#[derive(Debug, PartialEq, Eq, Clone)]
Expand Down Expand Up @@ -437,59 +429,4 @@ mod tests {
BTreeMap::from([("a", Acc(4)), ("b", Acc(2)), ("c", Acc(5))])
);
}

#[test]
fn merge_pod_template_spec() {
assert_eq!(
merge(
PodTemplateSpec {
spec: Some(PodSpec {
service_account_name: Some("my-sa".to_string()),
..PodSpec::default()
}),
..PodTemplateSpec::default()
},
&PodTemplateSpec {
spec: Some(PodSpec {
priority: Some(3000),
..PodSpec::default()
}),
..PodTemplateSpec::default()
}
),
PodTemplateSpec {
spec: Some(PodSpec {
service_account_name: Some("my-sa".to_string()),
priority: Some(3000),
..PodSpec::default()
}),
..PodTemplateSpec::default()
}
);
assert_eq!(
merge(
PodTemplateSpec {
spec: Some(PodSpec {
service_account_name: Some("sa-to-be-overridden".to_string()),
..PodSpec::default()
}),
..PodTemplateSpec::default()
},
&PodTemplateSpec {
spec: Some(PodSpec {
service_account_name: Some("sa-override".to_string()),
..PodSpec::default()
}),
..PodTemplateSpec::default()
}
),
PodTemplateSpec {
spec: Some(PodSpec {
service_account_name: Some("sa-override".to_string()),
..PodSpec::default()
}),
..PodTemplateSpec::default()
}
);
}
}