Fix lint issues

This commit is contained in:
motoki317 2024-11-21 22:08:21 +09:00
parent ff45a2a6af
commit 872d64b05c
No known key found for this signature in database
3 changed files with 10 additions and 7 deletions

View file

@ -23,7 +23,6 @@ import (
"errors" "errors"
"fmt" "fmt"
"io/fs" "io/fs"
"k8s.io/ingress-nginx/internal/ingress/metric/collectors"
"net" "net"
"net/http" "net/http"
"os" "os"
@ -38,6 +37,8 @@ import (
"time" "time"
"unicode" "unicode"
"k8s.io/ingress-nginx/internal/ingress/metric/collectors"
proxyproto "github.com/armon/go-proxyproto" proxyproto "github.com/armon/go-proxyproto"
"github.com/eapache/channels" "github.com/eapache/channels"
apiv1 "k8s.io/api/core/v1" apiv1 "k8s.io/api/core/v1"
@ -429,7 +430,7 @@ func (n *NGINXController) stopWait() {
} }
// Wait at least for the configured duration, if any // Wait at least for the configured duration, if any
delay := waitAtLeastUntil.Sub(time.Now()) delay := time.Until(waitAtLeastUntil)
if delay > 0 { if delay > 0 {
time.Sleep(delay) time.Sleep(delay)
} }

View file

@ -17,11 +17,12 @@ limitations under the License.
package process package process
import ( import (
klog "k8s.io/klog/v2"
"os" "os"
"os/signal" "os/signal"
"syscall" "syscall"
"time" "time"
"k8s.io/klog/v2"
) )
type exiter func(code int) type exiter func(code int)
@ -41,7 +42,7 @@ func HandleSigterm(ngx Controller, delay int, exit exiter) {
} }
if delay > 0 { if delay > 0 {
klog.Warning("[DEPRECATED] Delaying controller exit for %d seconds", delay) klog.Warningf("[DEPRECATED] Delaying controller exit for %d seconds", delay)
klog.Warning("[DEPRECATED] 'post-shutdown-grace-period' does not have any effect for graceful shutdown - use 'shutdown-grace-period' flag instead.") klog.Warning("[DEPRECATED] 'post-shutdown-grace-period' does not have any effect for graceful shutdown - use 'shutdown-grace-period' flag instead.")
time.Sleep(time.Duration(delay) * time.Second) time.Sleep(time.Duration(delay) * time.Second)
} }

View file

@ -19,14 +19,15 @@ package gracefulshutdown
import ( import (
"context" "context"
"fmt" "fmt"
"net/http"
"strings"
"time"
"github.com/onsi/ginkgo/v2" "github.com/onsi/ginkgo/v2"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
appsv1 "k8s.io/api/apps/v1" appsv1 "k8s.io/api/apps/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/ingress-nginx/test/e2e/framework" "k8s.io/ingress-nginx/test/e2e/framework"
"net/http"
"strings"
"time"
) )
var _ = framework.IngressNginxDescribe("[Shutdown] Asynchronous shutdown", func() { var _ = framework.IngressNginxDescribe("[Shutdown] Asynchronous shutdown", func() {