Skip to content

Commit

Permalink
Merge pull request #211 from kmala/master
Browse files Browse the repository at this point in the history
gracefully terminate on SIGTERM
  • Loading branch information
kmala authored Feb 29, 2024
2 parents d4269f4 + f388356 commit 703c8e7
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 703c8e7

Please sign in to comment.