Skip to content

Commit 265c34c

Browse files
committed
chore: Run cargo +nightly fmt
1 parent 66b0b80 commit 265c34c

File tree

9 files changed

+1287
-556
lines changed

9 files changed

+1287
-556
lines changed

Cargo.lock

Lines changed: 224 additions & 213 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.nix

Lines changed: 1008 additions & 318 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,18 @@ repository = "https://github.com/stackabletech/hive-operator"
1313
anyhow = "1.0"
1414
built = { version = "0.7", features = ["chrono", "git2"] }
1515
clap = "4.5"
16+
const_format = "0.2"
1617
fnv = "1.0"
1718
futures = { version = "0.3", features = ["compat"] }
1819
indoc = "2.0"
1920
pin-project = "1.1"
20-
rstest = "0.23"
21+
rstest = "0.24"
2122
semver = "1.0"
2223
serde = { version = "1.0", features = ["derive"] }
2324
serde_json = "1.0"
2425
serde_yaml = "0.9"
2526
snafu = "0.8"
26-
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.83.0" }
27+
stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "stackable-operator-0.84.0" }
2728
product-config = { git = "https://github.com/stackabletech/product-config.git", tag = "0.7.0" }
2829
strum = { version = "0.26", features = ["derive"] }
2930
tokio = { version = "1.40", features = ["full"] }

crate-hashes.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deploy/helm/hive-operator/templates/roles.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ rules:
9090
- events
9191
verbs:
9292
- create
93+
- patch
9394
- apiGroups:
9495
- {{ include "operator.name" . }}.stackable.tech
9596
resources:

rust/crd/src/lib.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ use stackable_operator::{
2323
kube::{runtime::reflector::ObjectRef, CustomResource, ResourceExt},
2424
product_config_utils::{self, Configuration},
2525
product_logging::{self, spec::Logging},
26-
role_utils::{GenericRoleConfig, Role, RoleGroup, RoleGroupRef},
26+
role_utils::{
27+
GenericProductSpecificCommonConfig, GenericRoleConfig, Role, RoleGroup, RoleGroupRef,
28+
},
2729
schemars::{self, JsonSchema},
2830
status::condition::{ClusterCondition, HasStatusCondition},
2931
time::Duration,
@@ -603,7 +605,7 @@ impl HiveCluster {
603605
pub fn rolegroup(
604606
&self,
605607
rolegroup_ref: &RoleGroupRef<HiveCluster>,
606-
) -> Result<RoleGroup<MetaStoreConfigFragment>, Error> {
608+
) -> Result<RoleGroup<MetaStoreConfigFragment, GenericProductSpecificCommonConfig>, Error> {
607609
let role_variant =
608610
HiveRole::from_str(&rolegroup_ref.role).with_context(|_| UnknownHiveRoleSnafu {
609611
role: rolegroup_ref.role.to_owned(),

rust/operator-binary/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ stackable-hive-crd = { path = "../crd" }
1313

1414
anyhow.workspace = true
1515
clap.workspace = true
16+
const_format.workspace = true
1617
fnv.workspace = true
1718
futures.workspace = true
1819
indoc.workspace = true

rust/operator-binary/src/controller.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use std::{
66
sync::Arc,
77
};
88

9+
use const_format::concatcp;
910
use fnv::FnvHasher;
1011
use indoc::formatdoc;
1112
use product_config::{
@@ -22,7 +23,6 @@ use stackable_hive_crd::{
2223
STACKABLE_CONFIG_MOUNT_DIR_NAME, STACKABLE_LOG_CONFIG_MOUNT_DIR,
2324
STACKABLE_LOG_CONFIG_MOUNT_DIR_NAME, STACKABLE_LOG_DIR, STACKABLE_LOG_DIR_NAME,
2425
};
25-
2626
use stackable_operator::{
2727
builder::{
2828
self,
@@ -87,19 +87,23 @@ use stackable_operator::{
8787
use strum::EnumDiscriminants;
8888
use tracing::warn;
8989

90-
use crate::kerberos::{add_kerberos_pod_config, kerberos_config_properties};
9190
use crate::{
9291
command::build_container_command_args,
93-
discovery, kerberos,
94-
kerberos::kerberos_container_start_commands,
92+
discovery,
93+
kerberos::{
94+
self, add_kerberos_pod_config, kerberos_config_properties,
95+
kerberos_container_start_commands,
96+
},
9597
operations::{graceful_shutdown::add_graceful_shutdown_config, pdb::add_pdbs},
9698
product_logging::{extend_role_group_config_map, resolve_vector_aggregator_address},
9799
OPERATOR_NAME,
98100
};
99101

102+
pub const HIVE_CONTROLLER_NAME: &str = "hivecluster";
103+
pub const HIVE_FULL_CONTROLLER_NAME: &str = concatcp!(HIVE_CONTROLLER_NAME, '.', OPERATOR_NAME);
104+
100105
/// Used as runAsUser in the pod security context. This is specified in the kafka image file
101106
pub const HIVE_UID: i64 = 1000;
102-
pub const HIVE_CONTROLLER_NAME: &str = "hivecluster";
103107
const DOCKER_IMAGE_BASE_NAME: &str = "hive";
104108

105109
pub const MAX_HIVE_LOG_FILES_SIZE: MemoryQuantity = MemoryQuantity {

rust/operator-binary/src/main.rs

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
mod command;
22
mod controller;
33
mod discovery;
4-
54
mod kerberos;
65
mod operations;
76
mod product_logging;
87

9-
use crate::controller::HIVE_CONTROLLER_NAME;
8+
use std::sync::Arc;
109

1110
use clap::{crate_description, crate_version, Parser};
1211
use futures::stream::StreamExt;
@@ -17,12 +16,18 @@ use stackable_operator::{
1716
apps::v1::StatefulSet,
1817
core::v1::{ConfigMap, Service},
1918
},
20-
kube::core::DeserializeGuard,
21-
kube::runtime::{watcher, Controller},
19+
kube::{
20+
core::DeserializeGuard,
21+
runtime::{
22+
events::{Recorder, Reporter},
23+
watcher, Controller,
24+
},
25+
},
2226
logging::controller::report_controller_reconciled,
2327
CustomResourceExt,
2428
};
25-
use std::sync::Arc;
29+
30+
use crate::controller::HIVE_FULL_CONTROLLER_NAME;
2631

2732
mod built_info {
2833
include!(concat!(env!("OUT_DIR"), "/built.rs"));
@@ -72,6 +77,13 @@ async fn main() -> anyhow::Result<()> {
7277
&cluster_info_opts,
7378
)
7479
.await?;
80+
let event_recorder = Arc::new(Recorder::new(
81+
client.as_kube_client(),
82+
Reporter {
83+
controller: HIVE_FULL_CONTROLLER_NAME.to_string(),
84+
instance: None,
85+
},
86+
));
7587

7688
Controller::new(
7789
watch_namespace.get_api::<DeserializeGuard<HiveCluster>>(&client),
@@ -98,14 +110,23 @@ async fn main() -> anyhow::Result<()> {
98110
product_config,
99111
}),
100112
)
101-
.map(|res| {
102-
report_controller_reconciled(
103-
&client,
104-
&format!("{HIVE_CONTROLLER_NAME}.{OPERATOR_NAME}"),
105-
&res,
106-
);
107-
})
108-
.collect::<()>()
113+
// We can let the reporting happen in the background
114+
.for_each_concurrent(
115+
16, // concurrency limit
116+
|result| {
117+
// The event_recorder needs to be shared across all invocations, so that
118+
// events are correctly aggregated
119+
let event_recorder = event_recorder.clone();
120+
async move {
121+
report_controller_reconciled(
122+
&event_recorder,
123+
HIVE_FULL_CONTROLLER_NAME,
124+
&result,
125+
)
126+
.await;
127+
}
128+
},
129+
)
109130
.await;
110131
}
111132
}

0 commit comments

Comments
 (0)