Skip to content

Commit

Permalink
Merge pull request #24042 from cjwagner/prow-controller-manager-liveness
Browse files Browse the repository at this point in the history
Add liveness and readiness endpoint to prow-controller-manager.
  • Loading branch information
k8s-ci-robot authored Oct 19, 2021
2 parents b62fa2f + 228b066 commit a9a7558
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions prow/cmd/prow-controller-manager/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ go_library(
"//prow/io:go_default_library",
"//prow/logrusutil:go_default_library",
"//prow/metrics:go_default_library",
"//prow/pjutil:go_default_library",
"//prow/pjutil/pprof:go_default_library",
"//prow/plank:go_default_library",
"@com_github_sirupsen_logrus//:go_default_library",
Expand Down
7 changes: 6 additions & 1 deletion prow/cmd/prow-controller-manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import (
"k8s.io/apimachinery/pkg/labels"
utilerrors "k8s.io/apimachinery/pkg/util/errors"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/test-infra/prow/pjutil"
"k8s.io/test-infra/prow/pjutil/pprof"
ctrlruntimelog "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
Expand Down Expand Up @@ -82,7 +83,7 @@ func (o *options) Validate() error {
o.github.AllowAnonymous = true

var errs []error
for _, group := range []flagutil.OptionGroup{&o.kubernetes, &o.github, &o.config, &o.storage} {
for _, group := range []flagutil.OptionGroup{&o.kubernetes, &o.github, &o.instrumentationOptions, &o.config, &o.storage} {
if err := group.Validate(o.dryRun); err != nil {
errs = append(errs, err)
}
Expand Down Expand Up @@ -115,6 +116,7 @@ func main() {

defer interrupts.WaitForGracefulShutdown()

health := pjutil.NewHealthOnPort(o.instrumentationOptions.HealthPort) // Start liveness endpoint
pprof.Instrument(o.instrumentationOptions)

configAgent, err := o.config.ConfigAgent()
Expand Down Expand Up @@ -191,6 +193,9 @@ func main() {

// Expose prometheus metrics
metrics.ExposeMetrics("plank", cfg().PushGateway, o.instrumentationOptions.MetricsPort)
// Serve readiness endpoint
health.ServeReady()

if err := mgr.Start(interrupts.Context()); err != nil {
logrus.WithError(err).Fatal("failed to start manager")
}
Expand Down

0 comments on commit a9a7558

Please sign in to comment.