Skip to content
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

Fixed wait_until_crd_present bug #92

Merged
merged 4 commits into from
Oct 27, 2021
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
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,16 @@ 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]).
- `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]).

[#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
Expand Down
30 changes: 8 additions & 22 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions rust/crd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand Down
4 changes: 2 additions & 2 deletions rust/operator-binary/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }

Expand All @@ -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]
Expand Down
13 changes: 13 additions & 0 deletions rust/operator-binary/src/stackable-nifi-operator.rs
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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
}
4 changes: 2 additions & 2 deletions rust/operator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
14 changes: 1 addition & 13 deletions rust/operator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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<NifiCluster> = client.get_all_api();
let pods_api: Api<Pod> = client.get_all_api();
let configmaps_api: Api<ConfigMap> = client.get_all_api();
Expand Down