Skip to content

Commit

Permalink
fix up vgpu device plugin shutdown sequence and fix up failing integr…
Browse files Browse the repository at this point in the history
…ation tests
  • Loading branch information
ibrokethecloud committed Jan 22, 2024
1 parent 3a76207 commit f569071
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions pkg/deviceplugins/vgpu_device_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -356,14 +356,13 @@ func (dp *VGPUDevicePlugin) GetDeviceName() string {

// Stop stops the gRPC server
func (dp *VGPUDevicePlugin) stopDevicePlugin() error {
defer func() {
if !IsChanClosed(dp.done) {
close(dp.done)
}
}()

// Give the device plugin one second to properly deregister
ticker := time.NewTicker(1 * time.Second)
if !IsChanClosed(dp.done) {
close(dp.done)
}

// Give the device plugin 5 seconds to properly deregister
ticker := time.NewTicker(5 * time.Second)
defer ticker.Stop()
select {
case <-dp.deregistered:
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/mutator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ var _ = Describe("validate mutator by sending a mock pod request needing mutatio
Spec: corev1.PodSpec{
Containers: []corev1.Container{
{
Name: "fakepod",
Name: "compute",
Image: "fakeimage",
SecurityContext: &corev1.SecurityContext{
Capabilities: &corev1.Capabilities{
Expand Down

0 comments on commit f569071

Please sign in to comment.