@@ -14,7 +14,7 @@ use tracing::warn;
1414
1515use crate :: {
1616 builder:: meta:: ObjectMetaBuilder ,
17- kvp:: { Annotation , AnnotationError , Annotations , LabelError , Labels } ,
17+ kvp:: { annotation , Annotation , AnnotationError , Annotations , LabelError , Labels } ,
1818} ;
1919
2020/// A builder to build [`Volume`] objects. May only contain one `volume_source`
@@ -333,34 +333,43 @@ impl SecretOperatorVolumeSourceBuilder {
333333 pub fn build ( & self ) -> Result < EphemeralVolumeSource , SecretOperatorVolumeSourceBuilderError > {
334334 let mut annotations = Annotations :: new ( ) ;
335335
336- annotations
337- . insert ( Annotation :: secret_class ( & self . secret_class ) . context ( ParseAnnotationSnafu ) ?) ;
336+ annotations. extend ( [ annotation:: well_known:: secret_volume:: secret_class (
337+ & self . secret_class ,
338+ )
339+ . context ( ParseAnnotationSnafu ) ?] ) ;
338340
339341 if !self . scopes . is_empty ( ) {
340- annotations
341- . insert ( Annotation :: secret_scope ( & self . scopes ) . context ( ParseAnnotationSnafu ) ?) ;
342+ annotations. extend ( [
343+ annotation:: well_known:: secret_volume:: secret_scope ( & self . scopes )
344+ . context ( ParseAnnotationSnafu ) ?,
345+ ] ) ;
342346 }
343347
344348 if let Some ( format) = & self . format {
345- annotations
346- . insert ( Annotation :: secret_format ( format. as_ref ( ) ) . context ( ParseAnnotationSnafu ) ?) ;
349+ annotations. extend ( [ annotation:: well_known:: secret_volume:: secret_format (
350+ format. as_ref ( ) ,
351+ )
352+ . context ( ParseAnnotationSnafu ) ?] ) ;
347353 }
348354
349355 if !self . kerberos_service_names . is_empty ( ) {
350- annotations. insert (
351- Annotation :: kerberos_service_names ( & self . kerberos_service_names )
352- . context ( ParseAnnotationSnafu ) ?,
353- ) ;
356+ annotations. extend ( [
357+ annotation:: well_known:: secret_volume:: kerberos_service_names (
358+ & self . kerberos_service_names ,
359+ )
360+ . context ( ParseAnnotationSnafu ) ?,
361+ ] ) ;
354362 }
355363
356364 if let Some ( password) = & self . tls_pkcs12_password {
357365 // The `tls_pkcs12_password` is only used for PKCS12 stores.
358366 if Some ( SecretFormat :: TlsPkcs12 ) != self . format {
359367 warn ! ( format. actual = ?self . format, format. expected = ?Some ( SecretFormat :: TlsPkcs12 ) , "A TLS PKCS12 password was set but ignored because another format was requested" )
360368 } else {
361- annotations. insert (
362- Annotation :: tls_pkcs12_password ( password) . context ( ParseAnnotationSnafu ) ?,
363- ) ;
369+ annotations. extend ( [ annotation:: well_known:: secret_volume:: tls_pkcs12_password (
370+ password,
371+ )
372+ . context ( ParseAnnotationSnafu ) ?] ) ;
364373 }
365374 }
366375
@@ -450,7 +459,7 @@ pub enum ListenerOperatorVolumeSourceBuilderError {
450459/// # use std::collections::BTreeMap;
451460/// let mut pod_builder = PodBuilder::new();
452461///
453- /// let labels: Labels = Labels::try_from(BTreeMap::<String, String>:: new()).unwrap ();
462+ /// let labels: Labels = Labels::new();
454463///
455464/// let volume_source =
456465/// ListenerOperatorVolumeSourceBuilder::new(
@@ -555,7 +564,6 @@ impl ListenerOperatorVolumeSourceBuilder {
555564mod tests {
556565 use super :: * ;
557566 use k8s_openapi:: apimachinery:: pkg:: api:: resource:: Quantity ;
558- use std:: collections:: BTreeMap ;
559567
560568 #[ test]
561569 fn builder ( ) {
@@ -615,7 +623,7 @@ mod tests {
615623
616624 #[ test]
617625 fn listener_operator_volume_source_builder ( ) {
618- let labels: Labels = Labels :: try_from ( BTreeMap :: < String , String > :: new ( ) ) . unwrap ( ) ;
626+ let labels: Labels = Labels :: new ( ) ;
619627
620628 let builder = ListenerOperatorVolumeSourceBuilder :: new (
621629 & ListenerReference :: ListenerClass ( "public" . into ( ) ) ,
0 commit comments