Skip to content

Commit

Permalink
pkg/k8s: ignore overwrite source "custom-resource" with "k8s" errors
Browse files Browse the repository at this point in the history
As pointed out in the code changes, it is expected to receive k8s
events after custom-resource events as the propagation delay is often
higher than CRs.

Signed-off-by: André Martins <andre@cilium.io>
  • Loading branch information
aanm committed May 17, 2021
1 parent d5d0727 commit 465cac1
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions pkg/k8s/watchers/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -755,18 +755,22 @@ func (k *K8sWatcher) updatePodHostData(oldPod, newPod *slim_corev1.Pod, oldPodIP
namedPortsChanged = true
}
if err != nil {
// It is expected to receive error overwrites where the existing
// source is the KVStore, this can happen as KVStore event
// propagation can usually be faster than k8s event propagation.
// It is also expected to receive an error overwrite where the
// existing source is local since cilium-agent receives events for
// local pods.
// It is expected to receive an error overwrite where the existing
// source is:
// - KVStore, this can happen as KVStore event propagation can
// usually be faster than k8s event propagation.
// - local since cilium-agent receives events for local pods.
// - custom resource since Cilium CR are slimmer and might have
// faster propagation than Kubernetes resources.
if !errors.Is(err, &ipcache.ErrOverwrite{
ExistingSrc: source.KVStore,
NewSrc: source.Kubernetes,
}) || !errors.Is(err, &ipcache.ErrOverwrite{
ExistingSrc: source.Local,
NewSrc: source.Kubernetes,
}) || !errors.Is(err, &ipcache.ErrOverwrite{
ExistingSrc: source.CustomResource,
NewSrc: source.Kubernetes,
}) {
errs = append(errs, fmt.Sprintf("ipcache entry for podIP %s: %s", podIP, err))
}
Expand Down

0 comments on commit 465cac1

Please sign in to comment.