-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add RemoveMatches in snapshot template #558
Conversation
Issues linked to changelog: |
continue // skip syncing this syncer | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copied over from
if syncDecider, isDecider := syncer.({{ .GoName }}SyncDecider); isDecider { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good! A couple of small thoughts
for { | ||
select { | ||
case snapshot, ok := <-watch: | ||
if !ok { | ||
return | ||
} | ||
|
||
if syncDecider, isDecider := el.syncer.(TestingSyncDecider); isDecider { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When this is running, how should I expect to debug this behavior? Should we have metrics or logs emitted when a sync is not necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the Syncer that implements SyncDecider
can have metrics to track this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that something that we need to implement here, or in Gloo we can define that SyncDecider?
for { | ||
select { | ||
case snapshot, ok := <-watch: | ||
if !ok { | ||
return | ||
} | ||
|
||
if syncDecider, isDecider := el.syncer.({{ .GoName }}SyncDecider); isDecider { | ||
if shouldSync := syncDecider.ShouldSync(previousSnapshot, snapshot); !shouldSync { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
if shouldSync := syncDecider.ShouldSync(previousSnapshot, snapshot); !shouldSync { | |
if !syncDecider.ShouldSync(previousSnapshot, snapshot) { |
continue // skip syncing this syncer | ||
} | ||
} else if syncDeciderWithContext, isDecider := el.syncer.({{ .GoName }}SyncDeciderWithContext); isDecider { | ||
if shouldSync := syncDeciderWithContext.ShouldSync(opts.Ctx, previousSnapshot, snapshot); !shouldSync { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:
if shouldSync := syncDeciderWithContext.ShouldSync(opts.Ctx, previousSnapshot, snapshot); !shouldSync { | |
if !syncDeciderWithContext.ShouldSync(opts.Ctx, previousSnapshot, snapshot) { |
RemoveMatches
method insnapshot_template.go
that removes all resources that match the given crietria.SyncDecider
to determine if a sync is necessary.