Skip to content

chore: Bump to operator-rs 0.84.0 #690

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
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
368 changes: 187 additions & 181 deletions Cargo.lock

Large diffs are not rendered by default.

1,208 changes: 942 additions & 266 deletions Cargo.nix

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ anyhow = "1.0"
async-trait = "0.1"
built = { version = "0.7", features = ["chrono", "git2"] }
clap = "4.5"
const_format = "0.2"
futures = { version = "0.3", features = ["compat"] }
indoc = "2.0"
openssl = "0.10"
Expand All @@ -30,6 +31,6 @@ strum = { version = "0.26", features = ["derive"] }
tokio = { version = "1.40", features = ["full"] }
tracing = "0.1"

#[patch."https://github.com/stackabletech/operator-rs.git"]
#stackable-operator = { git = "https://github.com/stackabletech//operator-rs.git", branch = "main" }
[patch."https://github.com/stackabletech/operator-rs.git"]
stackable-operator = { git = "https://github.com/stackabletech//operator-rs.git", branch = "chore/bumps-4" }
# stackable-operator = { path = "../operator-rs/crates/stackable-operator" }
6 changes: 3 additions & 3 deletions crate-hashes.json

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

1 change: 1 addition & 0 deletions deploy/helm/trino-operator/templates/roles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ rules:
- events
verbs:
- create
- patch
- apiGroups:
- {{ include "operator.name" . }}.stackable.tech
resources:
Expand Down
1 change: 1 addition & 0 deletions rust/operator-binary/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ stackable-trino-crd = { path = "../crd" }
anyhow.workspace = true
async-trait.workspace = true
clap.workspace = true
const_format.workspace = true
futures.workspace = true
indoc.workspace = true
openssl.workspace = true
Expand Down
2 changes: 2 additions & 0 deletions rust/operator-binary/src/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use std::{
sync::Arc,
};

use const_format::concatcp;
use product_config::{
self,
types::PropertyNameKind,
Expand Down Expand Up @@ -103,6 +104,7 @@ pub struct Ctx {

pub const OPERATOR_NAME: &str = "trino.stackable.tech";
pub const CONTROLLER_NAME: &str = "trinocluster";
pub const FULL_CONTROLLER_NAME: &str = concatcp!(CONTROLLER_NAME, '.', OPERATOR_NAME);
pub const TRINO_UID: i64 = 1000;

pub const STACKABLE_LOG_DIR: &str = "/stackable/log";
Expand Down
43 changes: 32 additions & 11 deletions rust/operator-binary/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ mod controller;
mod operations;
mod product_logging;

use crate::controller::{CONTROLLER_NAME, OPERATOR_NAME};
use std::sync::Arc;

use clap::{crate_description, crate_version, Parser};
use futures::stream::StreamExt;
Expand All @@ -20,14 +20,19 @@ use stackable_operator::{
},
kube::{
core::DeserializeGuard,
runtime::{reflector::ObjectRef, watcher, Controller},
runtime::{
events::{Recorder, Reporter},
reflector::ObjectRef,
watcher, Controller,
},
ResourceExt,
},
logging::controller::report_controller_reconciled,
CustomResourceExt,
};
use stackable_trino_crd::{catalog::TrinoCatalog, TrinoCluster, APP_NAME};
use std::sync::Arc;

use crate::controller::{FULL_CONTROLLER_NAME, OPERATOR_NAME};

mod built_info {
include!(concat!(env!("OUT_DIR"), "/built.rs"));
Expand Down Expand Up @@ -77,6 +82,13 @@ async fn main() -> anyhow::Result<()> {
&cluster_info_opts,
)
.await?;
let event_recorder = Arc::new(Recorder::new(
client.as_kube_client(),
Reporter {
controller: FULL_CONTROLLER_NAME.to_string(),
instance: None,
},
));

let cluster_controller = Controller::new(
watch_namespace.get_api::<DeserializeGuard<TrinoCluster>>(&client),
Expand Down Expand Up @@ -133,14 +145,23 @@ async fn main() -> anyhow::Result<()> {
product_config,
}),
)
.map(|res| {
report_controller_reconciled(
&client,
&format!("{CONTROLLER_NAME}.{OPERATOR_NAME}"),
&res,
)
})
.collect::<()>()
// We can let the reporting happen in the background
.for_each_concurrent(
16, // concurrency limit
|result| {
// The event_recorder needs to be shared across all invocations, so that
// events are correctly aggregated
let event_recorder = event_recorder.clone();
async move {
report_controller_reconciled(
&event_recorder,
FULL_CONTROLLER_NAME,
&result,
)
.await;
}
},
)
.await;
}
}
Expand Down
Loading