Skip to content

Commit 91ed762

Browse files
committed
added roles for triggerer and dag-processor
1 parent 5a85453 commit 91ed762

12 files changed

Lines changed: 314 additions & 445 deletions

File tree

deploy/helm/airflow-operator/crds/crds.yaml

Lines changed: 241 additions & 241 deletions
Large diffs are not rendered by default.

rust/operator-binary/src/airflow_controller.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1169,7 +1169,7 @@ fn build_server_rolegroup_statefulset(
11691169
}
11701170
AirflowRole::Webserver
11711171
| AirflowRole::Worker
1172-
| AirflowRole::Processor
1172+
| AirflowRole::DagProcessor
11731173
| AirflowRole::Triggerer => "Parallel",
11741174
}
11751175
.to_string(),

rust/operator-binary/src/crd/mod.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -205,23 +205,23 @@ pub mod versioned {
205205
#[serde(default)]
206206
pub cluster_operation: ClusterOperation,
207207

208-
/// The `webserver` role provides the main UI for user interaction.
208+
/// The `webservers` role provides the main UI for user interaction.
209209
#[serde(default, skip_serializing_if = "Option::is_none")]
210210
pub webservers: Option<Role<AirflowConfigFragment, v1alpha1::WebserverRoleConfig>>,
211211

212-
/// The `scheduler` is responsible for triggering jobs and persisting their metadata to the backend database.
212+
/// The `schedulers` is responsible for triggering jobs and persisting their metadata to the backend database.
213213
/// Jobs are scheduled on the workers/executors.
214214
#[serde(default, skip_serializing_if = "Option::is_none")]
215215
pub schedulers: Option<Role<AirflowConfigFragment>>,
216216

217217
#[serde(flatten)]
218218
pub executor: AirflowExecutor,
219219

220-
/// The `processor` role runs the DAG processor routine for DAG preparation.
220+
/// The `dagProcessors` role runs the DAG processor routine for DAG preparation.
221221
#[serde(default, skip_serializing_if = "Option::is_none")]
222-
pub processors: Option<Role<AirflowConfigFragment>>,
222+
pub dag_processors: Option<Role<AirflowConfigFragment>>,
223223

224-
/// The `triggerer` role runs the triggerer process for use with deferrable DAG operators.
224+
/// The `triggerers` role runs the triggerer process for use with deferrable DAG operators.
225225
#[serde(default, skip_serializing_if = "Option::is_none")]
226226
pub triggerers: Option<Role<AirflowConfigFragment>>,
227227
}
@@ -352,7 +352,7 @@ impl v1alpha1::AirflowCluster {
352352
AirflowRole::Webserver => Some(role_service_name(&self.name_any(), &role.to_string())),
353353
AirflowRole::Scheduler
354354
| AirflowRole::Worker
355-
| AirflowRole::Processor
355+
| AirflowRole::DagProcessor
356356
| AirflowRole::Triggerer => None,
357357
}
358358
}
@@ -367,7 +367,7 @@ impl v1alpha1::AirflowCluster {
367367
.to_owned()
368368
.map(extract_role_from_webserver_config),
369369
AirflowRole::Scheduler => self.spec.schedulers.to_owned(),
370-
AirflowRole::Processor => self.spec.processors.to_owned(),
370+
AirflowRole::DagProcessor => self.spec.dag_processors.to_owned(),
371371
AirflowRole::Triggerer => self.spec.triggerers.to_owned(),
372372
AirflowRole::Worker => {
373373
if let AirflowExecutor::CeleryExecutor { config } = &self.spec.executor {
@@ -429,9 +429,9 @@ impl v1alpha1::AirflowCluster {
429429
roles: AirflowRole::roles(),
430430
})?
431431
}
432-
AirflowRole::Processor => {
432+
AirflowRole::DagProcessor => {
433433
self.spec
434-
.processors
434+
.dag_processors
435435
.as_ref()
436436
.context(UnknownAirflowRoleSnafu {
437437
role: role.to_string(),
@@ -596,8 +596,8 @@ pub enum AirflowRole {
596596
#[strum(serialize = "worker")]
597597
Worker,
598598

599-
#[strum(serialize = "processor")]
600-
Processor,
599+
#[strum(serialize = "dagprocessor")]
600+
DagProcessor,
601601

602602
#[strum(serialize = "triggerer")]
603603
Triggerer,
@@ -664,16 +664,16 @@ impl AirflowRole {
664664
container_debug_command(),
665665
"airflow scheduler &".to_string(),
666666
]);
667-
if airflow.spec.processors.is_none() {
668-
// If no processors role has been specified, the
667+
if airflow.spec.dag_processors.is_none() {
668+
// If no dag_processors role has been specified, the
669669
// process needs to be included with the scheduler
670670
// (with 3.x there is no longer the possibility of
671671
// starting it as a subprocess, so it has to be
672672
// explicitly started *somewhere*)
673673
command.extend(vec!["airflow dag-processor &".to_string()]);
674674
}
675675
}
676-
AirflowRole::Processor => command.extend(vec![
676+
AirflowRole::DagProcessor => command.extend(vec![
677677
"prepare_signal_handlers".to_string(),
678678
container_debug_command(),
679679
"airflow dag-processor &".to_string(),
@@ -725,7 +725,7 @@ impl AirflowRole {
725725
"airflow scheduler &".to_string(),
726726
]);
727727
}
728-
AirflowRole::Processor => command.extend(vec![
728+
AirflowRole::DagProcessor => command.extend(vec![
729729
"prepare_signal_handlers".to_string(),
730730
container_debug_command(),
731731
"airflow dag-processor &".to_string(),
@@ -791,7 +791,7 @@ impl AirflowRole {
791791
AirflowRole::Webserver => Some(HTTP_PORT),
792792
AirflowRole::Scheduler => None,
793793
AirflowRole::Worker => None,
794-
AirflowRole::Processor => None,
794+
AirflowRole::DagProcessor => None,
795795
AirflowRole::Triggerer => None,
796796
}
797797
}
@@ -811,7 +811,7 @@ impl AirflowRole {
811811
.webservers
812812
.to_owned()
813813
.map(|webserver| webserver.role_config.listener_class),
814-
Self::Worker | Self::Scheduler | Self::Processor | Self::Triggerer => None,
814+
Self::Worker | Self::Scheduler | Self::DagProcessor | Self::Triggerer => None,
815815
}
816816
}
817817
}
@@ -949,7 +949,7 @@ impl AirflowConfig {
949949
graceful_shutdown_timeout: Some(match role {
950950
AirflowRole::Webserver
951951
| AirflowRole::Scheduler
952-
| AirflowRole::Processor
952+
| AirflowRole::DagProcessor
953953
| AirflowRole::Triggerer => DEFAULT_AIRFLOW_GRACEFUL_SHUTDOWN_TIMEOUT,
954954
AirflowRole::Worker => DEFAULT_WORKER_GRACEFUL_SHUTDOWN_TIMEOUT,
955955
}),
@@ -1023,7 +1023,7 @@ fn default_resources(role: &AirflowRole) -> ResourcesFragment<AirflowStorageConf
10231023
runtime_limits: NoRuntimeLimitsFragment {},
10241024
},
10251025
),
1026-
AirflowRole::Processor => (
1026+
AirflowRole::DagProcessor => (
10271027
CpuLimitsFragment {
10281028
min: Some(Quantity("1".to_owned())),
10291029
max: Some(Quantity("2".to_owned())),

rust/operator-binary/src/env_vars.rs

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ const PYTHONPATH: &str = "PYTHONPATH";
6161
/// This key is only intended for use during experimental support and will
6262
/// be replaced with a secret at a later stage. See the issue covering
6363
/// this at <https://github.com/stackabletech/airflow-operator/issues/639>.
64-
//const JWT_KEY: &str = "ThisKeyIsNotIntendedForProduction!";
64+
const JWT_KEY: &str = "ThisKeyIsNotIntendedForProduction!";
6565

6666
#[derive(Snafu, Debug)]
6767
pub enum Error {
@@ -450,8 +450,6 @@ fn add_version_specific_env_vars(
450450
resolved_product_image: &ResolvedProductImage,
451451
env: &mut BTreeMap<String, EnvVar>,
452452
) {
453-
let secret = airflow.spec.cluster_config.credentials_secret.as_str();
454-
455453
if resolved_product_image.product_version.starts_with("3.") {
456454
env.extend(execution_server_env_vars(airflow));
457455
env.insert(
@@ -481,17 +479,13 @@ fn add_version_specific_env_vars(
481479
// See issue <https://github.com/stackabletech/airflow-operator/issues/639>:
482480
// later it will be accessed from a secret to avoid cluster restarts
483481
// being triggered by an operator restart.
484-
// env.insert(
485-
// "AIRFLOW__API_AUTH__JWT_SECRET".into(),
486-
// EnvVar {
487-
// name: "AIRFLOW__API_AUTH__JWT_SECRET".into(),
488-
// value: Some(JWT_KEY.into()),
489-
// ..Default::default()
490-
// },
491-
// );
492482
env.insert(
493483
"AIRFLOW__API_AUTH__JWT_SECRET".into(),
494-
env_var_from_secret("AIRFLOW__API_AUTH__JWT_SECRET", secret, "jwt.key"),
484+
EnvVar {
485+
name: "AIRFLOW__API_AUTH__JWT_SECRET".into(),
486+
value: Some(JWT_KEY.into()),
487+
..Default::default()
488+
},
495489
);
496490
if airflow_role == &AirflowRole::Webserver {
497491
// Sometimes a race condition can arise when both scheduler and
@@ -529,10 +523,10 @@ fn add_version_specific_env_vars(
529523
..Default::default()
530524
},
531525
);
532-
if airflow.spec.processors.is_some() {
526+
if airflow.spec.dag_processors.is_some() {
533527
// In airflow 2.x the dag-processor can optionally be started as a
534528
// standalone process (rather then as a scheduler subprocess),
535-
// governed by this env-var
529+
// accompanied by this env-var being set to True.
536530
env.insert(
537531
"AIRFLOW__SCHEDULER__STANDALONE_DAG_PROCESSOR".into(),
538532
EnvVar {

rust/operator-binary/src/operations/pdb.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub async fn add_pdbs(
3737
let max_unavailable = pdb.max_unavailable.unwrap_or(match role {
3838
AirflowRole::Scheduler => max_unavailable_schedulers(),
3939
AirflowRole::Webserver => max_unavailable_webservers(),
40-
AirflowRole::Processor => max_unavailable_processors(),
40+
AirflowRole::DagProcessor => max_unavailable_dag_processors(),
4141
AirflowRole::Triggerer => max_unavailable_triggerers(),
4242
AirflowRole::Worker => match airflow.spec.executor {
4343
AirflowExecutor::CeleryExecutor { .. } => max_unavailable_workers(),
@@ -80,7 +80,7 @@ fn max_unavailable_webservers() -> u16 {
8080
1
8181
}
8282

83-
fn max_unavailable_processors() -> u16 {
83+
fn max_unavailable_dag_processors() -> u16 {
8484
1
8585
}
8686

tests/templates/kuttl/smoke/02-s3-secret.yaml

Lines changed: 0 additions & 25 deletions
This file was deleted.

tests/templates/kuttl/smoke/03-assert.yaml

Lines changed: 0 additions & 20 deletions
This file was deleted.

tests/templates/kuttl/smoke/03-setup-minio.yaml

Lines changed: 0 additions & 55 deletions
This file was deleted.

tests/templates/kuttl/smoke/04-prepare-bucket.yaml.j2

Lines changed: 0 additions & 8 deletions
This file was deleted.

tests/templates/kuttl/smoke/40-assert.yaml.j2

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,30 @@ status:
5151
readyReplicas: 1
5252
replicas: 1
5353
---
54+
apiVersion: apps/v1
55+
kind: StatefulSet
56+
metadata:
57+
name: airflow-dagprocessor-default
58+
spec:
59+
template:
60+
spec:
61+
terminationGracePeriodSeconds: 120
62+
status:
63+
readyReplicas: 1
64+
replicas: 1
65+
---
66+
apiVersion: apps/v1
67+
kind: StatefulSet
68+
metadata:
69+
name: airflow-triggerer-default
70+
spec:
71+
template:
72+
spec:
73+
terminationGracePeriodSeconds: 120
74+
status:
75+
readyReplicas: 1
76+
replicas: 1
77+
---
5478
apiVersion: policy/v1
5579
kind: PodDisruptionBudget
5680
metadata:
@@ -79,3 +103,21 @@ status:
79103
expectedPods: 1
80104
currentHealthy: 1
81105
disruptionsAllowed: 1
106+
---
107+
apiVersion: policy/v1
108+
kind: PodDisruptionBudget
109+
metadata:
110+
name: airflow-dagprocessor
111+
status:
112+
expectedPods: 1
113+
currentHealthy: 1
114+
disruptionsAllowed: 1
115+
---
116+
apiVersion: policy/v1
117+
kind: PodDisruptionBudget
118+
metadata:
119+
name: airflow-triggerer
120+
status:
121+
expectedPods: 1
122+
currentHealthy: 1
123+
disruptionsAllowed: 1

0 commit comments

Comments
 (0)