@@ -281,17 +281,29 @@ pub struct SecretOperatorVolumeSourceBuilder {
281281 kerberos_service_names : Vec < String > ,
282282 tls_pkcs12_password : Option < String > ,
283283 auto_tls_cert_lifetime : Option < Duration > ,
284+ provision_parts : SecretOperatorVolumeProvisionParts ,
284285}
285286
286287impl SecretOperatorVolumeSourceBuilder {
287- pub fn new ( secret_class : impl Into < String > ) -> Self {
288+ /// Creates a builder for a secret-operator volume that uses the specified SecretClass to
289+ /// request the specified [`SecretOperatorVolumeProvisionParts`].
290+ ///
291+ /// This function forces the caller to make an explicit choice if the public parts are
292+ /// sufficient or if private (e.g. a certificate for the Pod) parts are needed as well.
293+ /// This is done to avoid accidentally requesting too much parts. For details see
294+ /// [this issue](https://github.com/stackabletech/issues/issues/547).
295+ pub fn new (
296+ secret_class : impl Into < String > ,
297+ provision_parts : SecretOperatorVolumeProvisionParts ,
298+ ) -> Self {
288299 Self {
289300 secret_class : secret_class. into ( ) ,
290301 scopes : Vec :: new ( ) ,
291302 format : None ,
292303 kerberos_service_names : Vec :: new ( ) ,
293304 tls_pkcs12_password : None ,
294305 auto_tls_cert_lifetime : None ,
306+ provision_parts,
295307 }
296308 }
297309
@@ -342,6 +354,10 @@ impl SecretOperatorVolumeSourceBuilder {
342354
343355 annotations
344356 . insert ( Annotation :: secret_class ( & self . secret_class ) . context ( ParseAnnotationSnafu ) ?) ;
357+ annotations. insert (
358+ Annotation :: secret_provision_parts ( & self . provision_parts )
359+ . context ( ParseAnnotationSnafu ) ?,
360+ ) ;
345361
346362 if !self . scopes . is_empty ( ) {
347363 annotations
@@ -417,6 +433,20 @@ pub enum SecretOperatorVolumeScope {
417433 ListenerVolume { name : String } ,
418434}
419435
436+ /// What parts secret-operator should provision into the requested volume.
437+ #[ derive( Clone , Debug , PartialEq , Eq , strum:: AsRefStr ) ]
438+ #[ strum( serialize_all = "kebab-case" ) ]
439+ pub enum SecretOperatorVolumeProvisionParts {
440+ /// Only provision public parts, such as the CA certificate (either as PEM or truststore) or
441+ /// `krb5.conf`.
442+ Public ,
443+
444+ /// Provision all parts, which includes all [`Public`](SecretOperatorVolumeProvisionParts::Public)
445+ /// ones as well as additional private parts, such as a TLS cert + private key, a keystore or a
446+ /// keytab.
447+ Full ,
448+ }
449+
420450/// Reference to a listener class or listener name
421451#[ derive( Clone , Debug , Eq , PartialEq ) ]
422452pub enum ListenerReference {
0 commit comments