Skip to content

Commit

Permalink
Merge branch 'main' into synced
Browse files Browse the repository at this point in the history
  • Loading branch information
zreigz authored Sep 11, 2024
2 parents e0ed6e1 + 2d26047 commit 5a2de82
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions pkg/controller/service/reconciler_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,24 @@ func (s *ServiceReconciler) UpdateApplyStatus(
statusCollector.updateApplyStatus(e.ApplyEvent.Identifier, e.ApplyEvent)
gk := e.ApplyEvent.Identifier.GroupKind
name := e.ApplyEvent.Identifier.Name
namespace := e.ApplyEvent.Identifier.Namespace
if e.ApplyEvent.Status == event.ApplySuccessful {
cache.SaveResourceSHA(e.ApplyEvent.Resource, cache.ApplySHA)
}

if e.ApplyEvent.Error != nil {
// e.ApplyEvent.Resource == nil, create the key to get cache entry
key := cache.ResourceKey{
Namespace: namespace,
Name: name,
GroupKind: gk,
}
sha, exists := cache.GetResourceCache().GetCacheEntry(key.ObjectIdentifier())
if exists {
// clear SHA when error occurs
sha.Expire()
cache.GetResourceCache().SetCacheEntry(key.ObjectIdentifier(), sha)
}
if e.ApplyEvent.Status == event.ApplyFailed {
err = fmt.Errorf("%s apply %s: %s\n", resourceIDToString(gk, name),
strings.ToLower(e.ApplyEvent.Status.String()), e.ApplyEvent.Error.Error())
Expand Down

0 comments on commit 5a2de82

Please sign in to comment.