@@ -511,16 +511,21 @@ pub async fn reconcile_airflow(
511511 if let Some ( listener_class) =
512512 airflow. merged_listener_class ( & airflow_role, & rolegroup. role_group )
513513 {
514- let rg_group_listener = build_group_listener (
515- airflow,
516- & resolved_product_image,
517- & rolegroup,
518- listener_class. to_string ( ) ,
519- ) ?;
520- cluster_resources
521- . add ( client, rg_group_listener)
522- . await
523- . context ( ApplyGroupListenerSnafu ) ?;
514+ if let Some ( listener_group_name) =
515+ airflow. group_listener_name ( & airflow_role, & rolegroup)
516+ {
517+ let rg_group_listener = build_group_listener (
518+ airflow,
519+ & resolved_product_image,
520+ & rolegroup,
521+ listener_class. to_string ( ) ,
522+ listener_group_name,
523+ ) ?;
524+ cluster_resources
525+ . add ( client, rg_group_listener)
526+ . await
527+ . context ( ApplyGroupListenerSnafu ) ?;
528+ }
524529 }
525530
526531 ss_cond_builder. add (
@@ -832,11 +837,12 @@ pub fn build_group_listener(
832837 resolved_product_image : & ResolvedProductImage ,
833838 rolegroup : & RoleGroupRef < v1alpha1:: AirflowCluster > ,
834839 listener_class : String ,
840+ listener_group_name : String ,
835841) -> Result < Listener > {
836842 Ok ( Listener {
837843 metadata : ObjectMetaBuilder :: new ( )
838844 . name_and_namespace ( airflow)
839- . name ( airflow . group_listener_name ( rolegroup ) )
845+ . name ( listener_group_name )
840846 . ownerreference_from_resource ( airflow, None , Some ( true ) )
841847 . context ( ObjectMissingMetadataForOwnerRefSnafu ) ?
842848 . with_recommended_labels ( build_recommended_labels (
@@ -857,19 +863,14 @@ pub fn build_group_listener(
857863 } )
858864}
859865
866+ /// We only use the http port here and intentionally omit
867+ /// the metrics one.
860868fn listener_ports ( ) -> Vec < ListenerPort > {
861- vec ! [
862- ListenerPort {
863- name: METRICS_PORT_NAME . to_string( ) ,
864- port: METRICS_PORT . into( ) ,
865- protocol: Some ( "TCP" . to_string( ) ) ,
866- } ,
867- ListenerPort {
868- name: HTTP_PORT_NAME . to_string( ) ,
869- port: HTTP_PORT . into( ) ,
870- protocol: Some ( "TCP" . to_string( ) ) ,
871- } ,
872- ]
869+ vec ! [ ListenerPort {
870+ name: HTTP_PORT_NAME . to_string( ) ,
871+ port: HTTP_PORT . into( ) ,
872+ protocol: Some ( "TCP" . to_string( ) ) ,
873+ } ]
873874}
874875
875876/// The rolegroup [`StatefulSet`] runs the rolegroup, as configured by the administrator.
@@ -1007,16 +1008,13 @@ fn build_server_rolegroup_statefulset(
10071008
10081009 let mut pvcs: Option < Vec < PersistentVolumeClaim > > = None ;
10091010
1010- if airflow
1011- . merged_listener_class ( airflow_role, & rolegroup_ref. role_group )
1012- . is_some ( )
1013- {
1011+ if let Some ( listener_group_name) = airflow. group_listener_name ( airflow_role, rolegroup_ref) {
10141012 // Listener endpoints for the Webserver role will use persistent volumes
10151013 // so that load balancers can hard-code the target addresses. This will
10161014 // be the case even when no class is set (and the value defaults to
10171015 // cluster-internal) as the address should still be consistent.
10181016 let pvc = ListenerOperatorVolumeSourceBuilder :: new (
1019- & ListenerReference :: ListenerName ( airflow . group_listener_name ( rolegroup_ref ) ) ,
1017+ & ListenerReference :: ListenerName ( listener_group_name ) ,
10201018 & unversioned_recommended_labels,
10211019 )
10221020 . context ( BuildListenerVolumeSnafu ) ?
0 commit comments