Skip to content

Commit

Permalink
ipcache: Error out from InjectLabels if Checker is nil
Browse files Browse the repository at this point in the history
[ upstream commit 078c052 ]

K8s cache is not fully synced also when k8sSyncedChecker is still nil.

Found during code inspection, not sure if this can manifest as a bug on
runtime.

Fixes: #17823
Signed-off-by: Jarno Rajahalme <jarno@isovalent.com>
Signed-off-by: Gilberto Bertin <jibi@cilium.io>
  • Loading branch information
jrajahalme authored and jibi committed May 31, 2022
1 parent 52b08b4 commit bfd780b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions pkg/ipcache/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ func InjectLabels(src source.Source, updater identityUpdater, triggerer policyTr
return ErrLocalIdentityAllocatorUninitialized
}

if IPIdentityCache.k8sSyncedChecker != nil &&
!IPIdentityCache.k8sSyncedChecker.K8sCacheIsSynced() {
if IPIdentityCache.k8sSyncedChecker == nil || !IPIdentityCache.k8sSyncedChecker.K8sCacheIsSynced() {
return errors.New("k8s cache not fully synced")
}

Expand Down

0 comments on commit bfd780b

Please sign in to comment.