Skip to content

Commit

Permalink
pkg/k8s: do not perform an early return on ipcache errors
Browse files Browse the repository at this point in the history
Although ipcache might return an error, we should not perform an early
return in the event handling of the pod event because some other
components that are unrelated to ipcache might depend on this specific
event per perform correctly. Instead we will log the ipcache error and
let the execution of the method to continue.

The pod might, for example, be in a "Pending" state which has its
status IP addresses not set but might be able to change labels in the
meanwhile which Cilium should react upon those changes which are not
related with ipcache.

Signed-off-by: André Martins <andre@cilium.io>
  • Loading branch information
aanm committed Oct 30, 2023
1 parent b713e15 commit 3b0faf1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/k8s/watchers/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,6 @@ func (k *K8sWatcher) updateK8sPodV1(oldK8sPod, newK8sPod *slim_corev1.Pod) error

if err != nil {
logger.WithError(err).Warning("Unable to update ipcache map entry on pod update")
return err
}

// Check annotation updates.
Expand Down Expand Up @@ -386,6 +385,12 @@ func (k *K8sWatcher) updateK8sPodV1(oldK8sPod, newK8sPod *slim_corev1.Pod) error

// Nothing changed.
if !annotationsChanged && !labelsChanged {
log.WithFields(logrus.Fields{
"old-labels": oldK8sPod.GetObjectMeta().GetLabels(),
"old-annotations": oldK8sPod.GetObjectMeta().GetAnnotations(),
"new-labels": newK8sPod.GetObjectMeta().GetLabels(),
"new-annotations": newK8sPod.GetObjectMeta().GetAnnotations(),
}).Debugf("Pod does not have any annotations nor labels changed")
return err
}

Expand Down

0 comments on commit 3b0faf1

Please sign in to comment.