Suppress uid mismatch error/warning in case of static pod

In static pod case, kube api returns mirror pod UID hence
uid must be mismatched. This fix suppress error/warning message
in such case.

Fix #773
This commit is contained in:
Tomofumi Hayashi
2022-01-13 16:41:14 +09:00
parent 12df5bda72
commit 2e474f4c95
2 changed files with 16 additions and 2 deletions

View File

@@ -551,7 +551,8 @@ func getPod(kubeClient *k8s.ClientInfo, k8sArgs *types.K8sArgs, warnOnly bool) (
}
}
if podUID != "" && string(pod.UID) != podUID {
// In case of static pod, UID through kube api is different because of mirror pod, hence it is expected.
if podUID != "" && string(pod.UID) != podUID && !k8s.IsStaticPod(pod) {
msg := fmt.Sprintf("expected pod UID %q but got %q from Kube API", podUID, pod.UID)
if warnOnly {
// On CNI DEL we just operate on the cache when these mismatch, we don't error out.