Skip to content

Conversation

@sbernauer
Copy link
Member

@sbernauer sbernauer commented Nov 11, 2025

Description

Part of stackabletech/issues#712
Decision: https://github.com/stackabletech/decisions/issues/64
Needs stackabletech/documentation#807 for the documentation part

The actual code change is oversee-able, most of the added lines are tests.

Definition of Done Checklist

  • Not all of these items are applicable to all PRs, the author should update this template to only leave the boxes in that are relevant
  • Please make sure all these things are done and tick the boxes

Author

  • Changes are OpenShift compatible
  • CRD changes approved
  • CRD documentation for all fields, following the style guide.
  • Integration tests passed (for non trivial changes)
  • Changes need to be "offline" compatible

Reviewer

  • Code contains useful comments
  • Code contains useful logging statements
  • (Integration-)Test cases added
  • Documentation added or updated. Follows the style guide.
  • Changelog updated
  • Cargo.toml only contains references to git tags (not specific commits or branches)

Acceptance

  • Feature Tracker has been updated
  • Proper release label has been added

@sbernauer sbernauer marked this pull request as ready for review November 20, 2025 15:24
@sbernauer sbernauer self-assigned this Nov 20, 2025
@sbernauer sbernauer moved this to Development: Waiting for Review in Stackable Engineering Nov 20, 2025
@sbernauer sbernauer requested a review from a team November 20, 2025 15:24
@Techassi Techassi self-requested a review November 20, 2025 15:30
Copy link
Member

@Techassi Techassi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly lgtm, a few various question, comments and suggestions.

Comment on lines +7 to +9
### Added

- Support `objectOverrides` ([#1118]).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: I think we should add a small explanation how this works/what this does.

Comment on lines +16 to +18
### Removed

- BREAKING: `ClusterResources` no longer derives `Eq` and `PartialEq` ([#1118]).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: Whats the reason those two trait implementations are removed?

let mutated = resource.maybe_mutate(&self.apply_strategy);
let mut mutated = resource.maybe_mutate(&self.apply_strategy);

// We apply the object overrides of the user at the very last to offer maximum flexibility.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// We apply the object overrides of the user at the very last to offer maximum flexibility.
// We apply the object overrides of the user at the very end to offer maximum flexibility.

Comment on lines +24 to +38
merge_strategies::map::granular(
&mut self.extra_pod_selector_labels,
other.extra_pod_selector_labels,
|current_item, other_item| {
DeepMerge::merge_from(current_item, other_item);
},
);
merge_strategies::list::map(
&mut self.ports,
other.ports,
&[|lhs, rhs| lhs.name == rhs.name],
|current_item, other_item| {
DeepMerge::merge_from(current_item, other_item);
},
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: Please add two dev comments to quickly explain what this code does and why we need this specialized merge.

Comment on lines +49 to +63
merge_strategies::list::map(
&mut self.ingress_addresses,
other.ingress_addresses,
&[|lhs, rhs| lhs.address == rhs.address],
|current_item, other_item| {
DeepMerge::merge_from(current_item, other_item);
},
);
merge_strategies::map::granular(
&mut self.node_ports,
other.node_ports,
|current_item, other_item| {
DeepMerge::merge_from(current_item, other_item);
},
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: Same as above.

let Some(patch_type) = &patch.types else {
return Ok(());
};
if patch_type.api_version != R::api_version(&()) || patch_type.kind != R::kind(&()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if patch_type.api_version != R::api_version(&()) || patch_type.kind != R::kind(&()) {
if object_type.api_version != R::api_version(&()) || object_type.kind != R::kind(&()) {

if patch_type.api_version != R::api_version(&()) || patch_type.kind != R::kind(&()) {
return Ok(());
}
let Some(patch_name) = &patch.metadata.name else {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
let Some(patch_name) = &patch.metadata.name else {
let Some(object_name) = &override.metadata.name else {


let deserialized_patch =
patch
.clone()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: If we need to clone every single override anyway, we should instead take an owned value (in both functions). Taking a reference is signaling that no owned data is needed, which is not true. We should make this clear when these functions are called.


/// Using [`serde_yaml`] to generate the test data
fn generate_service_account() -> ServiceAccount {
serde_yaml::from_str(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: Again, I would like to see this (and all other inline YAML strings) getting moved into actual YAML files.

Comment on lines +118 to +119
/// Generate the test data programmatically (as operators would normally do)
fn generate_stateful_set() -> StatefulSet {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: But, do we need to? I feel like this can also be a static YAML file (to actually only test the merging/overrides).

@Techassi Techassi moved this from Development: Waiting for Review to Development: In Review in Stackable Engineering Nov 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Development: In Review

Development

Successfully merging this pull request may close these issues.

3 participants