mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 15:25:57 +00:00
Merge pull request #48589 from yiqinguo/yiqinguo_add_event
Automatic merge from submit-queue When faild create pod sandbox record event. I created pods because of the failure to create a sandbox, but there was no clear message telling me what was the failure, so I wanted to record an event when the sandbox was created. **Release note**: ```release-note NONE ```
This commit is contained in:
commit
b8fde17fc2
@ -63,6 +63,7 @@ const (
|
|||||||
SuccessfulNodeAllocatableEnforcement = "NodeAllocatableEnforced"
|
SuccessfulNodeAllocatableEnforcement = "NodeAllocatableEnforced"
|
||||||
UnsupportedMountOption = "UnsupportedMountOption"
|
UnsupportedMountOption = "UnsupportedMountOption"
|
||||||
SandboxChanged = "SandboxChanged"
|
SandboxChanged = "SandboxChanged"
|
||||||
|
FailedCreatePodSandBox = "FailedCreatePodSandBox"
|
||||||
|
|
||||||
// Image manager event reason list
|
// Image manager event reason list
|
||||||
InvalidDiskCapacity = "InvalidDiskCapacity"
|
InvalidDiskCapacity = "InvalidDiskCapacity"
|
||||||
|
@ -607,6 +607,11 @@ func (m *kubeGenericRuntimeManager) SyncPod(pod *v1.Pod, _ v1.PodStatus, podStat
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
createSandboxResult.Fail(kubecontainer.ErrCreatePodSandbox, msg)
|
createSandboxResult.Fail(kubecontainer.ErrCreatePodSandbox, msg)
|
||||||
glog.Errorf("createPodSandbox for pod %q failed: %v", format.Pod(pod), err)
|
glog.Errorf("createPodSandbox for pod %q failed: %v", format.Pod(pod), err)
|
||||||
|
ref, err := ref.GetReference(api.Scheme, pod)
|
||||||
|
if err != nil {
|
||||||
|
glog.Errorf("Couldn't make a ref to pod %q: '%v'", format.Pod(pod), err)
|
||||||
|
}
|
||||||
|
m.recorder.Eventf(ref, v1.EventTypeWarning, events.FailedCreatePodSandBox, "Failed create pod sandbox.")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
glog.V(4).Infof("Created PodSandbox %q for pod %q", podSandboxID, format.Pod(pod))
|
glog.V(4).Infof("Created PodSandbox %q for pod %q", podSandboxID, format.Pod(pod))
|
||||||
|
Loading…
Reference in New Issue
Block a user