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
8 changes: 4 additions & 4 deletions .github/PULL_REQUEST_TEMPLATE/pre-release-rust-deps.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Bump Rust Dependencies for Stackable Release XX.(X)X
# Bump Rust Dependencies for Stackable Release YY.M.X

<!--
Make sure to update the link in 'issues/.github/ISSUE_TEMPLATE/pre-release-operator-rust-deps.md'
Expand Down Expand Up @@ -32,7 +32,7 @@ Part of <https://github.com/stackabletech/issues/issues/TRACKING_ISSUE>
```[tasklist]
### Bump Rust Dependencies
- [ ] Bump `stackable-operator` and friends.
- [ ] Bump `product-version`.
- [ ] Bump all other dependencies.
- [ ] Bump `stackable-operator` and friends
- [ ] Bump `product-config`
- [ ] Bump all other dependencies
```
9 changes: 6 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: '0'
CARGO_PROFILE_DEV_DEBUG: '0'
RUST_TOOLCHAIN_VERSION: "1.84.1"
RUST_TOOLCHAIN_VERSION: "1.85.0"
RUST_NIGHTLY_TOOLCHAIN_VERSION: "nightly-2025-01-15"
PYTHON_VERSION: "3.12"
RUSTFLAGS: "-D warnings"
RUSTDOCFLAGS: "-D warnings"
Expand Down Expand Up @@ -136,9 +137,11 @@ jobs:
submodules: recursive
- uses: dtolnay/rust-toolchain@c5a29ddb4d9d194e7c84ec8c3fba61b1c31fee8c
with:
toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }}
toolchain: ${{ env.RUST_NIGHTLY_TOOLCHAIN_VERSION }}
components: rustfmt
- run: cargo fmt --all -- --check
- env:
RUST_TOOLCHAIN_VERSION: ${{ env.RUST_NIGHTLY_TOOLCHAIN_VERSION }}
run: cargo "+$RUST_TOOLCHAIN_VERSION" fmt --all -- --check

run_clippy:
name: Run Clippy
Expand Down
7 changes: 7 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"rust-analyzer.rustfmt.overrideCommand": [
"rustfmt",
"+nightly-2025-01-15",
"--"
],
}
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# DO NOT EDIT, this file is generated by operator-templating
[toolchain]
channel = "1.84.1"
channel = "1.85.0"
8 changes: 4 additions & 4 deletions rust/operator-binary/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ use snafu::{ResultExt, Snafu};
use stackable_operator::commons::authentication::{ldap, oidc};

use crate::crd::{
SupersetConfigOptions,
authentication::{
self, SupersetAuthenticationClassResolved, SupersetClientAuthenticationDetailsResolved,
DEFAULT_OIDC_PROVIDER,
self, DEFAULT_OIDC_PROVIDER, SupersetAuthenticationClassResolved,
SupersetClientAuthenticationDetailsResolved,
},
SupersetConfigOptions,
};

#[derive(Snafu, Debug)]
Expand All @@ -35,7 +35,7 @@ pub const PYTHON_IMPORTS: &[&str] = &[
"from superset.stats_logger import StatsdStatsLogger",
"from flask_appbuilder.security.manager import (AUTH_DB, AUTH_LDAP, AUTH_OAUTH, AUTH_OID, AUTH_REMOTE_USER)",
"from log_config import StackableLoggingConfigurator",
];
];

pub fn add_superset_config(
config: &mut BTreeMap<String, String>,
Expand Down
72 changes: 33 additions & 39 deletions rust/operator-binary/src/crd/affinity.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use stackable_operator::{
commons::affinity::{affinity_between_role_pods, StackableAffinityFragment},
commons::affinity::{StackableAffinityFragment, affinity_between_role_pods},
k8s_openapi::api::core::v1::PodAntiAffinity,
};

use crate::crd::{SupersetRole, APP_NAME};
use crate::crd::{APP_NAME, SupersetRole};

pub fn get_affinity(cluster_name: &str, role: &SupersetRole) -> StackableAffinityFragment {
StackableAffinityFragment {
Expand Down Expand Up @@ -57,42 +57,36 @@ mod tests {
.merged_config(&SupersetRole::Node, &superset.node_rolegroup_ref("default"))
.unwrap();

assert_eq!(
merged_config.affinity,
StackableAffinity {
pod_affinity: None,
pod_anti_affinity: Some(PodAntiAffinity {
preferred_during_scheduling_ignored_during_execution: Some(vec![
WeightedPodAffinityTerm {
pod_affinity_term: PodAffinityTerm {
label_selector: Some(LabelSelector {
match_expressions: None,
match_labels: Some(BTreeMap::from([
(
"app.kubernetes.io/name".to_string(),
"superset".to_string(),
),
(
"app.kubernetes.io/instance".to_string(),
"simple-superset".to_string(),
),
(
"app.kubernetes.io/component".to_string(),
"node".to_string(),
)
]))
}),
topology_key: "kubernetes.io/hostname".to_string(),
..PodAffinityTerm::default()
},
weight: 70
}
]),
required_during_scheduling_ignored_during_execution: None,
}),
node_affinity: None,
node_selector: None,
}
);
assert_eq!(merged_config.affinity, StackableAffinity {
pod_affinity: None,
pod_anti_affinity: Some(PodAntiAffinity {
preferred_during_scheduling_ignored_during_execution: Some(vec![
WeightedPodAffinityTerm {
pod_affinity_term: PodAffinityTerm {
label_selector: Some(LabelSelector {
match_expressions: None,
match_labels: Some(BTreeMap::from([
("app.kubernetes.io/name".to_string(), "superset".to_string(),),
(
"app.kubernetes.io/instance".to_string(),
"simple-superset".to_string(),
),
(
"app.kubernetes.io/component".to_string(),
"node".to_string(),
)
]))
}),
topology_key: "kubernetes.io/hostname".to_string(),
..PodAffinityTerm::default()
},
weight: 70
}
]),
required_during_scheduling_ignored_during_execution: None,
}),
node_affinity: None,
node_selector: None,
});
}
}
20 changes: 13 additions & 7 deletions rust/operator-binary/src/crd/authentication.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
use std::{collections::BTreeSet, future::Future, mem};

use serde::{Deserialize, Serialize};
use snafu::{ensure, ResultExt, Snafu};
use snafu::{ResultExt, Snafu, ensure};
use stackable_operator::{
client::Client,
commons::authentication::{
ldap,
AuthenticationClass, AuthenticationClassProvider, ClientAuthenticationDetails, ldap,
oidc::{self, IdentityProviderHint},
AuthenticationClass, AuthenticationClassProvider, ClientAuthenticationDetails,
},
schemars::{self, JsonSchema},
};
Expand All @@ -32,7 +31,9 @@ pub enum Error {
source: stackable_operator::client::Error,
},

#[snafu(display("only one authentication type at a time is supported by Superset, see https://github.com/dpgaspar/Flask-AppBuilder/issues/1924"))]
#[snafu(display(
"only one authentication type at a time is supported by Superset, see https://github.com/dpgaspar/Flask-AppBuilder/issues/1924"
))]
MultipleAuthenticationTypesNotSupported,

#[snafu(display("only one LDAP provider at a time is supported by Superset"))]
Expand Down Expand Up @@ -66,7 +67,9 @@ pub enum Error {
source: stackable_operator::commons::authentication::Error,
},

#[snafu(display("the OIDC provider {oidc_provider:?} is not yet supported (AuthenticationClass {auth_class_name:?})"))]
#[snafu(display(
"the OIDC provider {oidc_provider:?} is not yet supported (AuthenticationClass {auth_class_name:?})"
))]
OidcProviderNotSupported {
auth_class_name: String,
oidc_provider: String,
Expand Down Expand Up @@ -279,8 +282,11 @@ impl SupersetClientAuthenticationDetailsResolved {
) -> Result<SupersetAuthenticationClassResolved> {
let oidc_provider = match &provider.provider_hint {
None => {
info!("No OIDC provider hint given in AuthClass {auth_class_name}, assuming {default_oidc_provider_name}",
default_oidc_provider_name = serde_json::to_string(&DEFAULT_OIDC_PROVIDER).unwrap());
info!(
"No OIDC provider hint given in AuthClass {auth_class_name}, assuming {default_oidc_provider_name}",
default_oidc_provider_name =
serde_json::to_string(&DEFAULT_OIDC_PROVIDER).unwrap()
);
DEFAULT_OIDC_PROVIDER
}
Some(oidc_provider) => oidc_provider.to_owned(),
Expand Down
2 changes: 1 addition & 1 deletion rust/operator-binary/src/crd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use stackable_operator::{
merge::Merge,
},
k8s_openapi::apimachinery::pkg::api::resource::Quantity,
kube::{runtime::reflector::ObjectRef, CustomResource, ResourceExt},
kube::{CustomResource, ResourceExt, runtime::reflector::ObjectRef},
memory::{BinaryMultiple, MemoryQuantity},
product_config_utils::{self, Configuration},
product_logging::{self, spec::Logging},
Expand Down
10 changes: 5 additions & 5 deletions rust/operator-binary/src/druid_connection_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ use stackable_operator::{
core::v1::{ConfigMap, PodSpec, PodTemplateSpec},
},
kube::{
core::{error_boundary, DeserializeGuard, DynamicObject},
runtime::{controller::Action, reflector::ObjectRef},
ResourceExt,
core::{DeserializeGuard, DynamicObject, error_boundary},
runtime::{controller::Action, reflector::ObjectRef},
},
logging::controller::ReconcilerError,
status::condition::{ClusterConditionStatus, ClusterConditionType},
Expand All @@ -25,11 +25,11 @@ use stackable_operator::{
use strum::{EnumDiscriminants, IntoStaticStr};

use crate::{
crd::{druidconnection, v1alpha1, PYTHONPATH, SUPERSET_CONFIG_FILENAME},
APP_NAME, OPERATOR_NAME,
crd::{PYTHONPATH, SUPERSET_CONFIG_FILENAME, druidconnection, v1alpha1},
rbac,
superset_controller::DOCKER_IMAGE_BASE_NAME,
util::{get_job_state, JobState},
APP_NAME, OPERATOR_NAME,
util::{JobState, get_job_state},
};

pub const DRUID_CONNECTION_CONTROLLER_NAME: &str = "druid-connection";
Expand Down
30 changes: 14 additions & 16 deletions rust/operator-binary/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use std::sync::Arc;

use clap::{crate_description, crate_version, Parser};
use futures::{pin_mut, StreamExt};
use clap::{Parser, crate_description, crate_version};
use futures::{StreamExt, pin_mut};
use stackable_operator::{
YamlSchema,
cli::{Command, ProductOperatorRun},
commons::authentication::AuthenticationClass,
k8s_openapi::api::{
Expand All @@ -11,23 +12,24 @@ use stackable_operator::{
core::v1::{ConfigMap, Service},
},
kube::{
ResourceExt,
core::DeserializeGuard,
runtime::{
Controller,
events::{Recorder, Reporter},
reflector::ObjectRef,
watcher, Controller,
watcher,
},
ResourceExt,
},
logging::controller::report_controller_reconciled,
shared::yaml::SerializeOptions,
YamlSchema,
};

use crate::{
crd::{
APP_NAME, SupersetCluster,
druidconnection::{self, DruidConnection},
v1alpha1, SupersetCluster, APP_NAME,
v1alpha1,
},
druid_connection_controller::DRUID_CONNECTION_FULL_CONTROLLER_NAME,
superset_controller::SUPERSET_FULL_CONTROLLER_NAME,
Expand Down Expand Up @@ -100,13 +102,11 @@ async fn main() -> anyhow::Result<()> {
)
.await?;

let superset_event_recorder = Arc::new(Recorder::new(
client.as_kube_client(),
Reporter {
let superset_event_recorder =
Arc::new(Recorder::new(client.as_kube_client(), Reporter {
controller: SUPERSET_FULL_CONTROLLER_NAME.to_string(),
instance: None,
},
));
}));
let superset_controller = Controller::new(
watch_namespace.get_api::<DeserializeGuard<v1alpha1::SupersetCluster>>(&client),
watcher::Config::default(),
Expand Down Expand Up @@ -161,13 +161,11 @@ async fn main() -> anyhow::Result<()> {
},
);

let druid_connection_event_recorder = Arc::new(Recorder::new(
client.as_kube_client(),
Reporter {
let druid_connection_event_recorder =
Arc::new(Recorder::new(client.as_kube_client(), Reporter {
controller: DRUID_CONNECTION_FULL_CONTROLLER_NAME.to_string(),
instance: None,
},
));
}));
let druid_connection_controller = Controller::new(
watch_namespace
.get_api::<DeserializeGuard<druidconnection::v1alpha1::DruidConnection>>(
Expand Down
4 changes: 2 additions & 2 deletions rust/operator-binary/src/operations/pdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use stackable_operator::{
};

use crate::{
crd::{v1alpha1, SupersetRole, APP_NAME},
superset_controller::SUPERSET_CONTROLLER_NAME,
OPERATOR_NAME,
crd::{APP_NAME, SupersetRole, v1alpha1},
superset_controller::SUPERSET_CONTROLLER_NAME,
};

#[derive(Snafu, Debug)]
Expand Down
Loading
Loading