From ec98306c80307a4bc6245cd007a7f95928bb058b Mon Sep 17 00:00:00 2001 From: maltesander Date: Wed, 27 Oct 2021 14:02:14 +0200 Subject: [PATCH 1/4] Fixed wait_until_crd_present bug Switched to operator-rs tag 0.3.0 Switched to zookeeper-crd tag 0.4.1 --- Cargo.lock | 30 +++++-------------- rust/crd/Cargo.toml | 4 +-- rust/operator-binary/Cargo.toml | 4 +-- .../src/stackable-nifi-operator.rs | 13 ++++++++ rust/operator/Cargo.toml | 4 +-- rust/operator/src/lib.rs | 14 +-------- 6 files changed, 28 insertions(+), 41 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 251a5de0..50fe4c18 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -951,9 +951,9 @@ dependencies = [ [[package]] name = "matchers" -version = "0.0.1" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f099785f7595cc4b4553a174ce30dd7589ef93391ff414dbb67f62392b9e0ce1" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" dependencies = [ "regex-automata", ] @@ -1709,8 +1709,8 @@ dependencies = [ [[package]] name = "stackable-operator" -version = "0.2.3-nightly" -source = "git+https://github.com/stackabletech/operator-rs.git?branch=main#a0c9a4390ff6a288fb887ecef02d2af8eb79e615" +version = "0.3.0" +source = "git+https://github.com/stackabletech/operator-rs.git?tag=0.3.0#a0a1d10260f7921d436a0cd7ba6ce957368e42fb" dependencies = [ "async-trait", "backoff", @@ -1742,8 +1742,8 @@ dependencies = [ [[package]] name = "stackable-zookeeper-crd" -version = "0.4.1-nightly" -source = "git+https://github.com/stackabletech/zookeeper-operator.git?branch=main#23a5fd21fe4c267c4f69796620e43c1ab1944428" +version = "0.4.1" +source = "git+https://github.com/stackabletech/zookeeper-operator.git?tag=0.4.1#a95a0cb793d07ea9a7a8fcfc6cf4c4ea16452284" dependencies = [ "duplicate", "semver", @@ -2079,36 +2079,22 @@ dependencies = [ "tracing-core", ] -[[package]] -name = "tracing-serde" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb65ea441fbb84f9f6748fd496cf7f63ec9af5bca94dd86456978d055e8eb28b" -dependencies = [ - "serde", - "tracing-core", -] - [[package]] name = "tracing-subscriber" -version = "0.2.25" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e0d2eaa99c3c2e41547cfa109e910a68ea03823cccad4a0525dcbc9b01e8c71" +checksum = "80a4ddde70311d8da398062ecf6fc2c309337de6b0f77d6c27aff8d53f6fca52" dependencies = [ "ansi_term 0.12.1", - "chrono", "lazy_static", "matchers", "regex", - "serde", - "serde_json", "sharded-slab", "smallvec", "thread_local", "tracing", "tracing-core", "tracing-log", - "tracing-serde", ] [[package]] diff --git a/rust/crd/Cargo.toml b/rust/crd/Cargo.toml index 169d32c6..c811d32c 100644 --- a/rust/crd/Cargo.toml +++ b/rust/crd/Cargo.toml @@ -8,8 +8,8 @@ repository = "https://github.com/stackabletech/nifi-operator" version = "0.3.0-nightly" [dependencies] -stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", branch = "main" } -stackable-zookeeper-crd = { git = "https://github.com/stackabletech/zookeeper-operator.git", branch = "main" } +stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "0.3.0" } +stackable-zookeeper-crd = { git = "https://github.com/stackabletech/zookeeper-operator.git", tag = "0.4.1" } semver = "1.0" serde = { version = "1.0", features = ["derive"] } diff --git a/rust/operator-binary/Cargo.toml b/rust/operator-binary/Cargo.toml index 7a09637c..0088f16f 100644 --- a/rust/operator-binary/Cargo.toml +++ b/rust/operator-binary/Cargo.toml @@ -9,7 +9,7 @@ repository = "https://github.com/stackabletech/nifi-operator" version = "0.3.0-nightly" [dependencies] -stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", branch = "main" } +stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "0.3.0" } stackable-nifi-crd = { path = "../crd" } stackable-nifi-operator = { path = "../operator" } @@ -20,7 +20,7 @@ tracing = "0.1" [build-dependencies] built = { version = "0.5", features = ["chrono", "git2"] } -stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", branch = "main" } +stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "0.3.0" } stackable-nifi-crd = { path = "../crd" } [package.metadata.deb] diff --git a/rust/operator-binary/src/stackable-nifi-operator.rs b/rust/operator-binary/src/stackable-nifi-operator.rs index f531a357..539057ef 100644 --- a/rust/operator-binary/src/stackable-nifi-operator.rs +++ b/rust/operator-binary/src/stackable-nifi-operator.rs @@ -1,6 +1,8 @@ use clap::{crate_version, App, AppSettings, SubCommand}; use stackable_nifi_crd::NifiCluster; +use stackable_operator::kube::CustomResourceExt; use stackable_operator::{cli, client, error}; +use tracing::error; mod built_info { // The file has been placed there by the build script. @@ -47,5 +49,16 @@ async fn main() -> Result<(), error::Error> { let client = client::create_client(Some("nifi.stackable.tech".to_string())).await?; + if let Err(error) = stackable_operator::crd::wait_until_crds_present( + &client, + vec![NifiCluster::crd_name()], + None, + ) + .await + { + error!("Required CRDs missing, aborting: {:?}", error); + return Err(error); + }; + stackable_nifi_operator::create_controller(client, &product_config_path).await } diff --git a/rust/operator/Cargo.toml b/rust/operator/Cargo.toml index b4b269b5..da35de41 100644 --- a/rust/operator/Cargo.toml +++ b/rust/operator/Cargo.toml @@ -9,8 +9,8 @@ version = "0.3.0-nightly" [dependencies] stackable-nifi-crd = { path = "../crd" } -stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", branch = "main" } -stackable-zookeeper-crd = { git = "https://github.com/stackabletech/zookeeper-operator.git", branch = "main" } +stackable-operator = { git = "https://github.com/stackabletech/operator-rs.git", tag = "0.3.0" } +stackable-zookeeper-crd = { git = "https://github.com/stackabletech/zookeeper-operator.git", tag = "0.4.1" } async-trait = "0.1" futures = "0.3" diff --git a/rust/operator/src/lib.rs b/rust/operator/src/lib.rs index dc28b841..9dff1ffa 100644 --- a/rust/operator/src/lib.rs +++ b/rust/operator/src/lib.rs @@ -28,7 +28,6 @@ use stackable_operator::identity::{ use stackable_operator::k8s_openapi::api::core::v1::{ConfigMap, EnvVar, Pod}; use stackable_operator::kube::api::ListParams; use stackable_operator::kube::Api; -use stackable_operator::kube::CustomResourceExt; use stackable_operator::kube::ResourceExt; use stackable_operator::labels::{ build_common_labels_for_all_managed_resources, get_recommended_labels, APP_COMPONENT_LABEL, @@ -57,7 +56,7 @@ use std::pin::Pin; use std::sync::Arc; use std::time::Duration; use strum::IntoEnumIterator; -use tracing::{debug, error, info, trace, warn}; +use tracing::{debug, info, trace, warn}; const FINALIZER_NAME: &str = "nifi.stackable.tech/cleanup"; const SHOULD_BE_SCRAPED: &str = "monitoring.stackable.tech/should_be_scraped"; @@ -818,17 +817,6 @@ impl ControllerStrategy for NifiStrategy { /// /// This is an async method and the returned future needs to be consumed to make progress. pub async fn create_controller(client: Client, product_config_path: &str) -> OperatorResult<()> { - if let Err(error) = stackable_operator::crd::wait_until_crds_present( - &client, - vec![NifiCluster::crd_name()], - None, - ) - .await - { - error!("Required CRDs missing, aborting: {:?}", error); - return Err(error); - }; - let nifi_api: Api = client.get_all_api(); let pods_api: Api = client.get_all_api(); let configmaps_api: Api = client.get_all_api(); From e00271fc5457b43d78c363430b378a4c7ebfe289 Mon Sep 17 00:00:00 2001 From: maltesander Date: Wed, 27 Oct 2021 14:04:12 +0200 Subject: [PATCH 2/4] Adapted CHANGELOG.md --- CHANGELOG.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f4cb754..9d91ff74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,11 +12,17 @@ All notable changes to this project will be documented in this file. ### Changed +- Switched to operator-rs tag 0.3.0 ([#92]). +- Switched to zookeeper-crd tag 0.4.1 ([#92]). - `kube-rs`: `0.58` → `0.60` ([#83]). - `k8s-openapi` `0.12` → `0.13` and features: `v1_21` → `v1_22` ([#83]). - `operator-rs` `0.2.1` → `0.2.2` ([#83]). -- `stackable-zookeeper-crd`: `0.3.0` → `0.4.0` ([#83]). +- `stackable-zookeeper-crd`: `0.3.0` → `0.4.0` ([#83]). + +### Fixed +- Fixed a bug where `wait_until_crds_present` only reacted to the main CRD, not the commands ([#92]). +[#92]: https://github.com/stackabletech/nifi-operator/pull/92 [#83]: https://github.com/stackabletech/nifi-operator/pull/83 [#81]: https://github.com/stackabletech/nifi-operator/pull/81 [#87]: https://github.com/stackabletech/nifi-operator/pull/87 From dce29dbbf5c6266b407a676aa7509f25ddff97f0 Mon Sep 17 00:00:00 2001 From: maltesander Date: Wed, 27 Oct 2021 14:05:19 +0200 Subject: [PATCH 3/4] Adapted CHANGELOG.md --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d91ff74..a301fc60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,8 +12,8 @@ All notable changes to this project will be documented in this file. ### Changed -- Switched to operator-rs tag 0.3.0 ([#92]). -- Switched to zookeeper-crd tag 0.4.1 ([#92]). +- `operator-rs`: `0.3.0` ([#92]). +- `stackable-zookeeper-crd`: `0.4.1` ([#92]). - `kube-rs`: `0.58` → `0.60` ([#83]). - `k8s-openapi` `0.12` → `0.13` and features: `v1_21` → `v1_22` ([#83]). - `operator-rs` `0.2.1` → `0.2.2` ([#83]). From 7719e711ee6e143beaf8bee2dc99bd2563fc348d Mon Sep 17 00:00:00 2001 From: maltesander Date: Wed, 27 Oct 2021 14:20:46 +0200 Subject: [PATCH 4/4] Adapted to PR review --- CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a301fc60..1ded548c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,12 +12,11 @@ All notable changes to this project will be documented in this file. ### Changed +- `stackable-zookeeper-crd`: `0.3.0` → `0.4.1` ([#92]). - `operator-rs`: `0.3.0` ([#92]). -- `stackable-zookeeper-crd`: `0.4.1` ([#92]). - `kube-rs`: `0.58` → `0.60` ([#83]). - `k8s-openapi` `0.12` → `0.13` and features: `v1_21` → `v1_22` ([#83]). - `operator-rs` `0.2.1` → `0.2.2` ([#83]). -- `stackable-zookeeper-crd`: `0.3.0` → `0.4.0` ([#83]). ### Fixed - Fixed a bug where `wait_until_crds_present` only reacted to the main CRD, not the commands ([#92]).