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

Adds ability to elide namespace on trigger_owners #1383

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
11 changes: 8 additions & 3 deletions kube-runtime/src/controller/mod.rs
Original file line number Diff line number Diff line change
@@ -158,6 +158,7 @@ pub fn trigger_owners<KOwner, S>(
stream: S,
owner_type: KOwner::DynamicType,
child_type: <S::Ok as Resource>::DynamicType,
owner_inherits_namespace: bool,
) -> impl Stream<Item = Result<ReconcileRequest<KOwner>, S::Error>>
where
S: TryStream,
@@ -168,7 +169,10 @@ where
{
let mapper = move |obj: S::Ok| {
let meta = obj.meta().clone();
let ns = meta.namespace;
let ns = match owner_inherits_namespace {
true => meta.namespace,
false => None,
};
let owner_type = owner_type.clone();
meta.owner_references
.into_iter()
@@ -762,6 +766,7 @@ where
metadata_watcher(api, wc).touched_objects(),
self.dyntype.clone(),
dyntype,
true,
);
self.trigger_selector.push(child_watcher.boxed());
self
@@ -830,7 +835,7 @@ where
where
Child::DynamicType: Debug + Eq + Hash + Clone,
{
let child_watcher = trigger_owners(trigger, self.dyntype.clone(), dyntype);
let child_watcher = trigger_owners(trigger, self.dyntype.clone(), dyntype, true);
self.trigger_selector.push(child_watcher.boxed());
self
}
@@ -1155,7 +1160,7 @@ where
/// use kube::{Api, Client, ResourceExt};
/// use kube_runtime::{
/// controller::{Controller, Action},
/// watcher,
/// watcher,
/// };
/// use std::{convert::Infallible, sync::Arc};
/// Controller::new(