-
Notifications
You must be signed in to change notification settings - Fork 794
Fix device plugin recovery from Unhealthy state #2201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -40,6 +40,7 @@ import ( | |
|
|
||
| "github.com/NVIDIA/go-nvml/pkg/nvml" | ||
| "k8s.io/klog/v2" | ||
| kubeletdevicepluginv1beta1 "k8s.io/kubelet/pkg/apis/deviceplugin/v1beta1" | ||
| ) | ||
|
|
||
| const ( | ||
|
|
@@ -56,8 +57,8 @@ const ( | |
| envEnableHealthChecks = "DP_ENABLE_HEALTHCHECKS" | ||
| ) | ||
|
|
||
| // CheckHealth performs health checks on a set of devices, writing to the 'unhealthy' channel with any unhealthy devices | ||
| func (r *nvmlResourceManager) checkHealth(stop <-chan interface{}, devices Devices, unhealthy chan<- *Device, disableNVML <-chan bool) error { | ||
| // CheckHealth performs health checks on a set of devices, writing to the 'health' channel with any unhealthy devices | ||
| func (r *nvmlResourceManager) checkHealth(stop <-chan interface{}, devices Devices, health chan<- *Device, disableNVML <-chan bool) error { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the rename stops at the sig, l.102/112/119 still send to |
||
| xids := getHealthCheckXids() | ||
| if xids.IsAllDisabled() { | ||
| return nil | ||
|
|
@@ -123,7 +124,7 @@ func (r *nvmlResourceManager) checkHealth(stop <-chan interface{}, devices Devic | |
| } | ||
| if ret != nvml.SUCCESS { | ||
| klog.Infof("Marking device %v as unhealthy: %v", d.ID, ret) | ||
| unhealthy <- d | ||
| health <- d | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -146,7 +147,7 @@ func (r *nvmlResourceManager) checkHealth(stop <-chan interface{}, devices Devic | |
| if ret != nvml.SUCCESS { | ||
| klog.Infof("Error waiting for event: %v; Marking all devices as unhealthy", ret) | ||
| for _, d := range devices { | ||
| unhealthy <- d | ||
| health <- d | ||
| } | ||
| continue | ||
| } | ||
|
|
@@ -167,7 +168,7 @@ func (r *nvmlResourceManager) checkHealth(stop <-chan interface{}, devices Devic | |
| // If we cannot reliably determine the device UUID, we mark all devices as unhealthy. | ||
| klog.Infof("Failed to determine uuid for event %v: %v; Marking all devices as unhealthy.", e, ret) | ||
| for _, d := range devices { | ||
| unhealthy <- d | ||
| health <- d | ||
| } | ||
| continue | ||
| } | ||
|
|
@@ -188,7 +189,7 @@ func (r *nvmlResourceManager) checkHealth(stop <-chan interface{}, devices Devic | |
| } | ||
|
|
||
| klog.Infof("XidCriticalError: Xid=%d on Device=%s; marking device as unhealthy.", e.EventData, d.ID) | ||
| unhealthy <- d | ||
| health <- d | ||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,7 +48,7 @@ var _ ResourceManager = &ResourceManagerMock{} | |
| // | ||
| // // make and configure a mocked ResourceManager | ||
| // mockedResourceManager := &ResourceManagerMock{ | ||
| // CheckHealthFunc: func(stop <-chan interface{}, unhealthy chan<- *Device) error { | ||
| // CheckHealthFunc: func(stop <-chan interface{}, health chan<- *Device) error { | ||
| // panic("mock out the CheckHealth method") | ||
| // }, | ||
| // DevicesFunc: func() Devices { | ||
|
|
@@ -74,7 +74,7 @@ var _ ResourceManager = &ResourceManagerMock{} | |
| // } | ||
| type ResourceManagerMock struct { | ||
| // CheckHealthFunc mocks the CheckHealth method. | ||
| CheckHealthFunc func(stop <-chan interface{}, unhealthy chan<- *Device) error | ||
| CheckHealthFunc func(stop <-chan interface{}, health chan<- *Device) error | ||
|
|
||
| // DevicesFunc mocks the Devices method. | ||
| DevicesFunc func() Devices | ||
|
|
@@ -97,8 +97,8 @@ type ResourceManagerMock struct { | |
| CheckHealth []struct { | ||
| // Stop is the stop argument value. | ||
| Stop <-chan interface{} | ||
| // Unhealthy is the unhealthy argument value. | ||
| Unhealthy chan<- *Device | ||
| // Health is the health argument value. | ||
| Health chan<- *Device | ||
| } | ||
| // Devices holds details about calls to the Devices method. | ||
| Devices []struct { | ||
|
|
@@ -135,13 +135,13 @@ type ResourceManagerMock struct { | |
| } | ||
|
|
||
| // CheckHealth calls CheckHealthFunc. | ||
| func (mock *ResourceManagerMock) CheckHealth(stop <-chan interface{}, unhealthy chan<- *Device, disableNVML <-chan bool, ackDisableHealthChecks chan<- bool) error { | ||
| func (mock *ResourceManagerMock) CheckHealth(stop <-chan interface{}, health chan<- *Device, disableNVML <-chan bool, ackDisableHealthChecks chan<- bool) error { | ||
| callInfo := struct { | ||
| Stop <-chan interface{} | ||
| Unhealthy chan<- *Device | ||
| Stop <-chan interface{} | ||
| Health chan<- *Device | ||
| }{ | ||
| Stop: stop, | ||
| Unhealthy: unhealthy, | ||
| Stop: stop, | ||
| Health: health, | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| } | ||
| mock.lockCheckHealth.Lock() | ||
| mock.calls.CheckHealth = append(mock.calls.CheckHealth, callInfo) | ||
|
|
@@ -152,16 +152,16 @@ func (mock *ResourceManagerMock) CheckHealth(stop <-chan interface{}, unhealthy | |
| ) | ||
| return errOut | ||
| } | ||
| return mock.CheckHealthFunc(stop, unhealthy) | ||
| return mock.CheckHealthFunc(stop, health) | ||
| } | ||
|
|
||
| // CheckHealthCalls gets all the calls that were made to CheckHealth. | ||
| // Check the length with: | ||
| // | ||
| // len(mockedResourceManager.CheckHealthCalls()) | ||
| func (mock *ResourceManagerMock) CheckHealthCalls() []struct { | ||
| Stop <-chan interface{} | ||
| Unhealthy chan<- *Device | ||
| Stop <-chan interface{} | ||
| Health chan<- *Device | ||
| } { | ||
| var calls []struct { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this local still says |
||
| Stop <-chan interface{} | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.