@@ -28,20 +28,15 @@ pub enum Error {
28
28
29
29
#[ snafu( display(
30
30
"The volumeMount is clashing with an already existing volumeMount with the same mountPath but a different content. \
31
- The shared mountPath is {mount_path:?}, \
32
- the existing mount's volume name is {existing_volume_name:?}, \
33
- the existing mount's subPath is {existing_sub_path:?}, \
34
- the new mount's volume name is {new_volume_name:?}, \
35
- the new mount's subPath is {new_sub_path:?}"
31
+ The clashing mountPath is {clashing_mount_path:?}, \
32
+ the existing mount's volume name is {existing_volume_name:?} \
33
+ and the new mount's volume name is {new_volume_name:?}. \
34
+ Please have a look at the log/traces for details"
36
35
) ) ]
37
36
ClashingMountPath {
38
- // The VolumeMount structs where not added to avoid to many information for the users. Instead we pick the most
39
- // relevant information only.
40
- mount_path : String ,
37
+ clashing_mount_path : String ,
41
38
existing_volume_name : String ,
42
- existing_sub_path : Option < String > ,
43
39
new_volume_name : String ,
44
- new_sub_path : Option < String > ,
45
40
} ,
46
41
}
47
42
@@ -226,14 +221,21 @@ impl ContainerBuilder {
226
221
/// two times, resulting in e.g. the s3 credentials being mounted twice as the same volumeMount.
227
222
fn add_volume_mount_impl ( & mut self , volume_mount : VolumeMount ) -> Result < & mut Self > {
228
223
if let Some ( existing_volume_mount) = self . volume_mounts . get ( & volume_mount. mount_path ) {
224
+ // We don't want to include the details in the error message, but instead trace them
225
+ if existing_volume_mount != & volume_mount {
226
+ tracing:: error!(
227
+ clashing_mount_path = & volume_mount. mount_path,
228
+ ?existing_volume_mount,
229
+ new_volume_mount = ?volume_mount,
230
+ "The volumeMount is clashing with an already existing volumeMount with the same mountPath but a different content"
231
+ ) ;
232
+ }
229
233
ensure ! (
230
234
existing_volume_mount == & volume_mount,
231
235
ClashingMountPathSnafu {
232
- mount_path : volume_mount. mount_path,
236
+ clashing_mount_path : volume_mount. mount_path,
233
237
existing_volume_name: existing_volume_mount. name. clone( ) ,
234
- existing_sub_path: existing_volume_mount. sub_path. clone( ) ,
235
238
new_volume_name: volume_mount. name,
236
- new_sub_path: volume_mount. sub_path,
237
239
}
238
240
) ;
239
241
} else {
0 commit comments