mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 15:05:27 +00:00
Migrate pkg/kubelet/pod
to structured logging
This commit is contained in:
parent
20b03f6365
commit
504cc5b1e4
@ -119,17 +119,17 @@ func (mc *basicMirrorClient) DeleteMirrorPod(podFullName string, uid *types.UID)
|
||||
}
|
||||
name, namespace, err := kubecontainer.ParsePodFullName(podFullName)
|
||||
if err != nil {
|
||||
klog.Errorf("Failed to parse a pod full name %q", podFullName)
|
||||
klog.ErrorS(err, "Failed to parse a pod full name", "podFullName", podFullName)
|
||||
return false, err
|
||||
}
|
||||
klog.V(2).Infof("Deleting a mirror pod %q (uid %#v)", podFullName, uid)
|
||||
klog.V(2).InfoS("Deleting a mirror pod", "pod", klog.KRef(namespace, name), "podUID", uid)
|
||||
var GracePeriodSeconds int64
|
||||
if err := mc.apiserverClient.CoreV1().Pods(namespace).Delete(context.TODO(), name, metav1.DeleteOptions{GracePeriodSeconds: &GracePeriodSeconds, Preconditions: &metav1.Preconditions{UID: uid}}); err != nil {
|
||||
// Unfortunately, there's no generic error for failing a precondition
|
||||
if !(apierrors.IsNotFound(err) || apierrors.IsConflict(err)) {
|
||||
// We should return the error here, but historically this routine does
|
||||
// not return an error unless it can't parse the pod name
|
||||
klog.Errorf("Failed deleting a mirror pod %q: %v", podFullName, err)
|
||||
klog.ErrorS(err, "Failed deleting a mirror pod", "pod", klog.KRef(namespace, name))
|
||||
}
|
||||
return false, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user