1- //! Ensures that `Pod`s are configured and running for each [`NifiCluster`]
1+ //! Ensures that `Pod`s are configured and running for each [`v1alpha1::NifiCluster`].
2+
23use std:: {
34 borrow:: Cow ,
45 collections:: { BTreeMap , HashMap , HashSet } ,
@@ -13,12 +14,6 @@ use product_config::{
1314 ProductConfigManager ,
1415} ;
1516use snafu:: { OptionExt , ResultExt , Snafu } ;
16- use stackable_nifi_crd:: {
17- authentication:: AuthenticationClassResolved , Container , CurrentlySupportedListenerClasses ,
18- NifiCluster , NifiConfig , NifiConfigFragment , NifiRole , NifiStatus , APP_NAME , BALANCE_PORT ,
19- BALANCE_PORT_NAME , HTTPS_PORT , HTTPS_PORT_NAME , METRICS_PORT , METRICS_PORT_NAME , PROTOCOL_PORT ,
20- PROTOCOL_PORT_NAME , STACKABLE_LOG_CONFIG_DIR , STACKABLE_LOG_DIR ,
21- } ;
2217use stackable_operator:: {
2318 builder:: {
2419 self ,
@@ -84,6 +79,13 @@ use crate::{
8479 validated_product_config, NifiRepository , JVM_SECURITY_PROPERTIES_FILE ,
8580 NIFI_BOOTSTRAP_CONF , NIFI_CONFIG_DIRECTORY , NIFI_PROPERTIES , NIFI_STATE_MANAGEMENT_XML ,
8681 } ,
82+ crd:: {
83+ authentication:: AuthenticationClassResolved , v1alpha1, Container ,
84+ CurrentlySupportedListenerClasses , NifiConfig , NifiConfigFragment , NifiRole , NifiStatus ,
85+ APP_NAME , BALANCE_PORT , BALANCE_PORT_NAME , HTTPS_PORT , HTTPS_PORT_NAME , METRICS_PORT ,
86+ METRICS_PORT_NAME , PROTOCOL_PORT , PROTOCOL_PORT_NAME , STACKABLE_LOG_CONFIG_DIR ,
87+ STACKABLE_LOG_DIR ,
88+ } ,
8789 operations:: { graceful_shutdown:: add_graceful_shutdown_config, pdb:: add_pdbs} ,
8890 product_logging:: { extend_role_group_config_map, resolve_vector_aggregator_address} ,
8991 reporting_task:: { self , build_maybe_reporting_task, build_reporting_task_service_name} ,
@@ -159,13 +161,13 @@ pub enum Error {
159161 #[ snafu( display( "failed to apply Service for {}" , rolegroup) ) ]
160162 ApplyRoleGroupService {
161163 source : stackable_operator:: cluster_resources:: Error ,
162- rolegroup : RoleGroupRef < NifiCluster > ,
164+ rolegroup : RoleGroupRef < v1alpha1 :: NifiCluster > ,
163165 } ,
164166
165167 #[ snafu( display( "failed to build ConfigMap for {}" , rolegroup) ) ]
166168 BuildRoleGroupConfig {
167169 source : stackable_operator:: builder:: configmap:: Error ,
168- rolegroup : RoleGroupRef < NifiCluster > ,
170+ rolegroup : RoleGroupRef < v1alpha1 :: NifiCluster > ,
169171 } ,
170172
171173 #[ snafu( display( "object has no nodes defined" ) ) ]
@@ -174,13 +176,13 @@ pub enum Error {
174176 #[ snafu( display( "failed to apply ConfigMap for {}" , rolegroup) ) ]
175177 ApplyRoleGroupConfig {
176178 source : stackable_operator:: cluster_resources:: Error ,
177- rolegroup : RoleGroupRef < NifiCluster > ,
179+ rolegroup : RoleGroupRef < v1alpha1 :: NifiCluster > ,
178180 } ,
179181
180182 #[ snafu( display( "failed to apply StatefulSet for {}" , rolegroup) ) ]
181183 ApplyRoleGroupStatefulSet {
182184 source : stackable_operator:: cluster_resources:: Error ,
183- rolegroup : RoleGroupRef < NifiCluster > ,
185+ rolegroup : RoleGroupRef < v1alpha1 :: NifiCluster > ,
184186 } ,
185187
186188 #[ snafu( display( "failed to apply create ReportingTask service" ) ) ]
@@ -210,7 +212,7 @@ pub enum Error {
210212 #[ snafu( display( "Failed to find any nodes in cluster {obj_ref}" , ) ) ]
211213 MissingNodes {
212214 source : stackable_operator:: client:: Error ,
213- obj_ref : ObjectRef < NifiCluster > ,
215+ obj_ref : ObjectRef < v1alpha1 :: NifiCluster > ,
214216 } ,
215217
216218 #[ snafu( display( "Failed to find service {obj_ref}" ) ) ]
@@ -235,7 +237,7 @@ pub enum Error {
235237 BuildProductConfig {
236238 #[ snafu( source( from( config:: Error , Box :: new) ) ) ]
237239 source : Box < config:: Error > ,
238- rolegroup : RoleGroupRef < NifiCluster > ,
240+ rolegroup : RoleGroupRef < v1alpha1 :: NifiCluster > ,
239241 } ,
240242
241243 #[ snafu( display( "illegal container name: [{container_name}]" ) ) ]
@@ -247,11 +249,11 @@ pub enum Error {
247249 #[ snafu( display( "failed to validate resources for {rolegroup}" ) ) ]
248250 ResourceValidation {
249251 source : fragment:: ValidationError ,
250- rolegroup : RoleGroupRef < NifiCluster > ,
252+ rolegroup : RoleGroupRef < v1alpha1 :: NifiCluster > ,
251253 } ,
252254
253255 #[ snafu( display( "failed to resolve and merge config for role and role group" ) ) ]
254- FailedToResolveConfig { source : stackable_nifi_crd :: Error } ,
256+ FailedToResolveConfig { source : crate :: crd :: Error } ,
255257
256258 #[ snafu( display( "failed to resolve the Vector aggregator address" ) ) ]
257259 ResolveVectorAggregatorAddress {
@@ -295,7 +297,7 @@ pub enum Error {
295297
296298 #[ snafu( display( "Failed to resolve NiFi Authentication Configuration" ) ) ]
297299 FailedResolveNifiAuthenticationConfig {
298- source : stackable_nifi_crd :: authentication:: Error ,
300+ source : crate :: crd :: authentication:: Error ,
299301 } ,
300302
301303 #[ snafu( display( "failed to create PodDisruptionBudget" ) ) ]
@@ -365,7 +367,7 @@ pub enum VersionChangeState {
365367}
366368
367369pub async fn reconcile_nifi (
368- nifi : Arc < DeserializeGuard < NifiCluster > > ,
370+ nifi : Arc < DeserializeGuard < v1alpha1 :: NifiCluster > > ,
369371 ctx : Arc < Ctx > ,
370372) -> Result < Action > {
371373 tracing:: info!( "Starting reconcile" ) ;
@@ -686,7 +688,7 @@ pub async fn reconcile_nifi(
686688/// The node-role service is the primary endpoint that should be used by clients that do not
687689/// perform internal load balancing including targets outside of the cluster.
688690pub fn build_node_role_service (
689- nifi : & NifiCluster ,
691+ nifi : & v1alpha1 :: NifiCluster ,
690692 resolved_product_image : & ResolvedProductImage ,
691693) -> Result < Service > {
692694 let role_name = NifiRole :: Node . to_string ( ) ;
@@ -732,11 +734,11 @@ pub fn build_node_role_service(
732734/// The rolegroup [`ConfigMap`] configures the rolegroup based on the configuration given by the administrator
733735#[ allow( clippy:: too_many_arguments) ]
734736async fn build_node_rolegroup_config_map (
735- nifi : & NifiCluster ,
737+ nifi : & v1alpha1 :: NifiCluster ,
736738 resolved_product_image : & ResolvedProductImage ,
737739 nifi_auth_config : & NifiAuthenticationConfig ,
738740 role : & Role < NifiConfigFragment , GenericRoleConfig , JavaCommonConfig > ,
739- rolegroup : & RoleGroupRef < NifiCluster > ,
741+ rolegroup : & RoleGroupRef < v1alpha1 :: NifiCluster > ,
740742 rolegroup_config : & HashMap < PropertyNameKind , BTreeMap < String , String > > ,
741743 merged_config : & NifiConfig ,
742744 vector_aggregator_address : Option < & str > ,
@@ -846,9 +848,9 @@ async fn build_node_rolegroup_config_map(
846848///
847849/// This is mostly useful for internal communication between peers, or for clients that perform client-side load balancing.
848850fn build_node_rolegroup_service (
849- nifi : & NifiCluster ,
851+ nifi : & v1alpha1 :: NifiCluster ,
850852 resolved_product_image : & ResolvedProductImage ,
851- rolegroup : & RoleGroupRef < NifiCluster > ,
853+ rolegroup : & RoleGroupRef < v1alpha1 :: NifiCluster > ,
852854) -> Result < Service > {
853855 Ok ( Service {
854856 metadata : ObjectMetaBuilder :: new ( )
@@ -903,10 +905,10 @@ const USERDATA_MOUNTPOINT: &str = "/stackable/userdata";
903905/// corresponding [`Service`] (from [`build_node_rolegroup_service`]).
904906#[ allow( clippy:: too_many_arguments) ]
905907async fn build_node_rolegroup_statefulset (
906- nifi : & NifiCluster ,
908+ nifi : & v1alpha1 :: NifiCluster ,
907909 resolved_product_image : & ResolvedProductImage ,
908910 cluster_info : & KubernetesClusterInfo ,
909- rolegroup_ref : & RoleGroupRef < NifiCluster > ,
911+ rolegroup_ref : & RoleGroupRef < v1alpha1 :: NifiCluster > ,
910912 role : & Role < NifiConfigFragment , GenericRoleConfig , JavaCommonConfig > ,
911913 rolegroup_config : & HashMap < PropertyNameKind , BTreeMap < String , String > > ,
912914 merged_config : & NifiConfig ,
@@ -1476,7 +1478,7 @@ fn zookeeper_env_var(name: &str, configmap_name: &str) -> EnvVar {
14761478
14771479async fn get_proxy_hosts (
14781480 client : & Client ,
1479- nifi : & NifiCluster ,
1481+ nifi : & v1alpha1 :: NifiCluster ,
14801482 nifi_service : & Service ,
14811483) -> Result < String > {
14821484 let host_header_check = nifi. spec . cluster_config . host_header_check . clone ( ) ;
@@ -1541,7 +1543,7 @@ async fn get_proxy_hosts(
15411543}
15421544
15431545pub fn error_policy (
1544- _obj : Arc < DeserializeGuard < NifiCluster > > ,
1546+ _obj : Arc < DeserializeGuard < v1alpha1 :: NifiCluster > > ,
15451547 error : & Error ,
15461548 _ctx : Arc < Ctx > ,
15471549) -> Action {
@@ -1554,11 +1556,11 @@ pub fn error_policy(
15541556}
15551557
15561558pub fn build_recommended_labels < ' a > (
1557- owner : & ' a NifiCluster ,
1559+ owner : & ' a v1alpha1 :: NifiCluster ,
15581560 app_version : & ' a str ,
15591561 role : & ' a str ,
15601562 role_group : & ' a str ,
1561- ) -> ObjectLabels < ' a , NifiCluster > {
1563+ ) -> ObjectLabels < ' a , v1alpha1 :: NifiCluster > {
15621564 ObjectLabels {
15631565 owner,
15641566 app_name : APP_NAME ,
0 commit comments