Skip to content

Commit

Permalink
k8s/watchers: warn when endpoint label update fails on pod update
Browse files Browse the repository at this point in the history
Currently, failure to update endpoint labels based on pod labels on pod
update is silently ignored by the callers or only reflected in error
count metrics. Report a warning to clearly indicate that pod and
endpoint labels might be out of sync.

Signed-off-by: Tobias Klauser <tobias@cilium.io>
  • Loading branch information
tklauser committed Mar 15, 2024
1 parent bba0ff5 commit 9a26446
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pkg/k8s/watchers/pod.go
Expand Up @@ -403,6 +403,12 @@ func (k *K8sWatcher) updateK8sPodV1(oldK8sPod, newK8sPod *slim_corev1.Pod) error
if labelsChanged {
err := podEP.UpdateLabelsFrom(oldPodLabels, newPodLabels, labels.LabelSourceK8s)
if err != nil {
log.WithFields(logrus.Fields{
logfields.K8sPodName: newK8sPod.ObjectMeta.Name,
logfields.K8sNamespace: newK8sPod.ObjectMeta.Namespace,
logfields.EndpointID: podEP.GetID(),
logfields.Labels: newPodLabels,
}).WithError(err).Warning("Unable to update endpoint labels on pod update")
return err
}

Expand Down

0 comments on commit 9a26446

Please sign in to comment.