Skip to content

Commit

Permalink
Merge pull request #2126 from facchettos/fix-generic-sync
Browse files Browse the repository at this point in the history
[fix] : now prevents the generic syncer from continuously deleting objs
  • Loading branch information
FabianKramm committed Sep 9, 2024
2 parents b379167 + 5aca65c commit 1740eeb
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions pkg/controllers/generic/export_syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,3 +307,18 @@ func (f *exporter) TranslateMetadata(ctx *synccontext.SyncContext, vObj client.O
func (f *exporter) objectMatches(obj client.Object) bool {
return f.selector == nil || f.selector.Matches(labels.Set(obj.GetLabels()))
}

var _ syncertypes.ObjectExcluder = &exporter{}

func (f *exporter) ExcludeVirtual(vObj client.Object) bool {
return f.excludeObject(vObj)
}

func (f *exporter) ExcludePhysical(_ client.Object) bool {
return false
}

func (f *exporter) excludeObject(obj client.Object) bool {
matches := f.selector.Matches(labels.Set(obj.GetLabels()))
return !matches
}

0 comments on commit 1740eeb

Please sign in to comment.