@@ -217,6 +217,14 @@ pub mod versioned {
217217
218218 #[ serde( flatten) ]
219219 pub executor : AirflowExecutor ,
220+
221+ /// The `processor` role runs the DAG processor routine for DAG preparation.
222+ #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
223+ pub processors : Option < Role < AirflowConfigFragment > > ,
224+
225+ /// The `triggerer` role runs the triggerer process for use with deferrable DAG operators.
226+ #[ serde( default , skip_serializing_if = "Option::is_none" ) ]
227+ pub triggerers : Option < Role < AirflowConfigFragment > > ,
220228 }
221229
222230 #[ derive( Clone , Deserialize , Debug , JsonSchema , PartialEq , Serialize ) ]
@@ -343,7 +351,10 @@ impl v1alpha1::AirflowCluster {
343351 pub fn group_listener_name ( & self , role : & AirflowRole ) -> Option < String > {
344352 match role {
345353 AirflowRole :: Webserver => Some ( role_service_name ( & self . name_any ( ) , & role. to_string ( ) ) ) ,
346- AirflowRole :: Scheduler | AirflowRole :: Worker => None ,
354+ AirflowRole :: Scheduler
355+ | AirflowRole :: Worker
356+ | AirflowRole :: Processor
357+ | AirflowRole :: Triggerer => None ,
347358 }
348359 }
349360
@@ -357,6 +368,8 @@ impl v1alpha1::AirflowCluster {
357368 . to_owned ( )
358369 . map ( extract_role_from_webserver_config) ,
359370 AirflowRole :: Scheduler => self . spec . schedulers . to_owned ( ) ,
371+ AirflowRole :: Processor => self . spec . processors . to_owned ( ) ,
372+ AirflowRole :: Triggerer => self . spec . triggerers . to_owned ( ) ,
360373 AirflowRole :: Worker => {
361374 if let AirflowExecutor :: CeleryExecutor { config } = & self . spec . executor {
362375 Some ( config. clone ( ) )
@@ -413,6 +426,24 @@ impl v1alpha1::AirflowCluster {
413426 roles : AirflowRole :: roles ( ) ,
414427 } ) ?
415428 }
429+ AirflowRole :: Processor => {
430+ self . spec
431+ . processors
432+ . as_ref ( )
433+ . context ( UnknownAirflowRoleSnafu {
434+ role : role. to_string ( ) ,
435+ roles : AirflowRole :: roles ( ) ,
436+ } ) ?
437+ }
438+ AirflowRole :: Triggerer => {
439+ self . spec
440+ . triggerers
441+ . as_ref ( )
442+ . context ( UnknownAirflowRoleSnafu {
443+ role : role. to_string ( ) ,
444+ roles : AirflowRole :: roles ( ) ,
445+ } ) ?
446+ }
416447 } ;
417448
418449 // Retrieve role resource config
@@ -561,6 +592,12 @@ pub enum AirflowRole {
561592
562593 #[ strum( serialize = "worker" ) ]
563594 Worker ,
595+
596+ #[ strum( serialize = "processor" ) ]
597+ Processor ,
598+
599+ #[ strum( serialize = "triggerer" ) ]
600+ Triggerer ,
564601}
565602
566603impl AirflowRole {
@@ -622,10 +659,27 @@ impl AirflowRole {
622659 command. extend ( vec ! [
623660 "prepare_signal_handlers" . to_string( ) ,
624661 container_debug_command( ) ,
625- "airflow dag-processor &" . to_string( ) ,
626662 "airflow scheduler &" . to_string( ) ,
627663 ] ) ;
664+ if airflow. spec . processors . is_none ( ) {
665+ // If no processors role has been specified, the
666+ // process needs to be included with the scheduler
667+ // (with 3.x there is no longer the possibility of
668+ // starting it as a subprocess, so it has to be
669+ // explicitly started *somewhere*)
670+ command. extend ( vec ! [ "airflow dag-processor &" . to_string( ) ] ) ;
671+ }
628672 }
673+ AirflowRole :: Processor => command. extend ( vec ! [
674+ "prepare_signal_handlers" . to_string( ) ,
675+ container_debug_command( ) ,
676+ "airflow dag-processor &" . to_string( ) ,
677+ ] ) ,
678+ AirflowRole :: Triggerer => command. extend ( vec ! [
679+ "prepare_signal_handlers" . to_string( ) ,
680+ container_debug_command( ) ,
681+ "airflow triggerer &" . to_string( ) ,
682+ ] ) ,
629683 AirflowRole :: Worker => command. extend ( vec ! [
630684 "prepare_signal_handlers" . to_string( ) ,
631685 container_debug_command( ) ,
@@ -668,6 +722,16 @@ impl AirflowRole {
668722 "airflow scheduler &" . to_string( ) ,
669723 ] ) ;
670724 }
725+ AirflowRole :: Processor => command. extend ( vec ! [
726+ "prepare_signal_handlers" . to_string( ) ,
727+ container_debug_command( ) ,
728+ "airflow dag-processor &" . to_string( ) ,
729+ ] ) ,
730+ AirflowRole :: Triggerer => command. extend ( vec ! [
731+ "prepare_signal_handlers" . to_string( ) ,
732+ container_debug_command( ) ,
733+ "airflow triggerer &" . to_string( ) ,
734+ ] ) ,
671735 AirflowRole :: Worker => command. extend ( vec ! [
672736 "prepare_signal_handlers" . to_string( ) ,
673737 container_debug_command( ) ,
@@ -724,6 +788,8 @@ impl AirflowRole {
724788 AirflowRole :: Webserver => Some ( HTTP_PORT ) ,
725789 AirflowRole :: Scheduler => None ,
726790 AirflowRole :: Worker => None ,
791+ AirflowRole :: Processor => None ,
792+ AirflowRole :: Triggerer => None ,
727793 }
728794 }
729795
@@ -742,7 +808,7 @@ impl AirflowRole {
742808 . webservers
743809 . to_owned ( )
744810 . map ( |webserver| webserver. role_config . listener_class ) ,
745- Self :: Worker | Self :: Scheduler => None ,
811+ Self :: Worker | Self :: Scheduler | Self :: Processor | Self :: Triggerer => None ,
746812 }
747813 }
748814}
@@ -878,9 +944,10 @@ impl AirflowConfig {
878944 logging : product_logging:: spec:: default_logging ( ) ,
879945 affinity : get_affinity ( cluster_name, role) ,
880946 graceful_shutdown_timeout : Some ( match role {
881- AirflowRole :: Webserver | AirflowRole :: Scheduler => {
882- DEFAULT_AIRFLOW_GRACEFUL_SHUTDOWN_TIMEOUT
883- }
947+ AirflowRole :: Webserver
948+ | AirflowRole :: Scheduler
949+ | AirflowRole :: Processor
950+ | AirflowRole :: Triggerer => DEFAULT_AIRFLOW_GRACEFUL_SHUTDOWN_TIMEOUT ,
884951 AirflowRole :: Worker => DEFAULT_WORKER_GRACEFUL_SHUTDOWN_TIMEOUT ,
885952 } ) ,
886953 }
@@ -953,6 +1020,26 @@ fn default_resources(role: &AirflowRole) -> ResourcesFragment<AirflowStorageConf
9531020 runtime_limits : NoRuntimeLimitsFragment { } ,
9541021 } ,
9551022 ) ,
1023+ AirflowRole :: Processor => (
1024+ CpuLimitsFragment {
1025+ min : Some ( Quantity ( "1" . to_owned ( ) ) ) ,
1026+ max : Some ( Quantity ( "2" . to_owned ( ) ) ) ,
1027+ } ,
1028+ MemoryLimitsFragment {
1029+ limit : Some ( Quantity ( "1Gi" . to_owned ( ) ) ) ,
1030+ runtime_limits : NoRuntimeLimitsFragment { } ,
1031+ } ,
1032+ ) ,
1033+ AirflowRole :: Triggerer => (
1034+ CpuLimitsFragment {
1035+ min : Some ( Quantity ( "1" . to_owned ( ) ) ) ,
1036+ max : Some ( Quantity ( "2" . to_owned ( ) ) ) ,
1037+ } ,
1038+ MemoryLimitsFragment {
1039+ limit : Some ( Quantity ( "1Gi" . to_owned ( ) ) ) ,
1040+ runtime_limits : NoRuntimeLimitsFragment { } ,
1041+ } ,
1042+ ) ,
9561043 } ;
9571044
9581045 ResourcesFragment {
0 commit comments