mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
Merge pull request #67369 from tianshapjq/should-not-eventf-directly
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. should not event directly **What this PR does / why we need it**: should not event directly, using recordContainerEvent() to generate ref and deduplicate events instead. **Which issue(s) this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close the issue(s) when PR gets merged)*: Fixes # **Special notes for your reviewer**: **Release note**: ```release-note none ```
This commit is contained in:
commit
cd06419973
@ -52,6 +52,7 @@ import (
|
|||||||
var (
|
var (
|
||||||
ErrCreateContainerConfig = errors.New("CreateContainerConfigError")
|
ErrCreateContainerConfig = errors.New("CreateContainerConfigError")
|
||||||
ErrCreateContainer = errors.New("CreateContainerError")
|
ErrCreateContainer = errors.New("CreateContainerError")
|
||||||
|
ErrPreStartHook = errors.New("PreStartHookError")
|
||||||
ErrPostStartHook = errors.New("PostStartHookError")
|
ErrPostStartHook = errors.New("PostStartHookError")
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -123,8 +124,8 @@ func (m *kubeGenericRuntimeManager) startContainer(podSandboxID string, podSandb
|
|||||||
}
|
}
|
||||||
err = m.internalLifecycle.PreStartContainer(pod, container, containerID)
|
err = m.internalLifecycle.PreStartContainer(pod, container, containerID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
m.recorder.Eventf(ref, v1.EventTypeWarning, events.FailedToStartContainer, "Internal PreStartContainer hook failed: %v", err)
|
m.recordContainerEvent(pod, container, containerID, v1.EventTypeWarning, events.FailedToStartContainer, "Internal PreStartContainer hook failed: %v", grpc.ErrorDesc(err))
|
||||||
return "Internal PreStartContainer hook failed", err
|
return grpc.ErrorDesc(err), ErrPreStartHook
|
||||||
}
|
}
|
||||||
m.recordContainerEvent(pod, container, containerID, v1.EventTypeNormal, events.CreatedContainer, "Created container")
|
m.recordContainerEvent(pod, container, containerID, v1.EventTypeNormal, events.CreatedContainer, "Created container")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user