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
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>
  • Loading branch information
jrajahalme authored and joestringer committed May 25, 2022
1 parent b42e5a0 commit 078c052
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 @@ -109,8 +109,7 @@ func (ipc *IPCache) InjectLabels(src source.Source) error {
return ErrLocalIdentityAllocatorUninitialized
}

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

Expand Down

0 comments on commit 078c052

Please sign in to comment.