Merge pull request #74156 from gaorong/descirbe-mirror-pod

kubectl: fix a bug where "describe" cannot obtain the event messages for a static pod
pull/564/head
Kubernetes Prow Robot 2019-02-20 03:32:48 -08:00 committed by GitHub
commit f99728e6f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -642,6 +642,9 @@ func (d *PodDescriber) Describe(namespace, name string, describerSettings descri
klog.Errorf("Unable to construct reference to '%#v': %v", pod, err) klog.Errorf("Unable to construct reference to '%#v': %v", pod, err)
} else { } else {
ref.Kind = "" ref.Kind = ""
if _, isMirrorPod := pod.Annotations[corev1.MirrorPodAnnotationKey]; isMirrorPod {
ref.UID = types.UID(pod.Annotations[corev1.MirrorPodAnnotationKey])
}
events, _ = d.Core().Events(namespace).Search(scheme.Scheme, ref) events, _ = d.Core().Events(namespace).Search(scheme.Scheme, ref)
} }
} }