Documentation
¶
Index ¶
- Constants
- Variables
- func CreateChecker(ctx context.Context, options ...Option) context.Context
- func RegisterLivenessSubservices(ctx context.Context, services ...string) error
- func RegisterReadinessSubservices(ctx context.Context, services ...string) error
- func RegisterStartupSubservices(ctx context.Context, services ...string) error
- func SetServingStatus(ctx context.Context, service string, serving bool)
- func WithHealthServer(parent context.Context, server *Checker) context.Context
- type Checker
- func (c *Checker) Check(ctx context.Context, in *grpc_health_v1.HealthCheckRequest) (*grpc_health_v1.HealthCheckResponse, error)
- func (c *Checker) RegisterServices(probeSvc string, services ...string)
- func (c *Checker) SetServingStatus(service string, servingStatus grpc_health_v1.HealthCheckResponse_ServingStatus)
- func (c *Checker) Start() error
- type HealthServerStatusModifier
- type Option
Constants ¶
const ( Startup string = "Startup" Readiness string = "Readiness" Liveness string = "Liveness" )
const ( IPAMSvc string = "IPAM" IPAMCliSvc string = "IPAMCli" NSPCliSvc string = "NSPCli" EgressSvc string = "Egress" NSMEndpointSvc string = "NSMEndpoint" StreamSvc string = "Stream" FlowSvc string = "Flow" NSPSvc string = "NSP" AmbassadorSvc string = "Ambassador" )
const (
DefaultURL string = "unix:///tmp/health.sock"
)
Variables ¶
var FEReadinessServices []string = []string{NSPCliSvc, EgressSvc}
var IPAMLivenessServices []string = []string{IPAMSvc}
var IPAMReadinessServices []string = []string{NSPCliSvc}
var LBLivenessServices []string = []string{NSMEndpointSvc}
var LBReadinessServices []string = []string{NSPCliSvc, NSMEndpointSvc, EgressSvc, StreamSvc, FlowSvc}
var NSPLivenessServices []string = []string{NSPSvc}
var ProxyLivenessServices []string = []string{NSMEndpointSvc}
var ProxyReadinessServices []string = []string{IPAMCliSvc, NSPCliSvc, NSMEndpointSvc, EgressSvc}
var TAPALivenessServices []string = []string{AmbassadorSvc}
Functions ¶
func CreateChecker ¶
CreateChecker - Wraps NewChecker() and saves Checker into context, also starts Checker in a goroutine TODO: revisit if it's really needed to fail the program on error
func RegisterLivenessSubservices ¶ added in v1.0.13
RegisterLivenessSubservices - Wraps Checker.RegisterServices() by fetching the health server (i.e. Checker) from context
func RegisterReadinessSubservices ¶ added in v1.0.13
RegisterReadinessSubservices - Wraps Checker.RegisterServices() by fetching the health server (i.e. Checker) from context
func RegisterStartupSubservices ¶ added in v1.0.13
RegisterStartupSubservices - Wraps Checker.RegisterServices() by fetching the health server (i.e. Checker) from context
func SetServingStatus ¶
SetServingStatus - Wraps Checker.SetServingStatus() by fetching the health server (i.e. Checker) from context
Types ¶
type Checker ¶
type Checker struct { grpc_health_v1.HealthServer HealthServerStatusModifier // contains filtered or unexported fields }
func HealthServer ¶
Server - Returns Health Server (Checker) from the context.Context
func NewChecker ¶
NewChecker - Creates gRPC health server
func (*Checker) Check ¶
func (c *Checker) Check(ctx context.Context, in *grpc_health_v1.HealthCheckRequest) (*grpc_health_v1.HealthCheckResponse, error)
Check - Re-implements Check() function of grpc_health_v1.HealthServer interface in order to log if a probe service is about to fail.
func (*Checker) RegisterServices ¶
RegisterServices - Registers subservices for a probe service whose serving status will be deterimined by the serving status of the subservices. Notes:
- A subservice can be part of multiple probe services
- No check for duplicate registration (e.g. services previously registered for the same probe service are not removed)
func (*Checker) SetServingStatus ¶
func (c *Checker) SetServingStatus(service string, servingStatus grpc_health_v1.HealthCheckResponse_ServingStatus)
Re-implements SetServingStatus function in order to evaluate probe service status in case a related subservice is subject to the call
type HealthServerStatusModifier ¶
type HealthServerStatusModifier interface { SetServingStatus(service string, servingStatus grpc_health_v1.HealthCheckResponse_ServingStatus) Shutdown() }