Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
9 changes: 9 additions & 0 deletions crates/stackable-operator/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

## [0.77.1] - 2024-09-27

### Fixed

- Fix always returning an error stating that volumeMounts are colliding. Instead move the error
creation to the correct location within an `if` statement ([#879]).

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

## [0.77.0] - 2024-09-26

### Fixed
Expand Down
17 changes: 9 additions & 8 deletions crates/stackable-operator/src/builder/pod/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ pub enum Error {
},

#[snafu(display(
"Colliding mountPath {mount_path:?} in volumeMounts with different content. \
"Colliding mountPath {colliding_mount_path:?} in volumeMounts with different content. \
Existing volume name {existing_volume_name:?}, new volume name {new_volume_name:?}"
))]
MountPathCollision {
mount_path: String,
colliding_mount_path: String,
existing_volume_name: String,
new_volume_name: String,
},
Expand Down Expand Up @@ -232,13 +232,14 @@ impl ContainerBuilder {
?existing_volume_mount,
"Colliding mountPath {colliding_mount_path:?} in volumeMounts with different content"
);

MountPathCollisionSnafu {
colliding_mount_path,
existing_volume_name: &existing_volume_mount.name,
new_volume_name: &volume_mount.name,
}
.fail()?;
}
MountPathCollisionSnafu {
mount_path: &volume_mount.mount_path,
existing_volume_name: &existing_volume_mount.name,
new_volume_name: &volume_mount.name,
}
.fail()?;
} else {
self.volume_mounts
.insert(volume_mount.mount_path.clone(), volume_mount);
Expand Down
14 changes: 8 additions & 6 deletions crates/stackable-operator/src/builder/pod/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ pub enum Error {
#[snafu(display("object is missing key {key:?}"))]
MissingObjectKey { key: &'static str },

#[snafu(display("Colliding volume name {volume_name:?} in volumes with different content"))]
VolumeNameCollision { volume_name: String },
#[snafu(display(
"Colliding volume name {colliding_volume_name:?} in volumes with different content"
))]
VolumeNameCollision { colliding_volume_name: String },
}

/// A builder to build [`Pod`] or [`PodTemplateSpec`] objects.
Expand Down Expand Up @@ -292,16 +294,16 @@ impl PodBuilder {
pub fn add_volume(&mut self, volume: Volume) -> Result<&mut Self> {
if let Some(existing_volume) = self.volumes.get(&volume.name) {
if existing_volume != &volume {
let colliding_name = &volume.name;
let colliding_volume_name = &volume.name;
// We don't want to include the details in the error message, but instead trace them
tracing::error!(
colliding_name,
colliding_volume_name,
?existing_volume,
"Colliding volume name {colliding_name:?} in volumes with different content"
"Colliding volume name {colliding_volume_name:?} in volumes with different content"
);

VolumeNameCollisionSnafu {
volume_name: &volume.name,
colliding_volume_name,
}
.fail()?;
}
Expand Down
Loading