diff options
author | Will Chandler <wchandler@gitlab.com> | 2022-11-15 22:14:33 +0300 |
---|---|---|
committer | Will Chandler <wchandler@gitlab.com> | 2022-11-15 22:14:33 +0300 |
commit | dc78b2681a44f375d111a14c8896e9a213900f45 (patch) | |
tree | 7eb29421dc3f6836cebcfaf44ae3a5c124857071 | |
parent | 00e38c6e1292c7f6d2d3c4fc0435c86ee9233249 (diff) | |
parent | d5303e924079c32961d8f5a8a7d96cfe09a3d892 (diff) |
Merge branch 'jt-readiness-rpc' into 'master'
Praefect: Remove clock drift readiness check
See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/5040
Merged-by: Will Chandler <wchandler@gitlab.com>
Approved-by: Steve Azzopardi <sazzopardi@gitlab.com>
Approved-by: karthik nayak <knayak@gitlab.com>
Approved-by: Pavlo Strokov <pstrokov@gitlab.com>
Co-authored-by: Justin Tobler <jtobler@gitlab.com>
-rw-r--r-- | cmd/praefect/main.go | 2 | ||||
-rw-r--r-- | internal/praefect/service/checks.go | 19 |
2 files changed, 16 insertions, 5 deletions
diff --git a/cmd/praefect/main.go b/cmd/praefect/main.go index cca44b121..f0fe2b3e6 100644 --- a/cmd/praefect/main.go +++ b/cmd/praefect/main.go @@ -437,7 +437,7 @@ func run( protoregistry.GitalyProtoPreregistered, nodeSet.Connections(), primaryGetter, - service.AllChecks(), + service.ReadinessChecks(), ) ) metricsCollectors = append(metricsCollectors, transactionManager, coordinator, repl) diff --git a/internal/praefect/service/checks.go b/internal/praefect/service/checks.go index 9bf5e7bb0..37f51256c 100644 --- a/internal/praefect/service/checks.go +++ b/internal/praefect/service/checks.go @@ -38,9 +38,10 @@ const ( Fatal = "fatal" ) -// Check is a struct representing a check on the health of a Gitaly cluster's setup. These are separate from the "healthcheck" -// concept which is more concerned with the health of the praefect service. These checks are meant to diagnose any issues with -// the praefect cluster setup itself and will be run on startup/restarts. +// Check represents a check to be performed to validate Gitaly cluster health. +// Checks are used to diagnose issues with Praefect cluster setup through the +// Praefect CLI `check` subcommand and also performed through the invoking of +// the readiness RPC. type Check struct { Run func(ctx context.Context) error Name string @@ -62,6 +63,16 @@ func AllChecks() []CheckFunc { } } +// ReadinessChecks returns the checks invoked by the Praefect readiness RPC. +func ReadinessChecks() []CheckFunc { + return []CheckFunc{ + NewPraefectMigrationCheck, + NewGitalyNodeConnectivityCheck, + NewPostgresReadWriteCheck, + NewUnavailableReposCheck, + } +} + // NewPraefectMigrationCheck returns a Check that checks if all praefect migrations have run func NewPraefectMigrationCheck(conf config.Config, w io.Writer, quiet bool) *Check { return &Check{ @@ -204,7 +215,7 @@ func NewUnavailableReposCheck(conf config.Config, w io.Writer, quiet bool) *Chec } // NewClockSyncCheck returns a function that returns a check that verifies if system clock is in sync. -func NewClockSyncCheck(clockDriftCheck func(ntpHost string, driftThreshold time.Duration) (bool, error)) func(_ config.Config, _ io.Writer, _ bool) *Check { +func NewClockSyncCheck(clockDriftCheck func(ntpHost string, driftThreshold time.Duration) (bool, error)) CheckFunc { return func(conf config.Config, w io.Writer, quite bool) *Check { return &Check{ Name: "clock synchronization", |