Merge pull request #118578 from bart0sh/PR117-DRA-log-manager-errors

DRA: report NodePrepareResource errors
This commit is contained in:
Kubernetes Prow Robot 2023-07-17 13:47:13 -07:00 committed by GitHub
commit 42141aaf93
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -74,6 +74,7 @@ const (
FailedCreatePodSandBox = "FailedCreatePodSandBox"
FailedStatusPodSandBox = "FailedPodSandBoxStatus"
FailedMountOnFilesystemMismatch = "FailedMountOnFilesystemMismatch"
FailedPrepareDynamicResources = "FailedPrepareDynamicResources"
)
// Image manager event reason list

View File

@ -1089,7 +1089,14 @@ func (m *kubeGenericRuntimeManager) SyncPod(ctx context.Context, pod *v1.Pod, po
// Prepare resources allocated by the Dynammic Resource Allocation feature for the pod
if utilfeature.DefaultFeatureGate.Enabled(features.DynamicResourceAllocation) {
if m.runtimeHelper.PrepareDynamicResources(pod) != nil {
if err := m.runtimeHelper.PrepareDynamicResources(pod); err != nil {
ref, referr := ref.GetReference(legacyscheme.Scheme, pod)
if referr != nil {
klog.ErrorS(referr, "Couldn't make a ref to pod", "pod", klog.KObj(pod))
return
}
m.recorder.Eventf(ref, v1.EventTypeWarning, events.FailedPrepareDynamicResources, "Failed to prepare dynamic resources: %v", err)
klog.ErrorS(err, "Failed to prepare dynamic resources", "pod", klog.KObj(pod))
return
}
}