Skip to content

Commit 58c7092

Browse files
committed
docs :P
1 parent cc6f5ae commit 58c7092

File tree

2 files changed

+35
-15
lines changed

2 files changed

+35
-15
lines changed

crates/stackable-operator/src/builder/pod/container.rs

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::fmt;
22

33
#[cfg(doc)]
4-
use std::collections::BTreeMap;
4+
use {k8s_openapi::api::core::v1::PodSpec, std::collections::BTreeMap};
55

66
use indexmap::IndexMap;
77
use k8s_openapi::api::core::v1::{
@@ -210,13 +210,17 @@ impl ContainerBuilder {
210210
self
211211
}
212212

213-
/// This function only adds the [`VolumeMount`] in case there is no volumeMount with the same mountPath already.
214-
/// In case there already was a volumeMount with the same path already, an [`tracing::error`] is raised in case the
215-
/// contents of the volumeMounts differ.
213+
/// Adds a new [`VolumeMount`] to the container while ensuring that no colliding [`VolumeMount`]
214+
/// exists.
216215
///
217-
/// Historically this function unconditionally added volumeMounts, which resulted in invalid
218-
/// [`k8s_openapi::api::core::v1::PodSpec`]s, as volumeMounts where added multiple times - think of Trino using the same [`crate::commons::s3::S3Connection`]
219-
/// two times, resulting in e.g. the s3 credentials being mounted twice as the same volumeMount.
216+
/// A colliding [`VolumeMount`] would have the same mountPath but a different content than
217+
/// another [`VolumeMount`]. An appropriate error is returned when such a clashing mount path is
218+
/// encountered.
219+
///
220+
/// ### Note
221+
///
222+
/// Previously, this function unconditionally added [`VolumeMount`]s, which resulted in invalid
223+
/// [`PodSpec`]s.
220224
#[instrument(skip(self))]
221225
fn add_volume_mount_impl(&mut self, volume_mount: VolumeMount) -> Result<&mut Self> {
222226
if let Some(existing_volume_mount) = self.volume_mounts.get(&volume_mount.mount_path) {
@@ -243,7 +247,17 @@ impl ContainerBuilder {
243247
Ok(self)
244248
}
245249

246-
/// See [`Self::add_volume_mount_impl`] for details
250+
/// Adds a new [`VolumeMount`] to the container while ensuring that no colliding [`VolumeMount`]
251+
/// exists.
252+
///
253+
/// A colliding [`VolumeMount`] would have the same mountPath but a different content than
254+
/// another [`VolumeMount`]. An appropriate error is returned when such a clashing mount path is
255+
/// encountered.
256+
///
257+
/// ### Note
258+
///
259+
/// Previously, this function unconditionally added [`VolumeMount`]s, which resulted in invalid
260+
/// [`PodSpec`]s.
247261
pub fn add_volume_mount(
248262
&mut self,
249263
name: impl Into<String>,
@@ -256,7 +270,10 @@ impl ContainerBuilder {
256270
})
257271
}
258272

259-
/// See [`Self::add_volume_mount_impl`] for details
273+
/// Adds new [`VolumeMount`]s to the container while ensuring that no colliding [`VolumeMount`]
274+
/// exists.
275+
///
276+
/// See [`Self::add_volume_mount`] for details.
260277
pub fn add_volume_mounts(
261278
&mut self,
262279
volume_mounts: impl IntoIterator<Item = VolumeMount>,

crates/stackable-operator/src/builder/pod/mod.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -278,13 +278,16 @@ impl PodBuilder {
278278
)
279279
}
280280

281-
/// This function only adds the [`Volume`] in case there is no volume with the same name already.
282-
/// In case there already was a volume with the same name already, an [`tracing::error`] is raised in case the
283-
/// contents of the volumes differ.
281+
/// Adds a new [`Volume`] to the container while ensuring that no colliding [`Volume`] exists.
284282
///
285-
/// Historically this function unconditionally added volumes, which resulted in invalid [`PodSpec`]s, as volumes
286-
/// where added multiple times - think of Trino using the same [`crate::commons::s3::S3Connection`] two times,
287-
/// resulting in e.g. the s3 credentials being mounted twice as the sake volume.
283+
/// A colliding [`Volume`] would have the same name but a different content than another
284+
/// [`Volume`]. An appropriate error is returned when such a clashing volume name is
285+
/// encountered.
286+
///
287+
/// ### Note
288+
///
289+
/// Previously, this function unconditionally added [`Volume`]s, which resulted in invalid
290+
/// [`PodSpec`]s.
288291
#[instrument(skip(self))]
289292
pub fn add_volume(&mut self, volume: Volume) -> Result<&mut Self> {
290293
if let Some(existing_volume) = self.volumes.get(&volume.name) {

0 commit comments

Comments
 (0)