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

fix(kuma-cp) Apply ratelimit to service insights #2815

Merged
merged 1 commit into from
Sep 22, 2021
Merged
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
8 changes: 4 additions & 4 deletions pkg/insights/resyncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,9 @@ func (r *resyncer) Start(stop <-chan struct{}) error {
if resourceChanged.Type == core_mesh.MeshType && resourceChanged.Operation == events.Delete {
r.deleteRateLimiter(resourceChanged.Key.Name)
}
if !r.getRateLimiter(resourceChanged.Key.Mesh).Allow() {
continue
}
if resourceChanged.Type == core_mesh.DataplaneType || resourceChanged.Type == core_mesh.DataplaneInsightType {
if err := r.createOrUpdateServiceInsight(resourceChanged.Key.Mesh); err != nil {
log.Error(err, "unable to resync ServiceInsight", "mesh", resourceChanged.Key.Mesh)
Expand All @@ -127,13 +130,10 @@ func (r *resyncer) Start(stop <-chan struct{}) error {
continue
}
if resourceChanged.Operation == events.Update && resourceChanged.Type != core_mesh.DataplaneInsightType {
// 'Update' events doesn't affect MeshInsight expect for DataplaneInsight,
// 'Update' events doesn't affect MeshInsight except for DataplaneInsight,
// because that's how we find online/offline Dataplane's status
continue
}
if !r.getRateLimiter(resourceChanged.Key.Mesh).Allow() {
continue
}
if err := r.createOrUpdateMeshInsight(resourceChanged.Key.Mesh); err != nil {
log.Error(err, "unable to resync MeshInsight", "mesh", resourceChanged.Key.Mesh)
continue
Expand Down