@@ -265,6 +265,7 @@ impl VolumeMountBuilder {
265
265
pub struct SecretOperatorVolumeSourceBuilder {
266
266
secret_class : String ,
267
267
scopes : Vec < SecretOperatorVolumeScope > ,
268
+ format : Option < SecretFormat > ,
268
269
kerberos_service_names : Vec < String > ,
269
270
}
270
271
@@ -273,6 +274,7 @@ impl SecretOperatorVolumeSourceBuilder {
273
274
Self {
274
275
secret_class : secret_class. into ( ) ,
275
276
scopes : Vec :: new ( ) ,
277
+ format : None ,
276
278
kerberos_service_names : Vec :: new ( ) ,
277
279
}
278
280
}
@@ -293,6 +295,11 @@ impl SecretOperatorVolumeSourceBuilder {
293
295
self
294
296
}
295
297
298
+ pub fn with_format ( & mut self , format : SecretFormat ) -> & mut Self {
299
+ self . format = Some ( format) ;
300
+ self
301
+ }
302
+
296
303
pub fn with_kerberos_service_name ( & mut self , name : impl Into < String > ) -> & mut Self {
297
304
self . kerberos_service_names . push ( name. into ( ) ) ;
298
305
self
@@ -322,6 +329,13 @@ impl SecretOperatorVolumeSourceBuilder {
322
329
attrs. insert ( "secrets.stackable.tech/scope" . to_string ( ) , scopes) ;
323
330
}
324
331
332
+ if let Some ( format) = & self . format {
333
+ attrs. insert (
334
+ "secrets.stackable.tech/format" . to_string ( ) ,
335
+ format. as_ref ( ) . to_string ( ) ,
336
+ ) ;
337
+ }
338
+
325
339
if !self . kerberos_service_names . is_empty ( ) {
326
340
attrs. insert (
327
341
"secrets.stackable.tech/kerberos.service.names" . to_string ( ) ,
@@ -346,6 +360,20 @@ impl SecretOperatorVolumeSourceBuilder {
346
360
}
347
361
}
348
362
363
+ /// A [secret format](https://docs.stackable.tech/home/stable/secret-operator/secretclass.html#format) known by secret-operator.
364
+ ///
365
+ /// This must either match or be convertible from the corresponding secret class, or provisioning the volume will fail.
366
+ #[ derive( Clone , strum:: AsRefStr ) ]
367
+ #[ strum( serialize_all = "kebab-case" ) ]
368
+ pub enum SecretFormat {
369
+ /// A TLS certificate formatted as a PEM triple (`ca.crt`, `tls.crt`, `tls.key`) according to Kubernetes conventions.
370
+ TlsPem ,
371
+ /// A TLS certificate formatted as a PKCS#12 store.
372
+ TlsPkcs12 ,
373
+ /// A Kerberos keytab.
374
+ Kerberos ,
375
+ }
376
+
349
377
#[ derive( Clone ) ]
350
378
enum SecretOperatorVolumeScope {
351
379
Node ,
0 commit comments