@@ -140,9 +140,6 @@ pub enum Error {
140140 #[ snafu( display( "object defines no name" ) ) ]
141141 ObjectHasNoName ,
142142
143- #[ snafu( display( "object defines no spec" ) ) ]
144- ObjectHasNoSpec ,
145-
146143 #[ snafu( display( "object defines no namespace" ) ) ]
147144 ObjectHasNoNamespace ,
148145
@@ -222,21 +219,12 @@ pub enum Error {
222219 #[ snafu( display( "Failed to find information about file [{}] in product config" , kind) ) ]
223220 ProductConfigKindNotSpecified { kind : String } ,
224221
225- #[ snafu( display( "Failed to find any nodes in cluster {obj_ref}" , ) ) ]
226- MissingNodes {
227- source : stackable_operator:: client:: Error ,
228- obj_ref : ObjectRef < v1alpha1:: NifiCluster > ,
229- } ,
230-
231222 #[ snafu( display( "Failed to find service {obj_ref}" ) ) ]
232223 MissingService {
233224 source : stackable_operator:: client:: Error ,
234225 obj_ref : ObjectRef < Service > ,
235226 } ,
236227
237- #[ snafu( display( "Failed to find an external port to use for proxy hosts" ) ) ]
238- ExternalPort ,
239-
240228 #[ snafu( display( "Could not build role service fqdn" ) ) ]
241229 NoRoleServiceFqdn ,
242230
@@ -534,8 +522,7 @@ pub async fn reconcile_nifi(
534522 // Since we cannot predict which of the addresses a user might decide to use we will simply
535523 // add all of them to the setting for now.
536524 // For more information see <https://nifi.apache.org/docs/nifi-docs/html/administration-guide.html#proxy_configuration>
537- // let proxy_hosts = get_proxy_hosts(client, nifi, &merged_config).await?;
538- let proxy_hosts = get_proxy_hosts ( client, nifi) . await ?;
525+ let proxy_hosts = get_proxy_hosts ( client, nifi, & resolved_product_image) . await ?;
539526
540527 let rg_configmap = build_node_rolegroup_config_map (
541528 nifi,
@@ -1560,7 +1547,7 @@ async fn build_node_rolegroup_statefulset(
15601547async fn get_proxy_hosts (
15611548 client : & Client ,
15621549 nifi : & v1alpha1:: NifiCluster ,
1563- // merged_config : &NifiConfig ,
1550+ resolved_product_image : & ResolvedProductImage ,
15641551) -> Result < String > {
15651552 let host_header_check = nifi. spec . cluster_config . host_header_check . clone ( ) ;
15661553
@@ -1576,27 +1563,24 @@ async fn get_proxy_hosts(
15761563 return Ok ( "*" . to_string ( ) ) ;
15771564 }
15781565
1579- let node_role_service_fqdn = nifi
1580- . node_role_service_fqdn ( & client. kubernetes_cluster_info )
1581- . context ( NoRoleServiceFqdnSnafu ) ?;
1582- let reporting_task_service_name = reporting_task:: build_reporting_task_fqdn_service_name (
1583- nifi,
1584- & client. kubernetes_cluster_info ,
1585- )
1586- . context ( ReportingTaskSnafu ) ?;
1587- let mut proxy_hosts_set = HashSet :: from ( [
1588- node_role_service_fqdn. clone ( ) ,
1589- format ! ( "{node_role_service_fqdn}:{HTTPS_PORT}" ) ,
1590- format ! ( "{reporting_task_service_name}:{HTTPS_PORT}" ) ,
1566+ // Address and port are injected from the listener volume during the prepare container
1567+ let mut proxy_hosts = HashSet :: from ( [
1568+ "${env:LISTENER_DEFAULT_ADDRESS}:${env:LISTENER_DEFAULT_PORT_HTTPS}" . to_string ( ) ,
15911569 ] ) ;
1570+ proxy_hosts. extend ( host_header_check. additional_allowed_hosts ) ;
15921571
1593- proxy_hosts_set. extend ( host_header_check. additional_allowed_hosts ) ;
1572+ // Reporting task only exists for NiFi 1.x
1573+ if resolved_product_image. product_version . starts_with ( "1." ) {
1574+ let reporting_task_service_name = reporting_task:: build_reporting_task_fqdn_service_name (
1575+ nifi,
1576+ & client. kubernetes_cluster_info ,
1577+ )
1578+ . context ( ReportingTaskSnafu ) ?;
15941579
1595- // Inject the address and port from the listener volume during the prepare container
1596- proxy_hosts_set
1597- . insert ( "${env:LISTENER_DEFAULT_ADDRESS}:${env:LISTENER_DEFAULT_PORT_HTTPS}" . to_string ( ) ) ;
1580+ proxy_hosts. insert ( format ! ( "{reporting_task_service_name}:{HTTPS_PORT}" ) ) ;
1581+ }
15981582
1599- let mut proxy_hosts = Vec :: from_iter ( proxy_hosts_set ) ;
1583+ let mut proxy_hosts = Vec :: from_iter ( proxy_hosts ) ;
16001584 proxy_hosts. sort ( ) ;
16011585
16021586 Ok ( proxy_hosts. join ( "," ) )
0 commit comments