@@ -118,29 +118,35 @@ pub struct ValidatedRoleConfig {
118118
119119/// Per-rolegroup configuration: the merged CRD config plus overrides.
120120///
121- /// `config_overrides` is kept as the typed [`AirflowConfigOverrides`] (role-group merged over
122- /// role); it is flattened into the rendered config file later, in the build step. This mirrors
123- /// hdfs-operator. `env_overrides` is already a flat map.
121+ /// This is the generic [`stackable_operator::v2::role_utils::RoleGroupConfig`]: the merged config
122+ /// fragment in `config`, the typed `config_overrides` (role-group merged over role) and the merged
123+ /// `env_overrides`/`cli_overrides`/`pod_overrides`. The config overrides are kept typed
124+ /// ([`AirflowConfigOverrides`]) and flattened into the rendered config file later, in the build step.
125+ pub type AirflowRoleGroupConfig = stackable_operator:: v2:: role_utils:: RoleGroupConfig <
126+ AirflowConfig ,
127+ stackable_operator:: v2:: role_utils:: GenericCommonConfig ,
128+ AirflowConfigOverrides ,
129+ > ;
130+
131+ /// Cluster-wide configuration that applies to every role and role group.
132+ ///
133+ /// Carries the dereferenced external references, so every downstream build step reads them from
134+ /// here rather than from the raw cluster object.
124135#[ derive( Clone , Debug ) ]
125- pub struct ValidatedRoleGroupConfig {
126- pub merged_config : AirflowConfig ,
127- pub config_overrides : AirflowConfigOverrides ,
128- pub env_overrides : HashMap < String , String > ,
129- pub replicas : Option < u16 > ,
130- pub pod_overrides : PodTemplateSpec ,
136+ pub struct ValidatedClusterConfig {
137+ pub executor : AirflowExecutor ,
138+ pub authentication_config : AirflowClientAuthenticationDetailsResolved ,
139+ pub authorization_config : AirflowAuthorizationResolved ,
131140}
132141
133142/// The validated cluster: proves that config merging succeeded for every role and
134- /// role group before any resources are created. It also carries the dereferenced
135- /// external references, so every downstream build step reads them from here.
143+ /// role group before any resources are created.
136144#[ derive( Clone , Debug ) ]
137- pub struct ValidatedAirflowCluster {
145+ pub struct ValidatedCluster {
138146 pub image : ResolvedProductImage ,
139- pub role_groups : BTreeMap < AirflowRole , BTreeMap < String , ValidatedRoleGroupConfig > > ,
147+ pub cluster_config : ValidatedClusterConfig ,
148+ pub role_groups : BTreeMap < AirflowRole , BTreeMap < String , AirflowRoleGroupConfig > > ,
140149 pub role_configs : BTreeMap < AirflowRole , ValidatedRoleConfig > ,
141- pub executor : AirflowExecutor ,
142- pub authentication_config : AirflowClientAuthenticationDetailsResolved ,
143- pub authorization_config : AirflowAuthorizationResolved ,
144150}
145151
146152#[ derive( Snafu , Debug , EnumDiscriminants ) ]
@@ -450,7 +456,7 @@ pub async fn reconcile_airflow(
450456 // collection there will be a pod template created to be used for pod provisioning
451457 if let AirflowExecutor :: KubernetesExecutors {
452458 common_configuration,
453- } = & validated_cluster. executor
459+ } = & validated_cluster. cluster_config . executor
454460 {
455461 build_executor_template (
456462 airflow,
@@ -506,11 +512,11 @@ pub async fn reconcile_airflow(
506512 let git_sync_resources = git_sync:: v1alpha2:: GitSyncResources :: new (
507513 & airflow. spec . cluster_config . dags_git_sync ,
508514 & validated_cluster. image ,
509- & env_vars_from_overrides ( & validated_rg_config. env_overrides ) ,
515+ & Vec :: < EnvVar > :: from ( validated_rg_config. env_overrides . clone ( ) ) ,
510516 & airflow. volume_mounts ( ) ,
511517 LOG_VOLUME_NAME ,
512518 & validated_rg_config
513- . merged_config
519+ . config
514520 . logging
515521 . for_container ( & Container :: GitSync ) ,
516522 )
@@ -566,7 +572,7 @@ pub async fn reconcile_airflow(
566572 & validated_cluster,
567573 & rolegroup,
568574 & validated_rg_config. config_overrides ,
569- & validated_rg_config. merged_config . logging ,
575+ & validated_rg_config. config . logging ,
570576 & Container :: Airflow ,
571577 )
572578 . context ( BuildConfigMapSnafu ) ?;
@@ -624,7 +630,7 @@ async fn build_executor_template(
624630 airflow : & v1alpha2:: AirflowCluster ,
625631 common_config : & AirflowExecutorCommonConfiguration ,
626632 metadata_database_connection_details : & SqlAlchemyDatabaseConnectionDetails ,
627- validated_cluster : & ValidatedAirflowCluster ,
633+ validated_cluster : & ValidatedCluster ,
628634 cluster_resources : & mut ClusterResources < ' _ > ,
629635 client : & stackable_operator:: client:: Client ,
630636 rbac_sa : & stackable_operator:: k8s_openapi:: api:: core:: v1:: ServiceAccount ,
@@ -671,7 +677,7 @@ async fn build_executor_template(
671677 let worker_pod_template_config_map = build_executor_template_config_map (
672678 airflow,
673679 & validated_cluster. image ,
674- & validated_cluster. authentication_config ,
680+ & validated_cluster. cluster_config . authentication_config ,
675681 metadata_database_connection_details,
676682 & rbac_sa. name_unchecked ( ) ,
677683 & merged_executor_config,
@@ -750,10 +756,10 @@ fn listener_ports() -> Vec<listener::v1alpha1::ListenerPort> {
750756#[ allow( clippy:: too_many_arguments) ]
751757fn build_server_rolegroup_statefulset (
752758 airflow : & v1alpha2:: AirflowCluster ,
753- validated_cluster : & ValidatedAirflowCluster ,
759+ validated_cluster : & ValidatedCluster ,
754760 airflow_role : & AirflowRole ,
755761 rolegroup_ref : & RoleGroupRef < v1alpha2:: AirflowCluster > ,
756- validated_rg_config : & ValidatedRoleGroupConfig ,
762+ validated_rg_config : & AirflowRoleGroupConfig ,
757763 metadata_database_connection_details : & SqlAlchemyDatabaseConnectionDetails ,
758764 celery_database_connection_details : & Option < (
759765 CeleryDatabaseConnectionDetails ,
@@ -762,13 +768,13 @@ fn build_server_rolegroup_statefulset(
762768 service_account : & ServiceAccount ,
763769 git_sync_resources : & git_sync:: v1alpha2:: GitSyncResources ,
764770) -> Result < StatefulSet > {
765- let merged_airflow_config = & validated_rg_config. merged_config ;
771+ let merged_airflow_config = & validated_rg_config. config ;
766772 let env_overrides = & validated_rg_config. env_overrides ;
767773
768774 let resolved_product_image = & validated_cluster. image ;
769- let authentication_config = & validated_cluster. authentication_config ;
770- let authorization_config = & validated_cluster. authorization_config ;
771- let executor = & validated_cluster. executor ;
775+ let authentication_config = & validated_cluster. cluster_config . authentication_config ;
776+ let authorization_config = & validated_cluster. cluster_config . authorization_config ;
777+ let executor = & validated_cluster. cluster_config . executor ;
772778
773779 let mut pb = PodBuilder :: new ( ) ;
774780 let recommended_object_labels = build_recommended_labels (
@@ -1044,7 +1050,7 @@ fn build_server_rolegroup_statefulset(
10441050 }
10451051 . to_string ( ) ,
10461052 ) ,
1047- replicas : validated_rg_config . replicas . map ( i32:: from) ,
1053+ replicas : Some ( i32:: from ( validated_rg_config . replicas ) ) ,
10481054 selector : LabelSelector {
10491055 match_labels : Some ( statefulset_match_labels. into ( ) ) ,
10501056 ..LabelSelector :: default ( )
@@ -1123,7 +1129,6 @@ fn build_executor_template_config_map(
11231129 let mut airflow_container =
11241130 ContainerBuilder :: new ( & Container :: Base . to_string ( ) ) . context ( InvalidContainerNameSnafu ) ?;
11251131
1126- // Works too, had been changed
11271132 add_authentication_volumes_and_volume_mounts (
11281133 authentication_config,
11291134 & mut airflow_container,
0 commit comments