@@ -102,13 +102,24 @@ impl ZookeeperSecurity {
102102 client : & Client ,
103103 zk : & v1alpha1:: ZookeeperCluster ,
104104 ) -> Result < Self , Error > {
105- Ok ( ZookeeperSecurity {
106- resolved_authentication_classes : authentication:: resolve_authentication_classes (
107- client,
108- & zk. spec . cluster_config . authentication ,
109- )
110- . await
111- . context ( InvalidAuthenticationClassConfigurationSnafu ) ?,
105+ let resolved_authentication_classes = authentication:: resolve_authentication_classes (
106+ client,
107+ & zk. spec . cluster_config . authentication ,
108+ )
109+ . await
110+ . context ( InvalidAuthenticationClassConfigurationSnafu ) ?;
111+ Ok ( Self :: new ( zk, resolved_authentication_classes) )
112+ }
113+
114+ /// Build a `ZookeeperSecurity` from a [`v1alpha1::ZookeeperCluster`] and already-resolved
115+ /// [`ResolvedAuthenticationClasses`]. Synchronous; intended to be called from the validate
116+ /// step of the controllers.
117+ pub fn new (
118+ zk : & v1alpha1:: ZookeeperCluster ,
119+ resolved_authentication_classes : ResolvedAuthenticationClasses ,
120+ ) -> Self {
121+ ZookeeperSecurity {
122+ resolved_authentication_classes,
112123 server_secret_class : zk
113124 . spec
114125 . cluster_config
@@ -122,7 +133,7 @@ impl ZookeeperSecurity {
122133 . as_ref ( )
123134 . map ( |tls| tls. quorum_secret_class . clone ( ) )
124135 . unwrap_or_else ( tls:: quorum_tls_default) ,
125- } )
136+ }
126137 }
127138
128139 /// Check if TLS encryption is enabled. This could be due to:
0 commit comments