Skip to content

Commit 5886b3a

Browse files
refactor: Upgrade rust to 1.85.0 and fix formatting (f1f1a9e) (#603)
* chore: Generated commit to update templated files since the last template run up to stackabletech/operator-templating@f1f1a9e Reference-to: stackabletech/operator-templating@f1f1a9e (Bump Rust to 1.85.0) * fix: rustfmt lint * ci: use nightly toolchain for cargo udeps * ci: use nightly toolchain for cargo udeps * Revert "ci: use nightly toolchain for cargo udeps" This reverts commit 3c7ee9e. * Revert "ci: use nightly toolchain for cargo udeps" This reverts commit f1534d5. --------- Co-authored-by: Nick Larsen <[email protected]>
1 parent 4bbd9e0 commit 5886b3a

File tree

15 files changed

+218
-249
lines changed

15 files changed

+218
-249
lines changed

.github/PULL_REQUEST_TEMPLATE/pre-release-rust-deps.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Bump Rust Dependencies for Stackable Release XX.(X)X
1+
# Bump Rust Dependencies for Stackable Release YY.M.X
22

33
<!--
44
Make sure to update the link in 'issues/.github/ISSUE_TEMPLATE/pre-release-operator-rust-deps.md'
@@ -32,7 +32,7 @@ Part of <https://github.com/stackabletech/issues/issues/TRACKING_ISSUE>
3232
3333
```[tasklist]
3434
### Bump Rust Dependencies
35-
- [ ] Bump `stackable-operator` and friends.
36-
- [ ] Bump `product-version`.
37-
- [ ] Bump all other dependencies.
35+
- [ ] Bump `stackable-operator` and friends
36+
- [ ] Bump `product-config`
37+
- [ ] Bump all other dependencies
3838
```

.github/workflows/build.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ env:
2626
CARGO_TERM_COLOR: always
2727
CARGO_INCREMENTAL: '0'
2828
CARGO_PROFILE_DEV_DEBUG: '0'
29-
RUST_TOOLCHAIN_VERSION: "1.84.1"
29+
RUST_TOOLCHAIN_VERSION: "1.85.0"
30+
RUST_NIGHTLY_TOOLCHAIN_VERSION: "nightly-2025-01-15"
3031
PYTHON_VERSION: "3.12"
3132
RUSTFLAGS: "-D warnings"
3233
RUSTDOCFLAGS: "-D warnings"
@@ -136,9 +137,11 @@ jobs:
136137
submodules: recursive
137138
- uses: dtolnay/rust-toolchain@c5a29ddb4d9d194e7c84ec8c3fba61b1c31fee8c
138139
with:
139-
toolchain: ${{ env.RUST_TOOLCHAIN_VERSION }}
140+
toolchain: ${{ env.RUST_NIGHTLY_TOOLCHAIN_VERSION }}
140141
components: rustfmt
141-
- run: cargo fmt --all -- --check
142+
- env:
143+
RUST_TOOLCHAIN_VERSION: ${{ env.RUST_NIGHTLY_TOOLCHAIN_VERSION }}
144+
run: cargo "+$RUST_TOOLCHAIN_VERSION" fmt --all -- --check
142145

143146
run_clippy:
144147
name: Run Clippy

.vscode/settings.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"rust-analyzer.rustfmt.overrideCommand": [
3+
"rustfmt",
4+
"+nightly-2025-01-15",
5+
"--"
6+
],
7+
}

rust-toolchain.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# DO NOT EDIT, this file is generated by operator-templating
22
[toolchain]
3-
channel = "1.84.1"
3+
channel = "1.85.0"

rust/operator-binary/src/airflow_controller.rs

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ use std::{
88

99
use const_format::concatcp;
1010
use product_config::{
11+
ProductConfigManager,
1112
flask_app_config_writer::{self, FlaskAppConfigWriterError},
1213
types::PropertyNameKind,
13-
ProductConfigManager,
1414
};
1515
use snafu::{OptionExt, ResultExt, Snafu};
1616
use stackable_operator::{
@@ -19,19 +19,19 @@ use stackable_operator::{
1919
configmap::ConfigMapBuilder,
2020
meta::ObjectMetaBuilder,
2121
pod::{
22-
container::ContainerBuilder, resources::ResourceRequirementsBuilder,
23-
security::PodSecurityContextBuilder, volume::VolumeBuilder, PodBuilder,
22+
PodBuilder, container::ContainerBuilder, resources::ResourceRequirementsBuilder,
23+
security::PodSecurityContextBuilder, volume::VolumeBuilder,
2424
},
2525
},
2626
cluster_resources::{ClusterResourceApplyStrategy, ClusterResources},
2727
commons::{
28-
authentication::{ldap, AuthenticationClass},
28+
authentication::{AuthenticationClass, ldap},
2929
product_image_selection::ResolvedProductImage,
3030
rbac::build_rbac_resources,
3131
},
3232
config::fragment::ValidationError,
3333
k8s_openapi::{
34-
self,
34+
self, DeepMerge,
3535
api::{
3636
apps::v1::{StatefulSet, StatefulSetSpec},
3737
core::v1::{
@@ -40,19 +40,18 @@ use stackable_operator::{
4040
},
4141
},
4242
apimachinery::pkg::{apis::meta::v1::LabelSelector, util::intstr::IntOrString},
43-
DeepMerge,
4443
},
4544
kube::{
45+
Resource, ResourceExt,
4646
api::ObjectMeta,
47-
core::{error_boundary, DeserializeGuard},
47+
core::{DeserializeGuard, error_boundary},
4848
runtime::{controller::Action, reflector::ObjectRef},
49-
Resource, ResourceExt,
5049
},
5150
kvp::{Label, LabelError, Labels},
5251
logging::controller::ReconcilerError,
5352
product_config_utils::{
54-
transform_all_roles_to_config, validate_all_roles_and_groups_config,
5553
CONFIG_OVERRIDE_FILE_FOOTER_KEY, CONFIG_OVERRIDE_FILE_HEADER_KEY,
54+
transform_all_roles_to_config, validate_all_roles_and_groups_config,
5655
},
5756
product_logging::{
5857
self,
@@ -75,17 +74,17 @@ use crate::{
7574
config::{self, PYTHON_IMPORTS},
7675
controller_commons::{self, CONFIG_VOLUME_NAME, LOG_CONFIG_VOLUME_NAME, LOG_VOLUME_NAME},
7776
crd::{
78-
self,
77+
self, AIRFLOW_CONFIG_FILENAME, AIRFLOW_UID, APP_NAME, AirflowClusterStatus, AirflowConfig,
78+
AirflowConfigOptions, AirflowExecutor, AirflowRole, CONFIG_PATH, Container, ExecutorConfig,
79+
ExecutorConfigFragment, LOG_CONFIG_DIR, OPERATOR_NAME, STACKABLE_LOG_DIR,
80+
TEMPLATE_CONFIGMAP_NAME, TEMPLATE_LOCATION, TEMPLATE_NAME, TEMPLATE_VOLUME_NAME,
7981
authentication::{
8082
AirflowAuthenticationClassResolved, AirflowClientAuthenticationDetailsResolved,
8183
},
8284
authorization::AirflowAuthorizationResolved,
8385
build_recommended_labels,
84-
git_sync::{GitSync, GIT_SYNC_CONTENT, GIT_SYNC_NAME, GIT_SYNC_ROOT},
85-
v1alpha1, AirflowClusterStatus, AirflowConfig, AirflowConfigOptions, AirflowExecutor,
86-
AirflowRole, Container, ExecutorConfig, ExecutorConfigFragment, AIRFLOW_CONFIG_FILENAME,
87-
AIRFLOW_UID, APP_NAME, CONFIG_PATH, LOG_CONFIG_DIR, OPERATOR_NAME, STACKABLE_LOG_DIR,
88-
TEMPLATE_CONFIGMAP_NAME, TEMPLATE_LOCATION, TEMPLATE_NAME, TEMPLATE_VOLUME_NAME,
86+
git_sync::{GIT_SYNC_CONTENT, GIT_SYNC_NAME, GIT_SYNC_ROOT, GitSync},
87+
v1alpha1,
8988
},
9089
env_vars::{
9190
self, build_airflow_template_envs, build_gitsync_statefulset_envs, build_gitsync_template,
@@ -552,10 +551,10 @@ pub async fn reconcile_airflow(
552551
.context(DeleteOrphanedResourcesSnafu)?;
553552

554553
let status = AirflowClusterStatus {
555-
conditions: compute_conditions(
556-
airflow,
557-
&[&ss_cond_builder, &cluster_operation_cond_builder],
558-
),
554+
conditions: compute_conditions(airflow, &[
555+
&ss_cond_builder,
556+
&cluster_operation_cond_builder,
557+
]),
559558
};
560559

561560
client
@@ -1001,13 +1000,15 @@ fn build_server_rolegroup_statefulset(
10011000
"pipefail".to_string(),
10021001
"-c".to_string(),
10031002
])
1004-
.args(vec![[
1005-
COMMON_BASH_TRAP_FUNCTIONS.to_string(),
1006-
"prepare_signal_handlers".to_string(),
1007-
"/stackable/statsd_exporter &".to_string(),
1008-
"wait_for_termination $!".to_string(),
1009-
]
1010-
.join("\n")])
1003+
.args(vec![
1004+
[
1005+
COMMON_BASH_TRAP_FUNCTIONS.to_string(),
1006+
"prepare_signal_handlers".to_string(),
1007+
"/stackable/statsd_exporter &".to_string(),
1008+
"wait_for_termination $!".to_string(),
1009+
]
1010+
.join("\n"),
1011+
])
10111012
.add_container_port(METRICS_PORT_NAME, METRICS_PORT)
10121013
.resources(
10131014
ResourceRequirementsBuilder::new()

rust/operator-binary/src/config.rs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ use stackable_operator::commons::{
88
};
99

1010
use crate::crd::{
11+
AirflowConfigOptions,
1112
authentication::{
1213
AirflowAuthenticationClassResolved, AirflowClientAuthenticationDetailsResolved,
13-
FlaskRolesSyncMoment, DEFAULT_OIDC_PROVIDER,
14+
DEFAULT_OIDC_PROVIDER, FlaskRolesSyncMoment,
1415
},
1516
authorization::{AirflowAuthorizationResolved, OpaConfigResolved},
16-
AirflowConfigOptions,
1717
};
1818

1919
pub const PYTHON_IMPORTS: &[&str] = &[
@@ -324,8 +324,8 @@ mod tests {
324324
config::add_airflow_config,
325325
crd::{
326326
authentication::{
327-
default_user_registration, AirflowAuthenticationClassResolved,
328-
AirflowClientAuthenticationDetailsResolved, FlaskRolesSyncMoment,
327+
AirflowAuthenticationClassResolved, AirflowClientAuthenticationDetailsResolved,
328+
FlaskRolesSyncMoment, default_user_registration,
329329
},
330330
authorization::{AirflowAuthorizationResolved, OpaConfigResolved},
331331
},
@@ -482,9 +482,7 @@ mod tests {
482482
("AUTH_TYPE".into(), "AUTH_OAUTH".into()),
483483
("AUTH_USER_REGISTRATION".into(), "true".into()),
484484
("AUTH_USER_REGISTRATION_ROLE".into(), "Admin".into()),
485-
(
486-
"OAUTH_PROVIDERS".into(),
487-
formatdoc! {"
485+
("OAUTH_PROVIDERS".into(), formatdoc! {"
488486
[
489487
{{ 'name': 'keycloak',
490488
'icon': 'fa-key',
@@ -513,8 +511,7 @@ mod tests {
513511
}},
514512
}}
515513
]
516-
"}
517-
)
514+
"})
518515
]),
519516
result
520517
);

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
use stackable_operator::{
22
commons::affinity::{
3-
affinity_between_cluster_pods, affinity_between_role_pods, StackableAffinityFragment,
3+
StackableAffinityFragment, affinity_between_cluster_pods, affinity_between_role_pods,
44
},
55
k8s_openapi::api::core::v1::{PodAffinity, PodAntiAffinity},
66
};
77

8-
use crate::crd::{AirflowRole, APP_NAME};
8+
use crate::crd::{APP_NAME, AirflowRole};
99

1010
/// Used for all [`AirflowRole`]s besides executors.
1111
pub fn get_affinity(cluster_name: &str, role: &AirflowRole) -> StackableAffinityFragment {
@@ -55,7 +55,7 @@ mod tests {
5555
role_utils::RoleGroupRef,
5656
};
5757

58-
use crate::crd::{v1alpha1, AirflowExecutor, AirflowRole};
58+
use crate::crd::{AirflowExecutor, AirflowRole, v1alpha1};
5959

6060
#[rstest]
6161
#[case(AirflowRole::Worker)]

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

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
use std::{collections::BTreeSet, future::Future, mem};
22

33
use serde::{Deserialize, Serialize};
4-
use snafu::{ensure, ResultExt, Snafu};
4+
use snafu::{ResultExt, Snafu, ensure};
55
use stackable_operator::{
66
client::Client,
77
commons::authentication::{
8-
ldap,
8+
AuthenticationClass, AuthenticationClassProvider, ClientAuthenticationDetails, ldap,
99
oidc::{self, IdentityProviderHint},
10-
AuthenticationClass, AuthenticationClassProvider, ClientAuthenticationDetails,
1110
},
1211
schemars::{self, JsonSchema},
1312
};
@@ -40,11 +39,15 @@ pub enum Error {
4039
auth_class_name: String,
4140
provider: String,
4241
},
43-
#[snafu(display("Only one authentication type at a time is supported by Airflow, see https://github.com/dpgaspar/Flask-AppBuilder/issues/1924."))]
42+
#[snafu(display(
43+
"Only one authentication type at a time is supported by Airflow, see https://github.com/dpgaspar/Flask-AppBuilder/issues/1924."
44+
))]
4445
MultipleAuthenticationTypesNotSupported,
4546
#[snafu(display("Only one LDAP provider at a time is supported by Airflow."))]
4647
MultipleLdapProvidersNotSupported,
47-
#[snafu(display("The OIDC provider {oidc_provider:?} is not yet supported (AuthenticationClass {auth_class_name:?})."))]
48+
#[snafu(display(
49+
"The OIDC provider {oidc_provider:?} is not yet supported (AuthenticationClass {auth_class_name:?})."
50+
))]
4851
OidcProviderNotSupported {
4952
auth_class_name: String,
5053
oidc_provider: String,
@@ -147,6 +150,7 @@ impl AirflowClientAuthenticationDetailsResolved {
147150
};
148151
AirflowClientAuthenticationDetailsResolved::resolve(auth_details, resolve_auth_class).await
149152
}
153+
150154
pub async fn resolve<R>(
151155
auth_details: &[AirflowClientAuthenticationDetails],
152156
resolve_auth_class: impl Fn(ClientAuthenticationDetails) -> R,
@@ -264,8 +268,11 @@ impl AirflowClientAuthenticationDetailsResolved {
264268
) -> Result<AirflowAuthenticationClassResolved> {
265269
let oidc_provider = match &provider.provider_hint {
266270
None => {
267-
info!("No OIDC provider hint given in AuthClass {auth_class_name}, assuming {default_oidc_provider_name}",
268-
default_oidc_provider_name = serde_json::to_string(&DEFAULT_OIDC_PROVIDER).unwrap());
271+
info!(
272+
"No OIDC provider hint given in AuthClass {auth_class_name}, assuming {default_oidc_provider_name}",
273+
default_oidc_provider_name =
274+
serde_json::to_string(&DEFAULT_OIDC_PROVIDER).unwrap()
275+
);
269276
DEFAULT_OIDC_PROVIDER
270277
}
271278
Some(oidc_provider) => oidc_provider.to_owned(),

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use stackable_operator::{client::Client, commons::opa::OpaApiVersion, time::Duration};
22

3-
use crate::crd::{v1alpha1, AirflowAuthorization, AirflowOpaConfig};
3+
use crate::crd::{AirflowAuthorization, AirflowOpaConfig, v1alpha1};
44

55
pub struct AirflowAuthorizationResolved {
66
pub opa: Option<OpaConfigResolved>,

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,8 @@ mod tests {
276276
"--git-config='safe.directory:/tmp/git,http.sslCAInfo:/tmp/ca-cert/ca.crt'"
277277
)]
278278
#[case(
279-
"--git-config: 'http.sslCAInfo:/tmp/ca-cert/ca.crt,safe.directory:/tmp/git2'",
280-
"--git-config='safe.directory:/tmp/git,http.sslCAInfo:/tmp/ca-cert/ca.crt,safe.directory:/tmp/git2'"
279+
"--git-config: 'http.sslCAInfo:/tmp/ca-cert/ca.crt,safe.directory:/tmp/git2'",
280+
"--git-config='safe.directory:/tmp/git,http.sslCAInfo:/tmp/ca-cert/ca.crt,safe.directory:/tmp/git2'"
281281
)]
282282
fn test_git_sync_git_config(#[case] input: &str, #[case] output: &str) {
283283
let cluster = format!(
@@ -317,11 +317,13 @@ mod tests {
317317
let cluster: AirflowCluster =
318318
serde_yaml::with::singleton_map_recursive::deserialize(deserializer).unwrap();
319319

320-
assert!(cluster
321-
.git_sync()
322-
.unwrap()
323-
.get_args(false)
324-
.iter()
325-
.any(|c| c.contains(output)));
320+
assert!(
321+
cluster
322+
.git_sync()
323+
.unwrap()
324+
.get_args(false)
325+
.iter()
326+
.any(|c| c.contains(output))
327+
);
326328
}
327329
}

0 commit comments

Comments
 (0)