Skip to content

Commit 807d9ca

Browse files
committed
chore: Use delayed controller
1 parent d22e420 commit 807d9ca

5 files changed

Lines changed: 34 additions & 22 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ All notable changes to this project will be documented in this file.
2424
### Fixed
2525

2626
- Prevent unnecessary warning messages in the OPA logs caused by setting a service for the Prometheus status ([#799]).
27+
- Fix "404 page not found" error for the initial object list ([#812]).
2728

2829
### Removed
2930

Cargo.nix

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

crate-hashes.json

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

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ rules:
8383
{{- if .Values.maintenance.customResourceDefinitions.maintain }}
8484
- create
8585
- patch
86+
# Required for startup condition
87+
- list
88+
- watch
8689
{{- end }}
8790
- apiGroups:
8891
- events.k8s.io

rust/operator-binary/src/main.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use stackable_operator::{
1717
core::v1::{ConfigMap, Service},
1818
},
1919
kube::{
20-
Api,
20+
Api, CustomResourceExt as _,
2121
core::DeserializeGuard,
2222
runtime::{
2323
Controller,
@@ -29,7 +29,10 @@ use stackable_operator::{
2929
namespace::WatchNamespace,
3030
shared::yaml::SerializeOptions,
3131
telemetry::Tracing,
32-
utils::{cluster_info::KubernetesClusterInfo, signal::SignalWatcher},
32+
utils::{
33+
cluster_info::KubernetesClusterInfo,
34+
signal::{self, SignalWatcher},
35+
},
3336
};
3437

3538
use crate::{
@@ -142,7 +145,7 @@ async fn main() -> anyhow::Result<()> {
142145
.map_err(|err| anyhow!(err).context("failed to run webhook server"));
143146

144147
let controller = create_controller(
145-
client,
148+
client.clone(),
146149
product_config,
147150
watch_namespace,
148151
operator_image.clone(),
@@ -152,7 +155,12 @@ async fn main() -> anyhow::Result<()> {
152155
)
153156
.map(anyhow::Ok);
154157

155-
futures::try_join!(controller, webhook_server, eos_checker)?;
158+
let delayed_controller = async {
159+
signal::crd_established(&client, v1alpha2::OpaCluster::crd_name(), None).await?;
160+
controller.await
161+
};
162+
163+
futures::try_join!(delayed_controller, webhook_server, eos_checker)?;
156164
}
157165
};
158166

0 commit comments

Comments
 (0)