@@ -32,6 +32,7 @@ use stackable_operator::{
3232 cluster_resources:: { ClusterResourceApplyStrategy , ClusterResources } ,
3333 commons:: {
3434 product_image_selection:: { self , ResolvedProductImage } ,
35+ random_secret_creation,
3536 rbac:: build_rbac_resources,
3637 } ,
3738 crd:: {
@@ -92,12 +93,7 @@ use crate::{
9293 AirflowAuthenticationClassResolved , AirflowClientAuthenticationDetailsResolved ,
9394 } ,
9495 authorization:: AirflowAuthorizationResolved ,
95- build_recommended_labels,
96- internal_secret:: {
97- FERNET_KEY_SECRET_KEY , INTERNAL_SECRET_SECRET_KEY , JWT_SECRET_SECRET_KEY ,
98- create_random_secret,
99- } ,
100- v1alpha2,
96+ build_recommended_labels, v1alpha2,
10197 } ,
10298 env_vars:: { self , build_airflow_template_envs} ,
10399 operations:: {
@@ -113,6 +109,21 @@ use crate::{
113109 } ,
114110} ;
115111
112+ // Used for env-vars: AIRFLOW__WEBSERVER__SECRET_KEY, AIRFLOW__API__SECRET_KEY
113+ // N.B. AIRFLOW__WEBSERVER__SECRET_KEY is deprecated as of 3.0.2.
114+ // Secret key used to run the api server. It should be as random as possible.
115+ // It should be consistent across instances of the webserver. The webserver key
116+ // is also used to authorize requests to Celery workers when logs are retrieved.
117+ pub const INTERNAL_SECRET_SECRET_KEY : & str = "INTERNAL_SECRET" ;
118+ // Used for env-var: AIRFLOW__API_AUTH__JWT_SECRET
119+ // Secret key used to encode and decode JWTs to authenticate to public and
120+ // private APIs. It should be as random as possible, but consistent across
121+ // instances of API services.
122+ pub const JWT_SECRET_SECRET_KEY : & str = "JWT_SECRET" ;
123+ // Used for env-var: AIRFLOW__CORE__FERNET_KEY
124+ // See https://airflow.apache.org/docs/apache-airflow/stable/security/secrets/fernet.html#security-fernet
125+ pub const FERNET_KEY_SECRET_KEY : & str = "FERNET_KEY" ;
126+
116127pub const AIRFLOW_CONTROLLER_NAME : & str = "airflowcluster" ;
117128pub const DOCKER_IMAGE_BASE_NAME : & str = "airflow" ;
118129pub const AIRFLOW_FULL_CONTROLLER_NAME : & str =
@@ -353,7 +364,9 @@ pub enum Error {
353364 } ,
354365
355366 #[ snafu( display( "failed to create internal secret" ) ) ]
356- InvalidInternalSecret { source : crd:: internal_secret:: Error } ,
367+ InvalidInternalSecret {
368+ source : random_secret_creation:: Error ,
369+ } ,
357370}
358371
359372type Result < T , E = Error > = std:: result:: Result < T , E > ;
@@ -479,7 +492,7 @@ pub async fn reconcile_airflow(
479492 . await ?;
480493 }
481494
482- create_random_secret (
495+ random_secret_creation :: create_random_secret_if_not_exists (
483496 & airflow. shared_internal_secret_secret_name ( ) ,
484497 INTERNAL_SECRET_SECRET_KEY ,
485498 256 ,
@@ -489,7 +502,7 @@ pub async fn reconcile_airflow(
489502 . await
490503 . context ( InvalidInternalSecretSnafu ) ?;
491504
492- create_random_secret (
505+ random_secret_creation :: create_random_secret_if_not_exists (
493506 & airflow. shared_jwt_secret_secret_name ( ) ,
494507 JWT_SECRET_SECRET_KEY ,
495508 256 ,
@@ -499,7 +512,7 @@ pub async fn reconcile_airflow(
499512 . await
500513 . context ( InvalidInternalSecretSnafu ) ?;
501514
502- create_random_secret (
515+ random_secret_creation :: create_random_secret_if_not_exists (
503516 & airflow. shared_fernet_key_secret_name ( ) ,
504517 FERNET_KEY_SECRET_KEY ,
505518 // https://airflow.apache.org/docs/apache-airflow/stable/security/secrets/fernet.html#security-fernet
0 commit comments