Skip to content

Commit

Permalink
gracefully terminate on SIGTERM
Browse files Browse the repository at this point in the history
  • Loading branch information
kmala committed Feb 21, 2024
1 parent d4269f4 commit f388356
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"crypto/x509/pkix"
goflag "flag"
"fmt"
"github.com/aws/amazon-eks-pod-identity-webhook/pkg/containercredentials"
"net/http"
"os"
"strings"
Expand All @@ -31,6 +30,7 @@ import (
"github.com/aws/amazon-eks-pod-identity-webhook/pkg/cache"
cachedebug "github.com/aws/amazon-eks-pod-identity-webhook/pkg/cache/debug"
"github.com/aws/amazon-eks-pod-identity-webhook/pkg/cert"
"github.com/aws/amazon-eks-pod-identity-webhook/pkg/containercredentials"
"github.com/aws/amazon-eks-pod-identity-webhook/pkg/handler"
"github.com/aws/aws-sdk-go/aws/ec2metadata"
"github.com/aws/aws-sdk-go/aws/session"
Expand Down Expand Up @@ -302,6 +302,8 @@ func main() {
Handler: metricsMux,
}

handler.ShutdownFromContext(signalHandlerCtx, metricsServer, time.Duration(10)*time.Second)

go func() {
klog.Infof("Listening on %s", addr)
if err := server.ListenAndServeTLS("", ""); err != http.ErrServerClosed {
Expand Down

0 comments on commit f388356

Please sign in to comment.