@@ -15,6 +15,7 @@ use tracing::warn;
1515use crate :: {
1616 builder:: meta:: ObjectMetaBuilder ,
1717 kvp:: { Annotation , AnnotationError , Annotations , LabelError , Labels } ,
18+ time:: Duration ,
1819} ;
1920
2021/// A builder to build [`Volume`] objects. May only contain one `volume_source`
@@ -280,6 +281,7 @@ pub struct SecretOperatorVolumeSourceBuilder {
280281 format : Option < SecretFormat > ,
281282 kerberos_service_names : Vec < String > ,
282283 tls_pkcs12_password : Option < String > ,
284+ auto_tls_cert_lifetime : Option < Duration > ,
283285}
284286
285287impl SecretOperatorVolumeSourceBuilder {
@@ -290,9 +292,15 @@ impl SecretOperatorVolumeSourceBuilder {
290292 format : None ,
291293 kerberos_service_names : Vec :: new ( ) ,
292294 tls_pkcs12_password : None ,
295+ auto_tls_cert_lifetime : None ,
293296 }
294297 }
295298
299+ pub fn with_auto_tls_cert_lifetime ( & mut self , lifetime : impl Into < Duration > ) -> & mut Self {
300+ self . auto_tls_cert_lifetime = Some ( lifetime. into ( ) ) ;
301+ self
302+ }
303+
296304 pub fn with_node_scope ( & mut self ) -> & mut Self {
297305 self . scopes . push ( SecretOperatorVolumeScope :: Node ) ;
298306 self
@@ -364,6 +372,13 @@ impl SecretOperatorVolumeSourceBuilder {
364372 }
365373 }
366374
375+ if let Some ( lifetime) = & self . auto_tls_cert_lifetime {
376+ annotations. insert (
377+ Annotation :: auto_tls_cert_lifetime ( & lifetime. to_string ( ) )
378+ . context ( ParseAnnotationSnafu ) ?,
379+ ) ;
380+ }
381+
367382 Ok ( EphemeralVolumeSource {
368383 volume_claim_template : Some ( PersistentVolumeClaimTemplate {
369384 metadata : Some ( ObjectMetaBuilder :: new ( ) . annotations ( annotations) . build ( ) ) ,
0 commit comments