Skip to content

Commit 31817b1

Browse files
committed
Add watch on ListenerClass to the Listener controller
1 parent a4a8cfa commit 31817b1

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

rust/operator-binary/src/listener_controller.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,22 @@ pub async fn run(client: stackable_operator::client::Client) {
4141
let listener_store = controller.store();
4242
controller
4343
.owns(client.get_all_api::<Service>(), watcher::Config::default())
44+
.watches(
45+
client.get_all_api::<ListenerClass>(),
46+
watcher::Config::default(),
47+
{
48+
let listener_store = listener_store.clone();
49+
move |listenerclass| {
50+
listener_store
51+
.state()
52+
.into_iter()
53+
.filter(move |listener| {
54+
listener.spec.class_name == listenerclass.metadata.name
55+
})
56+
.map(|l| ObjectRef::from_obj(&*l))
57+
}
58+
},
59+
)
4460
.watches(
4561
client.get_all_api::<Endpoints>(),
4662
watcher::Config::default(),

0 commit comments

Comments
 (0)