Skip to content

Commit 09fb3ce

Browse files
committed
fix: migrate immutable internal secrets to mutable versions
1 parent 44bfedd commit 09fb3ce

4 files changed

Lines changed: 28 additions & 133 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@
66

77
- Document Helm deployed RBAC permissions and remove unnecessary permissions ([#767]).
88

9+
### Fixed
10+
11+
- Do not use immutable Secret objects for internal secrets. Migrate existing secrets to mutable versions ([#770]).
12+
913
- [#767]: https://github.com/stackabletech/airflow-operator/pull/767
14+
- [#770]: https://github.com/stackabletech/airflow-operator/pull/770
1015

1116
## [26.3.0] - 2026-03-16
1217

rust/operator-binary/src/airflow_controller.rs

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
116127
pub const AIRFLOW_CONTROLLER_NAME: &str = "airflowcluster";
117128
pub const DOCKER_IMAGE_BASE_NAME: &str = "airflow";
118129
pub 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

359372
type 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

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

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

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ use crate::{
6161
pub mod affinity;
6262
pub mod authentication;
6363
pub mod authorization;
64-
pub mod internal_secret;
6564

6665
pub const APP_NAME: &str = "airflow";
6766
pub const FIELD_MANAGER: &str = "airflow-operator";

0 commit comments

Comments
 (0)