health-check: building config from databroker source

This commit is contained in:
Denis Mishin 2024-05-06 11:39:14 -04:00
parent b1feff5d56
commit e23cde506d
2 changed files with 5 additions and 0 deletions

View file

@ -21,6 +21,7 @@ import (
configpb "github.com/pomerium/pomerium/pkg/grpc/config"
"github.com/pomerium/pomerium/pkg/grpc/databroker"
"github.com/pomerium/pomerium/pkg/grpcutil"
"github.com/pomerium/pomerium/pkg/health"
)
// ConfigSource provides a new Config source that decorates an underlying config with
@ -100,9 +101,11 @@ func (src *ConfigSource) rebuild(ctx context.Context, firstTime firstTime) {
now = time.Now()
err := src.buildNewConfigLocked(ctx, cfg)
if err != nil {
health.ReportError(health.BuildDatabrokerConfig, err)
log.Error(ctx).Err(err).Msg("databroker: failed to build new config")
return
}
health.ReportOK(health.BuildDatabrokerConfig)
log.Debug(ctx).Str("elapsed", time.Since(now).String()).Msg("databroker: built new config")
src.computedConfig = cfg

View file

@ -5,6 +5,8 @@ import "fmt"
type Check string
const (
// BuildDatabrokerConfig checks whether the Databroker config was applied
BuildDatabrokerConfig = Check("config.databroker.build")
// StorageBackend checks whether the storage backend is healthy
StorageBackend = Check("storage.backend")
// XDSCluster checks whether the XDS Cluster resources were applied