Skip to content

Commit 20fa37e

Browse files
authored
Merge branch 'main' into refactor/add-host-struct
2 parents decfb05 + 17054c3 commit 20fa37e

31 files changed

+533
-194
lines changed

Cargo.lock

Lines changed: 40 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ signature = "2.2.0"
5858
snafu = "0.8.4"
5959
stackable-operator-derive = { path = "stackable-operator-derive" }
6060
strum = { version = "0.26.3", features = ["derive"] }
61-
syn = "2.0.72"
61+
syn = "2.0.77"
6262
tempfile = "3.11.0"
6363
time = { version = "0.3.36" }
6464
tokio = { version = "1.39.2", features = ["macros", "rt-multi-thread", "fs"] }

crates/stackable-operator/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,20 @@ All notable changes to this project will be documented in this file.
2828
### Changed
2929

3030
- BREAKING: `validation` module now uses typed errors ([#851]).
31+
- Set `checkIncrement` to 5 seconds in Logback config ([#853]).
3132

3233
### Fixed
3334

3435
- Fix the CRD description of `ClientAuthenticationDetails` to not contain internal Rust doc, but a public CRD description ([#846]).
3536
- `StackableAffinity` fields are no longer erroneously marked as required ([#855]).
37+
- BREAKING: `ClusterResources` will now only consider deleting objects that are marked as directly owned (via `.metadata.ownerReferences`) ([#862]).
3638

3739
[#846]: https://github.com/stackabletech/operator-rs/pull/846
3840
[#851]: https://github.com/stackabletech/operator-rs/pull/851
41+
[#853]: https://github.com/stackabletech/operator-rs/pull/853
3942
[#855]: https://github.com/stackabletech/operator-rs/pull/855
4043
[#858]: https://github.com/stackabletech/operator-rs/pull/858
44+
[#862]: https://github.com/stackabletech/operator-rs/pull/862
4145

4246
## [0.74.0] - 2024-08-22
4347

crates/stackable-operator/src/cluster_resources.rs

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,9 @@ pub struct ClusterResources {
388388
/// The name of the application
389389
app_name: String,
390390

391+
/// The uid of the cluster object
392+
cluster_uid: String,
393+
391394
// TODO (Techassi): Add doc comments
392395
operator_name: String,
393396

@@ -434,17 +437,22 @@ impl ClusterResources {
434437
) -> Result<Self> {
435438
let namespace = cluster
436439
.namespace
437-
.to_owned()
440+
.clone()
438441
.context(MissingObjectKeySnafu { key: "namespace" })?;
439442
let app_instance = cluster
440443
.name
441-
.to_owned()
444+
.clone()
442445
.context(MissingObjectKeySnafu { key: "name" })?;
446+
let cluster_uid = cluster
447+
.uid
448+
.clone()
449+
.context(MissingObjectKeySnafu { key: "uid" })?;
443450

444451
Ok(ClusterResources {
445452
namespace,
446453
app_instance,
447454
app_name: app_name.into(),
455+
cluster_uid,
448456
operator_name: operator_name.into(),
449457
controller_name: controller_name.into(),
450458
manager: format_full_controller_name(operator_name, controller_name),
@@ -741,10 +749,22 @@ impl ClusterResources {
741749
..Default::default()
742750
};
743751

744-
let resources = client
752+
let mut resources = client
745753
.list_with_label_selector::<T>(&self.namespace, &label_selector)
746754
.await?;
747755

756+
// filter out objects without a direct ownership relationship, for example:
757+
// - indirect ownership where the labels are still propagated
758+
// - objects owned by versions of the cluster recreated before/after the current snapshot
759+
resources.retain(|resource| {
760+
resource
761+
.meta()
762+
.owner_references
763+
.iter()
764+
.flatten()
765+
.any(|reference| reference.uid == self.cluster_uid)
766+
});
767+
748768
Ok(resources)
749769
}
750770
}

0 commit comments

Comments
 (0)