in internal/controllers/watch/kind.go [127:158]
func (k *KindWatchController) buildRequests(synth *apiv1.Synthesizer, comps ...apiv1.Composition) []reconcile.Request {
keys := map[string]struct{}{}
reqs := []reconcile.Request{}
for _, ref := range synth.Spec.Refs {
if ref.Resource.Name == "" {
keys[ref.Key] = struct{}{}
continue // ref does not have an "implicit" binding
}
nsn := types.NamespacedName{Namespace: ref.Resource.Namespace, Name: ref.Resource.Name}
req := reconcile.Request{NamespacedName: nsn}
if !slices.Contains(reqs, req) {
reqs = append(reqs, req)
}
}
for _, comp := range comps {
for _, binding := range comp.Spec.Bindings {
if _, found := keys[binding.Key]; !found {
continue
}
nsn := types.NamespacedName{Namespace: binding.Resource.Namespace, Name: binding.Resource.Name}
req := reconcile.Request{NamespacedName: nsn}
if !slices.Contains(reqs, req) {
reqs = append(reqs, req)
}
}
}
return reqs
}