Skip to content

Commit 7a9b76d

Browse files
committed
Adds ability to elide namespace on trigger_owners
Signed-off-by: Jess Bodzo <[email protected]>
1 parent 00fffed commit 7a9b76d

File tree

1 file changed

+8
-3
lines changed
  • kube-runtime/src/controller

1 file changed

+8
-3
lines changed

kube-runtime/src/controller/mod.rs

+8-3
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ pub fn trigger_owners<KOwner, S>(
158158
stream: S,
159159
owner_type: KOwner::DynamicType,
160160
child_type: <S::Ok as Resource>::DynamicType,
161+
namespaced_owners: bool,
161162
) -> impl Stream<Item = Result<ReconcileRequest<KOwner>, S::Error>>
162163
where
163164
S: TryStream,
@@ -168,7 +169,10 @@ where
168169
{
169170
let mapper = move |obj: S::Ok| {
170171
let meta = obj.meta().clone();
171-
let ns = meta.namespace;
172+
let ns = match namespaced_owners {
173+
true => meta.namespace,
174+
false => None,
175+
};
172176
let owner_type = owner_type.clone();
173177
meta.owner_references
174178
.into_iter()
@@ -762,6 +766,7 @@ where
762766
metadata_watcher(api, wc).touched_objects(),
763767
self.dyntype.clone(),
764768
dyntype,
769+
false,
765770
);
766771
self.trigger_selector.push(child_watcher.boxed());
767772
self
@@ -830,7 +835,7 @@ where
830835
where
831836
Child::DynamicType: Debug + Eq + Hash + Clone,
832837
{
833-
let child_watcher = trigger_owners(trigger, self.dyntype.clone(), dyntype);
838+
let child_watcher = trigger_owners(trigger, self.dyntype.clone(), dyntype, false);
834839
self.trigger_selector.push(child_watcher.boxed());
835840
self
836841
}
@@ -1155,7 +1160,7 @@ where
11551160
/// use kube::{Api, Client, ResourceExt};
11561161
/// use kube_runtime::{
11571162
/// controller::{Controller, Action},
1158-
/// watcher,
1163+
/// watcher,
11591164
/// };
11601165
/// use std::{convert::Infallible, sync::Arc};
11611166
/// Controller::new(

0 commit comments

Comments
 (0)