Skip to content

Commit

Permalink
fix(kuma-cp) apply ratelimit to service insights (#2815) (#2822)
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Parkanzky <paul.parkanzky@konghq.com>
(cherry picked from commit 4cf589d)

Co-authored-by: parkanzky <42279121+parkanzky@users.noreply.github.com>
  • Loading branch information
mergify[bot] and parkanzky authored Sep 24, 2021
1 parent 363b3d0 commit 3cb85d7
Showing 1 changed file with 4 additions and 4 deletions.
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

0 comments on commit 3cb85d7

Please sign in to comment.