Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion cmd/kubehook/kubehook.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ func main() {
app = kingpin.New(filepath.Base(os.Args[0]), "Authenticates Kubernetes users via JWT tokens.").DefaultEnvars()
listen = app.Flag("listen", "Address at which to expose HTTP webhook.").Default(":10003").String()
debug = app.Flag("debug", "Run with debug logging.").Short('d').Bool()
term = app.Flag("shutdown-handler", "Provide endpoint to shutdown the service.").Short('S').Default("true").Bool()
grace = app.Flag("shutdown-grace-period", "Wait this long for sessions to end before shutting down.").Default("1m").Duration()
audience = app.Flag("audience", "Audience for JWT HMAC creation and verification.").Default(jwt.DefaultAudience).String()
userHeader = app.Flag("user-header", "HTTP header specifying the authenticated user sending a token generation request.").Default(handlers.DefaultUserHeader).String()
Expand Down Expand Up @@ -186,9 +187,14 @@ func main() {
r.HandlerFunc("GET", "/", handlers.Content(index, filepath.Base(indexPath)))
r.HandlerFunc("POST", "/generate", generate.Handler(m, h))
r.HandlerFunc("POST", "/authenticate", authenticate.Handler(m))
r.HandlerFunc("GET", "/quitquitquit", handlers.Run(shutdown))
r.HandlerFunc("GET", "/healthz", handlers.Ping())

if *term {
r.HandlerFunc("GET", "/quitquitquit", handlers.Run(shutdown))
} else {
r.HandlerFunc("GET", "/quitquitquit", handlers.NotImplemented())
}

if *template != "" {
t, err := kubecfg.LoadTemplate(*template)
kingpin.FatalIfError(err, "cannot load kubeconfig template")
Expand Down