@@ -4,8 +4,7 @@ use serde::{Deserialize, Serialize};
44use snafu:: { ResultExt , Snafu } ;
55
66use crate :: builder:: pod:: volume:: {
7- SecretOperatorVolumeProvisionParts , SecretOperatorVolumeSourceBuilder ,
8- SecretOperatorVolumeSourceBuilderError , VolumeBuilder ,
7+ SecretOperatorVolumeSourceBuilder , SecretOperatorVolumeSourceBuilderError , VolumeBuilder ,
98} ;
109
1110#[ derive( Debug , PartialEq , Snafu ) ]
@@ -39,7 +38,7 @@ impl SecretClassVolume {
3938
4039 pub fn to_ephemeral_volume_source (
4140 & self ,
42- provision_parts : SecretOperatorVolumeProvisionParts ,
41+ provision_parts : SecretClassVolumeProvisionParts ,
4342 ) -> Result < EphemeralVolumeSource , SecretClassVolumeError > {
4443 let mut secret_operator_volume_builder =
4544 SecretOperatorVolumeSourceBuilder :: new ( & self . secret_class , provision_parts) ;
@@ -67,7 +66,7 @@ impl SecretClassVolume {
6766 pub fn to_volume (
6867 & self ,
6968 volume_name : & str ,
70- provision_parts : SecretOperatorVolumeProvisionParts ,
69+ provision_parts : SecretClassVolumeProvisionParts ,
7170 ) -> Result < Volume , SecretClassVolumeError > {
7271 let ephemeral = self . to_ephemeral_volume_source ( provision_parts) ?;
7372 Ok ( VolumeBuilder :: new ( volume_name) . ephemeral ( ephemeral) . build ( ) )
@@ -100,6 +99,22 @@ pub struct SecretClassVolumeScope {
10099 pub listener_volumes : Vec < String > ,
101100}
102101
102+ /// What parts secret-operator should provision into the requested volume.
103+ //
104+ // There intentionally isn't a global [`Default`] impl, as it's secret-ops concern what it chooses
105+ // as a default.
106+ #[ derive( Clone , Debug , PartialEq , Eq , strum:: AsRefStr ) ]
107+ #[ strum( serialize_all = "kebab-case" ) ]
108+ pub enum SecretClassVolumeProvisionParts {
109+ /// Only provision public parts, such as the CA certificate (either as PEM or truststore) or
110+ /// `krb5.conf`.
111+ Public ,
112+
113+ /// Provision all parts, which includes all [`Public`](Self::Public) ones as well as additional
114+ /// private parts, such as a TLS cert + private key, a keystore or a keytab.
115+ PublicPrivate ,
116+ }
117+
103118#[ cfg( test) ]
104119mod tests {
105120 use std:: collections:: BTreeMap ;
@@ -118,7 +133,7 @@ mod tests {
118133 } ) ,
119134 }
120135 // Let's assume we need some form of private data (e.g. a certificate or S3 credentials)
121- . to_ephemeral_volume_source ( SecretOperatorVolumeProvisionParts :: PublicPrivate )
136+ . to_ephemeral_volume_source ( SecretClassVolumeProvisionParts :: PublicPrivate )
122137 . unwrap ( ) ;
123138
124139 let expected_volume_attributes = BTreeMap :: from ( [
0 commit comments