Skip to content

Commit

Permalink
Remove the duplicated health check
Browse files Browse the repository at this point in the history
  • Loading branch information
airycanon committed Nov 6, 2024
1 parent 72a9e1c commit d707d6e
Showing 1 changed file with 0 additions and 38 deletions.
38 changes: 0 additions & 38 deletions cmd/controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,6 @@ import (
// Uncomment the following line to load the gcp plugin (only required to authenticate against GKE clusters).
// _ "k8s.io/client-go/plugin/pkg/client/auth/gcp"

"errors"
"log"
"net/http"
"os"
"time"

"knative.dev/pkg/injection/sharedmain"

filteredFactory "knative.dev/pkg/client/injection/kube/informers/factory/filtered"
Expand All @@ -52,36 +46,8 @@ import (
)

func main() {

ctx := signals.NewContext()

port := os.Getenv("PROBES_PORT")
if port == "" {
port = "8080"
}

// sets up liveness and readiness probes.
server := http.Server{
ReadTimeout: 5 * time.Second,
Handler: http.HandlerFunc(handler),
Addr: ":" + port,
}

go func() {

go func() {
<-ctx.Done()
_ = server.Shutdown(ctx)
}()

// start the web server on port and accept requests
log.Printf("Readiness and health check server listening on port %s", port)

if err := server.ListenAndServe(); err != nil && !errors.Is(err, http.ErrServerClosed) {
log.Fatal(err)
}
}()

ctx = filteredFactory.WithSelectors(ctx,
auth.OIDCLabelSelector,
eventingtls.TrustBundleLabelSelector,
Expand Down Expand Up @@ -118,7 +84,3 @@ func main() {
sugartrigger.NewController,
)
}

func handler(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
}

0 comments on commit d707d6e

Please sign in to comment.