Skip to content

Commit

Permalink
Do not update cache if already found
Browse files Browse the repository at this point in the history
  • Loading branch information
BEvgeniyS committed Sep 16, 2024
1 parent 238ab2e commit c818941
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/controllers/nodeclaim/lifecycle/registration.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ func (r *Registration) syncNode(ctx context.Context, nodeClaim *v1.NodeClaim, no
nodeClaim.Labels[v1.NodePoolLabelKey],
nodeClaim.Labels[corev1.LabelInstanceTypeStable],
)
cacheValue, found := r.cache.Get(cacheMapKey)
if !found || !equality.Semantic.DeepEqual(cacheValue.(corev1.ResourceList), nodeClaim.Status.Allocatable) {
_, found := r.cache.Get(cacheMapKey)
if !found {
log.FromContext(ctx).WithValues("NodePool", nodeClaim.Labels[v1.NodePoolLabelKey]).Info(fmt.Sprintf("Updating allocatable cache for %s", nodeClaim.Labels[corev1.LabelInstanceTypeStable]))
r.cache.Set(cacheMapKey, stored.Status.Allocatable, cache.DefaultExpiration)
}
Expand Down

0 comments on commit c818941

Please sign in to comment.