Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
503 changes: 308 additions & 195 deletions Cargo.lock

Large diffs are not rendered by default.

1,191 changes: 861 additions & 330 deletions Cargo.nix

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repository = "https://github.com/stackabletech/airflow-operator"

[workspace.dependencies]
product-config = { git = "https://github.com/stackabletech/product-config.git", tag = "0.7.0" }
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", features = ["telemetry", "versioned"], tag = "stackable-operator-0.94.0" }
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", features = ["telemetry", "versioned"], tag = "stackable-operator-0.95.0" }

anyhow = "1.0"
built = { version = "0.8", features = ["chrono", "git2"] }
Expand All @@ -20,7 +20,7 @@ const_format = "0.2"
fnv = "1.0"
futures = { version = "0.3", features = ["compat"] }
indoc = "2.0"
rstest = "0.25"
rstest = "0.26"
semver = "1.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
Expand Down
14 changes: 7 additions & 7 deletions crate-hashes.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 20 additions & 11 deletions rust/operator-binary/src/airflow_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ use stackable_operator::{
},
},
cluster_resources::{ClusterResourceApplyStrategy, ClusterResources},
commons::{product_image_selection::ResolvedProductImage, rbac::build_rbac_resources},
commons::{
product_image_selection::{self, ResolvedProductImage},
rbac::build_rbac_resources,
},
config::fragment::ValidationError,
crd::{
authentication::{core as auth_core, ldap},
Expand Down Expand Up @@ -68,11 +71,11 @@ use stackable_operator::{
role_utils::{
CommonConfiguration, GenericProductSpecificCommonConfig, GenericRoleConfig, RoleGroupRef,
},
shared::time::Duration,
status::condition::{
compute_conditions, operations::ClusterOperationsConditionBuilder,
statefulset::StatefulSetConditionBuilder,
},
time::Duration,
utils::COMMON_BASH_TRAP_FUNCTIONS,
};
use strum::{EnumDiscriminants, IntoEnumIterator, IntoStaticStr};
Expand Down Expand Up @@ -351,6 +354,11 @@ pub enum Error {
InvalidAuthorizationConfig {
source: stackable_operator::commons::opa::Error,
},

#[snafu(display("failed to resolve product image"))]
ResolveProductImage {
source: product_image_selection::Error,
},
}

type Result<T, E = Error> = std::result::Result<T, E>;
Expand All @@ -374,10 +382,11 @@ pub async fn reconcile_airflow(
.context(InvalidAirflowClusterSnafu)?;

let client = &ctx.client;
let resolved_product_image: ResolvedProductImage = airflow
let resolved_product_image = airflow
.spec
.image
.resolve(DOCKER_IMAGE_BASE_NAME, crate::built_info::PKG_VERSION);
.resolve(DOCKER_IMAGE_BASE_NAME, crate::built_info::PKG_VERSION)
.context(ResolveProductImageSnafu)?;

let cluster_operation_cond_builder =
ClusterOperationsConditionBuilder::new(&airflow.spec.cluster_operation);
Expand Down Expand Up @@ -506,7 +515,7 @@ pub async fn reconcile_airflow(
let role_group_service_recommended_labels = build_recommended_labels(
airflow,
AIRFLOW_CONTROLLER_NAME,
&resolved_product_image.app_version_label,
&resolved_product_image.app_version_label_value,
&rolegroup.role,
&rolegroup.role_group,
);
Expand Down Expand Up @@ -606,7 +615,7 @@ pub async fn reconcile_airflow(
build_recommended_labels(
airflow,
AIRFLOW_CONTROLLER_NAME,
&resolved_product_image.app_version_label,
&resolved_product_image.app_version_label_value,
role_name,
"none",
),
Expand Down Expand Up @@ -792,7 +801,7 @@ fn build_rolegroup_config_map(
.with_recommended_labels(build_recommended_labels(
airflow,
AIRFLOW_CONTROLLER_NAME,
&resolved_product_image.app_version_label,
&resolved_product_image.app_version_label_value,
&rolegroup.role,
&rolegroup.role_group,
))
Expand Down Expand Up @@ -837,7 +846,7 @@ fn build_rolegroup_metadata(
.with_recommended_labels(build_recommended_labels(
airflow,
AIRFLOW_CONTROLLER_NAME,
&resolved_product_image.app_version_label,
&resolved_product_image.app_version_label_value,
&rolegroup.role,
&rolegroup.role_group,
))
Expand Down Expand Up @@ -905,7 +914,7 @@ fn build_server_rolegroup_statefulset(
let recommended_object_labels = build_recommended_labels(
airflow,
AIRFLOW_CONTROLLER_NAME,
&resolved_product_image.app_version_label,
&resolved_product_image.app_version_label_value,
&rolegroup_ref.role,
&rolegroup_ref.role_group,
);
Expand Down Expand Up @@ -1219,7 +1228,7 @@ fn build_executor_template_config_map(
.with_recommended_labels(build_recommended_labels(
airflow,
AIRFLOW_CONTROLLER_NAME,
&resolved_product_image.app_version_label,
&resolved_product_image.app_version_label_value,
"executor",
"executor-template",
))
Expand Down Expand Up @@ -1326,7 +1335,7 @@ fn build_executor_template_config_map(
.with_recommended_labels(build_recommended_labels(
airflow,
AIRFLOW_CONTROLLER_NAME,
&resolved_product_image.app_version_label,
&resolved_product_image.app_version_label_value,
"executor",
"executor-template",
))
Expand Down
2 changes: 1 addition & 1 deletion rust/operator-binary/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ mod tests {
use rstest::rstest;
use stackable_operator::{
crd::authentication::{ldap, oidc},
time::Duration,
shared::time::Duration,
};

use crate::{
Expand Down
2 changes: 1 addition & 1 deletion rust/operator-binary/src/crd/authorization.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use stackable_operator::{client::Client, commons::opa::OpaApiVersion, time::Duration};
use stackable_operator::{client::Client, commons::opa::OpaApiVersion, shared::time::Duration};

use crate::crd::{AirflowAuthorization, AirflowOpaConfig, v1alpha1};

Expand Down
9 changes: 6 additions & 3 deletions rust/operator-binary/src/crd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ use stackable_operator::{
RoleGroup, RoleGroupRef,
},
schemars::{self, JsonSchema},
shared::time::Duration,
status::condition::{ClusterCondition, HasStatusCondition},
time::Duration,
utils::{COMMON_BASH_TRAP_FUNCTIONS, crds::raw_object_list_schema},
versioned::versioned,
};
Expand Down Expand Up @@ -1017,8 +1017,11 @@ mod tests {
let cluster: AirflowCluster =
serde_yaml::with::singleton_map_recursive::deserialize(deserializer).unwrap();

let resolved_airflow_image: ResolvedProductImage =
cluster.spec.image.resolve("airflow", "0.0.0-dev");
let resolved_airflow_image: ResolvedProductImage = cluster
.spec
.image
.resolve("airflow", "0.0.0-dev")
.expect("test: resolved product image is always valid");

assert_eq!("2.10.5", &resolved_airflow_image.product_version);

Expand Down
3 changes: 1 addition & 2 deletions rust/operator-binary/src/env_vars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -641,8 +641,7 @@ fn execution_server_env_vars(airflow: &v1alpha1::AirflowCluster) -> BTreeMap<Str

#[cfg(test)]
mod tests {

use stackable_operator::time::Duration;
use stackable_operator::shared::time::Duration;

use super::*;
use crate::crd::authorization::OpaConfigResolved;
Expand Down
10 changes: 5 additions & 5 deletions rust/operator-binary/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ async fn main() -> anyhow::Result<()> {
Command::Run(ProductOperatorRun {
product_config,
watch_namespace,
telemetry_arguments,
cluster_info_opts,
operator_environment: _,
telemetry,
cluster_info,
}) => {
// NOTE (@NickLarsenNZ): Before stackable-telemetry was used:
// - The console log level was set by `AIRFLOW_OPERATOR_LOG`, and is now `CONSOLE_LOG` (when using Tracing::pre_configured).
// - The file log level was set by `AIRFLOW_OPERATOR_LOG`, and is now set via `FILE_LOG` (when using Tracing::pre_configured).
// - The file log directory was set by `AIRFLOW_OPERATOR_LOG_DIRECTORY`, and is now set by `ROLLING_LOGS_DIR` (or via `--rolling-logs <DIRECTORY>`).
let _tracing_guard =
Tracing::pre_configured(built_info::PKG_NAME, telemetry_arguments).init()?;
let _tracing_guard = Tracing::pre_configured(built_info::PKG_NAME, telemetry).init()?;

tracing::info!(
built_info.pkg_version = built_info::PKG_VERSION,
Expand All @@ -93,7 +93,7 @@ async fn main() -> anyhow::Result<()> {

let client = stackable_operator::client::initialize_operator(
Some(OPERATOR_NAME.to_string()),
&cluster_info_opts,
&cluster_info,
)
.await?;

Expand Down
Loading