Skip to content

Commit f48a3ea

Browse files
committed
chore: Use delayed controller
1 parent c131212 commit f48a3ea

2 files changed

Lines changed: 18 additions & 4 deletions

File tree

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,11 @@ rules:
103103
{{- if .Values.maintenance.customResourceDefinitions.maintain }}
104104
- create
105105
- patch
106-
{{- end }}
107106
- get
107+
# Required for startup condition
108+
- list
109+
- watch
110+
{{- end }}
108111
- apiGroups:
109112
- authentication.stackable.tech
110113
resources:

rust/operator-binary/src/main.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use stackable_operator::{
1919
core::v1::{ConfigMap, Service},
2020
},
2121
kube::{
22-
Resource,
22+
CustomResourceExt as _, Resource,
2323
core::DeserializeGuard,
2424
runtime::{
2525
Controller,
@@ -31,7 +31,7 @@ use stackable_operator::{
3131
logging::controller::report_controller_reconciled,
3232
shared::yaml::SerializeOptions,
3333
telemetry::Tracing,
34-
utils::signal::SignalWatcher,
34+
utils::signal::{self, SignalWatcher},
3535
};
3636

3737
use crate::{
@@ -245,8 +245,19 @@ async fn main() -> anyhow::Result<()> {
245245
)
246246
.map(anyhow::Ok);
247247

248+
let delayed_zk_controller = async {
249+
signal::crd_established(&client, v1alpha1::ZookeeperCluster::crd_name(), None)
250+
.await?;
251+
zk_controller.await
252+
};
253+
248254
// kube-runtime's Controller will tokio::spawn each reconciliation, so this only concerns the internal watch machinery
249-
futures::try_join!(zk_controller, znode_controller, eos_checker, webhook_server)?;
255+
futures::try_join!(
256+
delayed_zk_controller,
257+
znode_controller,
258+
eos_checker,
259+
webhook_server
260+
)?;
250261
}
251262
}
252263

0 commit comments

Comments
 (0)