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
+
2
3
use std:: {
3
4
borrow:: Cow ,
4
5
collections:: { BTreeMap , HashMap , HashSet } ,
@@ -13,12 +14,6 @@ use product_config::{
13
14
ProductConfigManager ,
14
15
} ;
15
16
use 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
- } ;
22
17
use stackable_operator:: {
23
18
builder:: {
24
19
self ,
@@ -84,6 +79,13 @@ use crate::{
84
79
validated_product_config, NifiRepository , JVM_SECURITY_PROPERTIES_FILE ,
85
80
NIFI_BOOTSTRAP_CONF , NIFI_CONFIG_DIRECTORY , NIFI_PROPERTIES , NIFI_STATE_MANAGEMENT_XML ,
86
81
} ,
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
+ } ,
87
89
operations:: { graceful_shutdown:: add_graceful_shutdown_config, pdb:: add_pdbs} ,
88
90
product_logging:: { extend_role_group_config_map, resolve_vector_aggregator_address} ,
89
91
reporting_task:: { self , build_maybe_reporting_task, build_reporting_task_service_name} ,
@@ -159,13 +161,13 @@ pub enum Error {
159
161
#[ snafu( display( "failed to apply Service for {}" , rolegroup) ) ]
160
162
ApplyRoleGroupService {
161
163
source : stackable_operator:: cluster_resources:: Error ,
162
- rolegroup : RoleGroupRef < NifiCluster > ,
164
+ rolegroup : RoleGroupRef < v1alpha1 :: NifiCluster > ,
163
165
} ,
164
166
165
167
#[ snafu( display( "failed to build ConfigMap for {}" , rolegroup) ) ]
166
168
BuildRoleGroupConfig {
167
169
source : stackable_operator:: builder:: configmap:: Error ,
168
- rolegroup : RoleGroupRef < NifiCluster > ,
170
+ rolegroup : RoleGroupRef < v1alpha1 :: NifiCluster > ,
169
171
} ,
170
172
171
173
#[ snafu( display( "object has no nodes defined" ) ) ]
@@ -174,13 +176,13 @@ pub enum Error {
174
176
#[ snafu( display( "failed to apply ConfigMap for {}" , rolegroup) ) ]
175
177
ApplyRoleGroupConfig {
176
178
source : stackable_operator:: cluster_resources:: Error ,
177
- rolegroup : RoleGroupRef < NifiCluster > ,
179
+ rolegroup : RoleGroupRef < v1alpha1 :: NifiCluster > ,
178
180
} ,
179
181
180
182
#[ snafu( display( "failed to apply StatefulSet for {}" , rolegroup) ) ]
181
183
ApplyRoleGroupStatefulSet {
182
184
source : stackable_operator:: cluster_resources:: Error ,
183
- rolegroup : RoleGroupRef < NifiCluster > ,
185
+ rolegroup : RoleGroupRef < v1alpha1 :: NifiCluster > ,
184
186
} ,
185
187
186
188
#[ snafu( display( "failed to apply create ReportingTask service" ) ) ]
@@ -210,7 +212,7 @@ pub enum Error {
210
212
#[ snafu( display( "Failed to find any nodes in cluster {obj_ref}" , ) ) ]
211
213
MissingNodes {
212
214
source : stackable_operator:: client:: Error ,
213
- obj_ref : ObjectRef < NifiCluster > ,
215
+ obj_ref : ObjectRef < v1alpha1 :: NifiCluster > ,
214
216
} ,
215
217
216
218
#[ snafu( display( "Failed to find service {obj_ref}" ) ) ]
@@ -235,7 +237,7 @@ pub enum Error {
235
237
BuildProductConfig {
236
238
#[ snafu( source( from( config:: Error , Box :: new) ) ) ]
237
239
source : Box < config:: Error > ,
238
- rolegroup : RoleGroupRef < NifiCluster > ,
240
+ rolegroup : RoleGroupRef < v1alpha1 :: NifiCluster > ,
239
241
} ,
240
242
241
243
#[ snafu( display( "illegal container name: [{container_name}]" ) ) ]
@@ -247,11 +249,11 @@ pub enum Error {
247
249
#[ snafu( display( "failed to validate resources for {rolegroup}" ) ) ]
248
250
ResourceValidation {
249
251
source : fragment:: ValidationError ,
250
- rolegroup : RoleGroupRef < NifiCluster > ,
252
+ rolegroup : RoleGroupRef < v1alpha1 :: NifiCluster > ,
251
253
} ,
252
254
253
255
#[ 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 } ,
255
257
256
258
#[ snafu( display( "failed to resolve the Vector aggregator address" ) ) ]
257
259
ResolveVectorAggregatorAddress {
@@ -295,7 +297,7 @@ pub enum Error {
295
297
296
298
#[ snafu( display( "Failed to resolve NiFi Authentication Configuration" ) ) ]
297
299
FailedResolveNifiAuthenticationConfig {
298
- source : stackable_nifi_crd :: authentication:: Error ,
300
+ source : crate :: crd :: authentication:: Error ,
299
301
} ,
300
302
301
303
#[ snafu( display( "failed to create PodDisruptionBudget" ) ) ]
@@ -365,7 +367,7 @@ pub enum VersionChangeState {
365
367
}
366
368
367
369
pub async fn reconcile_nifi (
368
- nifi : Arc < DeserializeGuard < NifiCluster > > ,
370
+ nifi : Arc < DeserializeGuard < v1alpha1 :: NifiCluster > > ,
369
371
ctx : Arc < Ctx > ,
370
372
) -> Result < Action > {
371
373
tracing:: info!( "Starting reconcile" ) ;
@@ -686,7 +688,7 @@ pub async fn reconcile_nifi(
686
688
/// The node-role service is the primary endpoint that should be used by clients that do not
687
689
/// perform internal load balancing including targets outside of the cluster.
688
690
pub fn build_node_role_service (
689
- nifi : & NifiCluster ,
691
+ nifi : & v1alpha1 :: NifiCluster ,
690
692
resolved_product_image : & ResolvedProductImage ,
691
693
) -> Result < Service > {
692
694
let role_name = NifiRole :: Node . to_string ( ) ;
@@ -732,11 +734,11 @@ pub fn build_node_role_service(
732
734
/// The rolegroup [`ConfigMap`] configures the rolegroup based on the configuration given by the administrator
733
735
#[ allow( clippy:: too_many_arguments) ]
734
736
async fn build_node_rolegroup_config_map (
735
- nifi : & NifiCluster ,
737
+ nifi : & v1alpha1 :: NifiCluster ,
736
738
resolved_product_image : & ResolvedProductImage ,
737
739
nifi_auth_config : & NifiAuthenticationConfig ,
738
740
role : & Role < NifiConfigFragment , GenericRoleConfig , JavaCommonConfig > ,
739
- rolegroup : & RoleGroupRef < NifiCluster > ,
741
+ rolegroup : & RoleGroupRef < v1alpha1 :: NifiCluster > ,
740
742
rolegroup_config : & HashMap < PropertyNameKind , BTreeMap < String , String > > ,
741
743
merged_config : & NifiConfig ,
742
744
vector_aggregator_address : Option < & str > ,
@@ -846,9 +848,9 @@ async fn build_node_rolegroup_config_map(
846
848
///
847
849
/// This is mostly useful for internal communication between peers, or for clients that perform client-side load balancing.
848
850
fn build_node_rolegroup_service (
849
- nifi : & NifiCluster ,
851
+ nifi : & v1alpha1 :: NifiCluster ,
850
852
resolved_product_image : & ResolvedProductImage ,
851
- rolegroup : & RoleGroupRef < NifiCluster > ,
853
+ rolegroup : & RoleGroupRef < v1alpha1 :: NifiCluster > ,
852
854
) -> Result < Service > {
853
855
Ok ( Service {
854
856
metadata : ObjectMetaBuilder :: new ( )
@@ -903,10 +905,10 @@ const USERDATA_MOUNTPOINT: &str = "/stackable/userdata";
903
905
/// corresponding [`Service`] (from [`build_node_rolegroup_service`]).
904
906
#[ allow( clippy:: too_many_arguments) ]
905
907
async fn build_node_rolegroup_statefulset (
906
- nifi : & NifiCluster ,
908
+ nifi : & v1alpha1 :: NifiCluster ,
907
909
resolved_product_image : & ResolvedProductImage ,
908
910
cluster_info : & KubernetesClusterInfo ,
909
- rolegroup_ref : & RoleGroupRef < NifiCluster > ,
911
+ rolegroup_ref : & RoleGroupRef < v1alpha1 :: NifiCluster > ,
910
912
role : & Role < NifiConfigFragment , GenericRoleConfig , JavaCommonConfig > ,
911
913
rolegroup_config : & HashMap < PropertyNameKind , BTreeMap < String , String > > ,
912
914
merged_config : & NifiConfig ,
@@ -1476,7 +1478,7 @@ fn zookeeper_env_var(name: &str, configmap_name: &str) -> EnvVar {
1476
1478
1477
1479
async fn get_proxy_hosts (
1478
1480
client : & Client ,
1479
- nifi : & NifiCluster ,
1481
+ nifi : & v1alpha1 :: NifiCluster ,
1480
1482
nifi_service : & Service ,
1481
1483
) -> Result < String > {
1482
1484
let host_header_check = nifi. spec . cluster_config . host_header_check . clone ( ) ;
@@ -1541,7 +1543,7 @@ async fn get_proxy_hosts(
1541
1543
}
1542
1544
1543
1545
pub fn error_policy (
1544
- _obj : Arc < DeserializeGuard < NifiCluster > > ,
1546
+ _obj : Arc < DeserializeGuard < v1alpha1 :: NifiCluster > > ,
1545
1547
error : & Error ,
1546
1548
_ctx : Arc < Ctx > ,
1547
1549
) -> Action {
@@ -1554,11 +1556,11 @@ pub fn error_policy(
1554
1556
}
1555
1557
1556
1558
pub fn build_recommended_labels < ' a > (
1557
- owner : & ' a NifiCluster ,
1559
+ owner : & ' a v1alpha1 :: NifiCluster ,
1558
1560
app_version : & ' a str ,
1559
1561
role : & ' a str ,
1560
1562
role_group : & ' a str ,
1561
- ) -> ObjectLabels < ' a , NifiCluster > {
1563
+ ) -> ObjectLabels < ' a , v1alpha1 :: NifiCluster > {
1562
1564
ObjectLabels {
1563
1565
owner,
1564
1566
app_name : APP_NAME ,
0 commit comments