Skip to content

Commit 5a94361

Browse files
committed
Fix linters
Signed-off-by: Sheng Lin <shelin@nvidia.com>
1 parent f9046ce commit 5a94361

4 files changed

Lines changed: 13 additions & 4 deletions

File tree

cmd/compute-domain-controller/cdclique.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import (
2121
"fmt"
2222
"sync"
2323

24+
"k8s.io/apimachinery/pkg/api/meta"
2425
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2526
"k8s.io/apimachinery/pkg/labels"
2627
"k8s.io/client-go/tools/cache"
@@ -30,7 +31,6 @@ import (
3031
"github.com/NVIDIA/k8s-dra-driver-gpu/pkg/metrics"
3132
nvinformers "github.com/NVIDIA/k8s-dra-driver-gpu/pkg/nvidia.com/informers/externalversions"
3233
nvlisters "github.com/NVIDIA/k8s-dra-driver-gpu/pkg/nvidia.com/listers/resource/v1beta1"
33-
"k8s.io/apimachinery/pkg/api/meta"
3434
)
3535

3636
// ComputeDomainCliqueManager manages ComputeDomainClique objects, providing

cmd/compute-domain-daemon/main.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import (
3232
"sync"
3333
"syscall"
3434
"text/template"
35+
"time"
3536

3637
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3738
"k8s.io/apimachinery/pkg/types"
@@ -376,7 +377,9 @@ func setupMetricsEndpoint(ctx context.Context, endpoint, metricsPath string) err
376377
server := &http.Server{Handler: mux}
377378
go func() {
378379
<-ctx.Done()
379-
_ = server.Shutdown(context.Background())
380+
shutdownCtx, cancel := context.WithTimeout(context.WithoutCancel(ctx), 30*time.Second)
381+
defer cancel()
382+
_ = server.Shutdown(shutdownCtx)
380383
}()
381384

382385
go func() {

cmd/compute-domain-kubelet-plugin/main.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
"path"
2828
"path/filepath"
2929
"syscall"
30+
"time"
3031

3132
"github.com/prometheus/client_golang/prometheus/promhttp"
3233
"github.com/urfave/cli/v2"
@@ -300,7 +301,9 @@ func setupMetricsEndpoint(ctx context.Context, endpoint, metricsPath string) err
300301
server := &http.Server{Handler: mux}
301302
go func() {
302303
<-ctx.Done()
303-
_ = server.Shutdown(context.Background())
304+
shutdownCtx, cancel := context.WithTimeout(context.WithoutCancel(ctx), 30*time.Second)
305+
defer cancel()
306+
_ = server.Shutdown(shutdownCtx)
304307
}()
305308

306309
go func() {

cmd/gpu-kubelet-plugin/main.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
"path"
2828
"path/filepath"
2929
"syscall"
30+
"time"
3031

3132
"github.com/prometheus/client_golang/prometheus/promhttp"
3233
"github.com/urfave/cli/v2"
@@ -315,7 +316,9 @@ func setupMetricsEndpoint(ctx context.Context, endpoint, metricsPath string) err
315316
server := &http.Server{Handler: mux}
316317
go func() {
317318
<-ctx.Done()
318-
_ = server.Shutdown(context.Background())
319+
shutdownCtx, cancel := context.WithTimeout(context.WithoutCancel(ctx), 30*time.Second)
320+
defer cancel()
321+
_ = server.Shutdown(shutdownCtx)
319322
}()
320323

321324
go func() {

0 commit comments

Comments
 (0)