@@ -56,7 +56,7 @@ struct Opts {
5656
5757#[ derive( clap:: Parser ) ]
5858struct SecretOperatorRun {
59- #[ clap ( long, env) ]
59+ #[ arg ( long, env) ]
6060 csi_endpoint : PathBuf ,
6161
6262 /// Unprivileged mode disables any features that require running secret-operator in a privileged container.
@@ -65,10 +65,16 @@ struct SecretOperatorRun {
6565 /// - Secret volumes will be stored on disk, rather than in a ramdisk
6666 ///
6767 /// Unprivileged mode is EXPERIMENTAL and heavily discouraged, since it increases the risk of leaking secrets.
68- #[ clap ( long, env) ]
68+ #[ arg ( long, env) ]
6969 privileged : bool ,
7070
71- #[ clap( flatten) ]
71+ /// The namespace that the TLS Certificate Authority is installed into.
72+ ///
73+ /// Defaults to the namespace where secret-operator is installed.
74+ #[ arg( long, env) ]
75+ tls_secretclass_ca_secret_namespace : Option < String > ,
76+
77+ #[ command( flatten) ]
7278 common : RunArguments ,
7379}
7480
@@ -87,6 +93,7 @@ async fn main() -> anyhow::Result<()> {
8793 . print_yaml_schema ( built_info:: PKG_VERSION , SerializeOptions :: default ( ) ) ?;
8894 }
8995 stackable_operator:: cli:: Command :: Run ( SecretOperatorRun {
96+ tls_secretclass_ca_secret_namespace,
9097 csi_endpoint,
9198 privileged,
9299 common :
@@ -176,9 +183,12 @@ async fn main() -> anyhow::Result<()> {
176183 . run ( )
177184 . map_err ( |err| anyhow ! ( err) . context ( "failed to run CRD maintainer" ) ) ;
178185
186+ let ca_secret_namespace = tls_secretclass_ca_secret_namespace
187+ . unwrap_or ( operator_environment. operator_namespace . clone ( ) ) ;
188+
179189 let default_secretclass = create_default_secretclass (
180190 initial_reconcile_rx,
181- operator_environment . operator_namespace . clone ( ) ,
191+ ca_secret_namespace ,
182192 client. clone ( ) ,
183193 )
184194 . map_err ( |err| anyhow ! ( err) . context ( "failed to apply default custom resources" ) ) ;
@@ -197,7 +207,7 @@ async fn main() -> anyhow::Result<()> {
197207
198208async fn create_default_secretclass (
199209 initial_reconcile_rx : oneshot:: Receiver < ( ) > ,
200- operator_namespace : String ,
210+ ca_secret_namespace : String ,
201211 client : Client ,
202212) -> anyhow:: Result < ( ) > {
203213 initial_reconcile_rx. await ?;
@@ -225,7 +235,7 @@ async fn create_default_secretclass(
225235 if let v1alpha2:: SecretClassBackend :: AutoTls ( auto_tls_backend) =
226236 & mut tls_secret_class. spec . backend
227237 {
228- auto_tls_backend. ca . secret . namespace = operator_namespace
238+ auto_tls_backend. ca . secret . namespace = ca_secret_namespace
229239 }
230240
231241 client. create_if_missing ( & tls_secret_class) . await ?;
0 commit comments