@@ -79,10 +79,11 @@ impl ResolvedS3Connection {
79
79
/// * Needed TLS volumes
80
80
pub fn add_volumes_and_mounts (
81
81
& self ,
82
+ unique_identifier : & str ,
82
83
pod_builder : & mut PodBuilder ,
83
84
container_builders : Vec < & mut ContainerBuilder > ,
84
85
) -> Result < ( ) , S3Error > {
85
- let ( volumes, mounts) = self . volumes_and_mounts ( ) ?;
86
+ let ( volumes, mounts) = self . volumes_and_mounts ( unique_identifier ) ?;
86
87
pod_builder. add_volumes ( volumes) ;
87
88
for cb in container_builders {
88
89
cb. add_volume_mounts ( mounts. clone ( ) ) ;
@@ -93,22 +94,28 @@ impl ResolvedS3Connection {
93
94
94
95
/// It is recommended to use [`Self::add_volumes_and_mounts`], this function returns you the
95
96
/// volumes and mounts in case you need to add them by yourself.
96
- pub fn volumes_and_mounts ( & self ) -> Result < ( Vec < Volume > , Vec < VolumeMount > ) , S3Error > {
97
+ pub fn volumes_and_mounts (
98
+ & self ,
99
+ unique_identifier : & str ,
100
+ ) -> Result < ( Vec < Volume > , Vec < VolumeMount > ) , S3Error > {
97
101
let mut volumes = Vec :: new ( ) ;
98
102
let mut mounts = Vec :: new ( ) ;
99
103
100
104
if let Some ( credentials) = & self . credentials {
101
105
let secret_class = & credentials. secret_class ;
102
- let volume_name = format ! ( "{secret_class}-s3-credentials" ) ;
106
+ let volume_name = format ! ( "{secret_class}-s3-credentials-{unique_identifier} " ) ;
103
107
104
108
volumes. push (
105
109
credentials
106
110
. to_volume ( & volume_name)
107
111
. context ( AddS3CredentialVolumesSnafu ) ?,
108
112
) ;
109
113
mounts. push (
110
- VolumeMountBuilder :: new ( volume_name, format ! ( "{SECRET_BASE_PATH}/{secret_class}" ) )
111
- . build ( ) ,
114
+ VolumeMountBuilder :: new (
115
+ volume_name,
116
+ format ! ( "{SECRET_BASE_PATH}/{secret_class}-{unique_identifier}" ) ,
117
+ )
118
+ . build ( ) ,
112
119
) ;
113
120
}
114
121
@@ -125,12 +132,12 @@ impl ResolvedS3Connection {
125
132
126
133
/// Returns the path of the files containing bind user and password.
127
134
/// This will be None if there are no credentials for this LDAP connection.
128
- pub fn credentials_mount_paths ( & self ) -> Option < ( String , String ) > {
135
+ pub fn credentials_mount_paths ( & self , unique_identifier : & str ) -> Option < ( String , String ) > {
129
136
self . credentials . as_ref ( ) . map ( |bind_credentials| {
130
137
let secret_class = & bind_credentials. secret_class ;
131
138
(
132
- format ! ( "{SECRET_BASE_PATH}/{secret_class}/accessKey" ) ,
133
- format ! ( "{SECRET_BASE_PATH}/{secret_class}/secretKey" ) ,
139
+ format ! ( "{SECRET_BASE_PATH}/{secret_class}-{unique_identifier} /accessKey" ) ,
140
+ format ! ( "{SECRET_BASE_PATH}/{secret_class}-{unique_identifier} /secretKey" ) ,
134
141
)
135
142
} )
136
143
}
@@ -198,7 +205,7 @@ mod test {
198
205
credentials : None ,
199
206
tls : TlsClientDetails { tls : None } ,
200
207
} ;
201
- let ( volumes, mounts) = s3. volumes_and_mounts ( ) . unwrap ( ) ;
208
+ let ( volumes, mounts) = s3. volumes_and_mounts ( "lakehouse" ) . unwrap ( ) ;
202
209
203
210
assert_eq ! ( s3. endpoint( ) . unwrap( ) , Url :: parse( "http://minio" ) . unwrap( ) ) ;
204
211
assert_eq ! ( volumes, vec![ ] ) ;
@@ -223,7 +230,7 @@ mod test {
223
230
} ) ,
224
231
} ,
225
232
} ;
226
- let ( mut volumes, mut mounts) = s3. volumes_and_mounts ( ) . unwrap ( ) ;
233
+ let ( mut volumes, mut mounts) = s3. volumes_and_mounts ( "lakehouse" ) . unwrap ( ) ;
227
234
228
235
assert_eq ! (
229
236
s3. endpoint( ) . unwrap( ) ,
@@ -234,7 +241,10 @@ mod test {
234
241
assert_eq ! ( mounts. len( ) , 1 ) ;
235
242
let mount = mounts. remove ( 0 ) ;
236
243
237
- assert_eq ! ( & volume. name, "ionos-s3-credentials-s3-credentials" ) ;
244
+ assert_eq ! (
245
+ & volume. name,
246
+ "ionos-s3-credentials-s3-credentials-lakehouse"
247
+ ) ;
238
248
assert_eq ! (
239
249
& volume
240
250
. ephemeral
@@ -252,12 +262,15 @@ mod test {
252
262
) ;
253
263
254
264
assert_eq ! ( mount. name, volume. name) ;
255
- assert_eq ! ( mount. mount_path, "/stackable/secrets/ionos-s3-credentials" ) ;
256
265
assert_eq ! (
257
- s3. credentials_mount_paths( ) ,
266
+ mount. mount_path,
267
+ "/stackable/secrets/ionos-s3-credentials-lakehouse"
268
+ ) ;
269
+ assert_eq ! (
270
+ s3. credentials_mount_paths( "lakehouse" ) ,
258
271
Some ( (
259
- "/stackable/secrets/ionos-s3-credentials/accessKey" . to_string( ) ,
260
- "/stackable/secrets/ionos-s3-credentials/secretKey" . to_string( )
272
+ "/stackable/secrets/ionos-s3-credentials-lakehouse /accessKey" . to_string( ) ,
273
+ "/stackable/secrets/ionos-s3-credentials-lakehouse /secretKey" . to_string( )
261
274
) )
262
275
) ;
263
276
}
@@ -275,7 +288,7 @@ mod test {
275
288
} ) ,
276
289
} ,
277
290
} ;
278
- let ( volumes, mounts) = s3. volumes_and_mounts ( ) . unwrap ( ) ;
291
+ let ( volumes, mounts) = s3. volumes_and_mounts ( "lakehouse" ) . unwrap ( ) ;
279
292
280
293
assert_eq ! (
281
294
s3. endpoint( ) . unwrap( ) ,
0 commit comments