diff --git a/crates/stackable-operator/CHANGELOG.md b/crates/stackable-operator/CHANGELOG.md index 83e9d218a..ce8e1be1e 100644 --- a/crates/stackable-operator/CHANGELOG.md +++ b/crates/stackable-operator/CHANGELOG.md @@ -8,6 +8,11 @@ All notable changes to this project will be documented in this file. - Implement `PartialEq` for most _Snafu_ Error enums ([#757]). +## Fixed + +- Fix wrong schema (and thus CRD) for `config.affinity.nodeSelector` ([#752]). + +[#752]: https://github.com/stackabletech/operator-rs/pull/752 [#757]: https://github.com/stackabletech/operator-rs/pull/757 ## [0.65.0] - 2024-03-25 diff --git a/crates/stackable-operator/src/commons/affinity.rs b/crates/stackable-operator/src/commons/affinity.rs index 6bbaf8ff0..7973f9daa 100644 --- a/crates/stackable-operator/src/commons/affinity.rs +++ b/crates/stackable-operator/src/commons/affinity.rs @@ -42,8 +42,18 @@ pub struct StackableAffinity { pub node_selector: Option, } +// We can not simply use [`BTreeMap`] in [`StackableAffinity`], as the fields need to be [`Atomic`]. +// We can not mark it as [`Atomic`], as [`crate::config::fragment::FromFragment`] is already implemented for +// [`BTreeMap`]. +// +// We `#[serde(flatten)]` the contained [`BTreeMap`], so `serde_yaml` can deserialize everything as +// expected. +// FIXME: The generated JsonSchema will be wrong, so until https://github.com/GREsau/schemars/issues/259 is fixed, we +// need to use `#[schemars(deny_unknown_fields)]`. +// See https://github.com/stackabletech/operator-rs/pull/752#issuecomment-2017630433 for details. #[derive(Clone, Debug, Eq, Deserialize, JsonSchema, PartialEq, Serialize)] #[serde(rename_all = "camelCase")] +#[schemars(deny_unknown_fields)] pub struct StackableNodeSelector { #[serde(flatten)] pub node_selector: BTreeMap,