Documentation ¶
Index ¶
- Constants
- Variables
- func NewCloserFn(handle func(context.Context) error) closer
- func NewHealthzerFn(handle func(context.Context) error) healther
- type BoolHealthzer
- type BoolHealthzerWithContext
- type Closer
- type CloserWithContext
- type ErrorCloser
- type ErrorCloserWithContext
- type ErrorHealthzWithContext
- type ErrorHealthzer
- type ErrorPinger
- type ErrorPingerWithContext
- type ErrorShutdowner
- type ErrorShutdownerWithContext
- type ErrorUnsubscriber
- type ErrorUnsubscriberWithContext
- type HealthzType
- type Option
- func WithConfig(c *viper.Viper) Option
- func WithContext(ctx context.Context) Option
- func WithHTTPHealthzService(enabled bool) Option
- func WithHTTPPrometheusService(enabled bool) Option
- func WithHTTPViperService(enabled bool) Option
- func WithHTTPZapService(enabled bool) Option
- func WithLogFields(fields ...zap.Field) Option
- func WithLogger(l *zap.Logger) Option
- func WithOTLPGRPCTracer(enabled bool) Option
- func WithOTLPHTTPTracer(enabled bool) Option
- func WithPrometheusMeter(enabled bool) Option
- func WithShutdownSignals(shutdownSignals ...os.Signal) Option
- func WithShutdownTimeout(shutdownTimeout time.Duration) Option
- func WithStdOutMeter(enabled bool) Option
- func WithStdOutTracer(enabled bool) Option
- type Server
- func (s *Server) AddAlwaysHealthzers(probes ...interface{})
- func (s *Server) AddCloser(closer interface{})
- func (s *Server) AddClosers(closers ...interface{})
- func (s *Server) AddHealthzer(typ HealthzType, probe interface{})
- func (s *Server) AddHealthzers(typ HealthzType, probes ...interface{})
- func (s *Server) AddLivenessHealthzers(probes ...interface{})
- func (s *Server) AddReadinessHealthzers(probes ...interface{})
- func (s *Server) AddService(service Service)
- func (s *Server) AddServices(services ...Service)
- func (s *Server) AddStartupHealthzers(probes ...interface{})
- func (s *Server) CancelContext() context.Context
- func (s *Server) Config() *viper.Viper
- func (s *Server) Context() context.Context
- func (s *Server) Healthz() error
- func (s *Server) IsCanceled() bool
- func (s *Server) Logger() *zap.Logger
- func (s *Server) Meter() metric.MeterMust
- func (s *Server) Run()
- func (s *Server) Tracer() trace.Tracer
- type Service
- type ServiceHTTP
- func NewDefaultServiceHTTPProbes(probes map[HealthzType][]interface{}) *ServiceHTTP
- func NewDefaultServiceHTTPPrometheus() *ServiceHTTP
- func NewDefaultServiceHTTPViper() *ServiceHTTP
- func NewDefaultServiceHTTPZap() *ServiceHTTP
- func NewServiceHTTP(l *zap.Logger, name, addr string, handler http.Handler, ...) *ServiceHTTP
- func NewServiceHTTPHealthz(l *zap.Logger, name, addr, path string, probes map[HealthzType][]interface{}) *ServiceHTTP
- func NewServiceHTTPPrometheus(l *zap.Logger, name, addr, path string) *ServiceHTTP
- func NewServiceHTTPViper(l *zap.Logger, c *viper.Viper, name, addr, path string) *ServiceHTTP
- func NewServiceHTTPZap(l *zap.Logger, name, addr, path string) *ServiceHTTP
- type Shutdowner
- type ShutdownerWithContext
- type Unsubscriber
- type UnsubscriberWithContext
Constants ¶
const ( DefaultServiceHTTPHealthzName = "healthz" DefaultServiceHTTPHealthzAddr = ":9400" DefaultServiceHTTPHealthzPath = "/healthz" )
const ( DefaultServiceHTTPPrometheusName = "prometheus" DefaultServiceHTTPPrometheusAddr = ":9200" DefaultServiceHTTPPrometheusPath = "/metrics" )
const ( DefaultServiceHTTPViperName = "viper" DefaultServiceHTTPViperAddr = "localhost:9300" DefaultServiceHTTPViperPath = "/config" )
const ( DefaultServiceHTTPZapName = "zap" DefaultServiceHTTPZapAddr = "localhost:9100" DefaultServiceHTTPZapPath = "/log" )
Variables ¶
var ( ErrServerNotRunning = errors.New("server not running") ErrServiceNotRunning = errors.New("service not running") )
var ( // Version usage -ldflags "-X github.com/foomo/keel/server.Version=$VERSION" Version string // GitCommit usage -ldflags "-X github.com/foomo/keel/server.GitCommit=$GIT_COMMIT" GitCommit string // BuildTime usage -ldflags "-X 'github.com/foomo/keel/server.BuildTime=$(date -u '+%Y-%m-%d %H:%M:%S')'" BuildTime string )
Functions ¶
func NewCloserFn ¶ added in v0.9.3
func NewHealthzerFn ¶ added in v0.9.3
Types ¶
type BoolHealthzer ¶ added in v0.9.2
type BoolHealthzer interface {
Healthz() bool
}
BoolHealthzer interface
type BoolHealthzerWithContext ¶ added in v0.9.2
BoolHealthzerWithContext interface
type CloserWithContext ¶
CloserWithContext interface
type ErrorCloser ¶ added in v0.2.10
type ErrorCloser interface {
Close() error
}
ErrorCloser interface
type ErrorCloserWithContext ¶ added in v0.2.10
ErrorCloserWithContext interface
type ErrorHealthzWithContext ¶ added in v0.9.0
ErrorHealthzWithContext interface
type ErrorHealthzer ¶ added in v0.9.2
type ErrorHealthzer interface {
Healthz() error
}
ErrorHealthzer interface
type ErrorPinger ¶ added in v0.9.2
type ErrorPinger interface {
Ping() error
}
ErrorPinger interface
type ErrorPingerWithContext ¶ added in v0.9.2
ErrorPingerWithContext interface
type ErrorShutdowner ¶ added in v0.2.10
type ErrorShutdowner interface {
Shutdown() error
}
ErrorShutdowner interface
type ErrorShutdownerWithContext ¶ added in v0.2.10
ErrorShutdownerWithContext interface
type ErrorUnsubscriber ¶ added in v0.2.10
type ErrorUnsubscriber interface {
Unsubscribe() error
}
ErrorUnsubscriber interface
type ErrorUnsubscriberWithContext ¶ added in v0.2.10
ErrorUnsubscriberWithContext interface
type HealthzType ¶ added in v0.9.2
type HealthzType string
HealthzType type https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/
const ( // HealthzTypeAlways will run on any checks HealthzTypeAlways HealthzType = "always" // HealthzTypeStartup will run on /healthz/startup checks // > The kubelet uses startup probes to know when a container application has started. If such a probe is configured, // > it disables liveness and readiness checks until it succeeds, making sure those probes don't interfere with the // > application startup. This can be used to adopt liveness checks on slow starting containers, avoiding them getting // > killed by the kubelet before they are up and running. HealthzTypeStartup HealthzType = "startup" // HealthzTypeReadiness will run on /healthz/readiness checks // > The kubelet uses readiness probes to know when a container is ready to start accepting traffic. // > A Pod is considered ready when all of its containers are ready. One use of this signal is to control // > which Pods are used as backends for Services. When a Pod is not ready, it is removed from Service load balancers. HealthzTypeReadiness HealthzType = "readiness" // HealthzTypeLiveness will run on /healthz/liveness checks // > The kubelet uses liveness probes to know when to restart a container. For example, liveness probes could catch // > a deadlock, where an application is running, but unable to make progress. Restarting a container in such a state // > can help to make the application more available despite bugs. HealthzTypeLiveness HealthzType = "liveness" )
type Option ¶
type Option func(inst *Server)
Option func
func WithHTTPHealthzService ¶ added in v0.9.2
func WithHTTPPrometheusService ¶ added in v0.2.0
WithHTTPPrometheusService option with default value
func WithHTTPViperService ¶ added in v0.2.0
WithHTTPViperService option with default value
func WithHTTPZapService ¶ added in v0.2.0
WithHTTPZapService option with default value
func WithOTLPGRPCTracer ¶ added in v0.8.0
WithOTLPGRPCTracer option with default value
func WithOTLPHTTPTracer ¶ added in v0.8.0
WithOTLPHTTPTracer option with default value
func WithPrometheusMeter ¶ added in v0.8.0
WithPrometheusMeter option with default value
func WithShutdownSignals ¶ added in v0.6.4
WithShutdownSignals option
func WithShutdownTimeout ¶
WithShutdownTimeout option
func WithStdOutMeter ¶ added in v0.8.0
WithStdOutMeter option with default value
func WithStdOutTracer ¶ added in v0.8.0
WithStdOutTracer option with default value
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server struct
func (*Server) AddAlwaysHealthzers ¶ added in v0.9.3
func (s *Server) AddAlwaysHealthzers(probes ...interface{})
AddAlwaysHealthzers adds the probes to be called on any healthz checks
func (*Server) AddCloser ¶
func (s *Server) AddCloser(closer interface{})
AddCloser adds a closer to be called on shutdown
func (*Server) AddClosers ¶
func (s *Server) AddClosers(closers ...interface{})
AddClosers adds the given closers to be called on shutdown
func (*Server) AddHealthzer ¶ added in v0.9.3
func (s *Server) AddHealthzer(typ HealthzType, probe interface{})
AddHealthzer adds a probe to be called on healthz checks
func (*Server) AddHealthzers ¶ added in v0.9.3
func (s *Server) AddHealthzers(typ HealthzType, probes ...interface{})
AddHealthzers adds the given probes to be called on healthz checks
func (*Server) AddLivenessHealthzers ¶ added in v0.9.3
func (s *Server) AddLivenessHealthzers(probes ...interface{})
AddLivenessHealthzers adds the liveness probes to be called on healthz checks
func (*Server) AddReadinessHealthzers ¶ added in v0.9.3
func (s *Server) AddReadinessHealthzers(probes ...interface{})
AddReadinessHealthzers adds the readiness probes to be called on healthz checks
func (*Server) AddService ¶
AddService add a single service
func (*Server) AddServices ¶
AddServices adds multiple service
func (*Server) AddStartupHealthzers ¶ added in v0.9.3
func (s *Server) AddStartupHealthzers(probes ...interface{})
AddStartupHealthzers adds the startup probes to be called on healthz checks
func (*Server) CancelContext ¶ added in v0.9.4
CancelContext returns server's cancel context
func (*Server) IsCanceled ¶ added in v0.9.1
IsCanceled returns true if the internal errgroup has been canceled
type Service ¶
type Service interface { Name() string Start(ctx context.Context) error Close(ctx context.Context) error }
Service interface
type ServiceHTTP ¶
type ServiceHTTP struct {
// contains filtered or unexported fields
}
ServiceHTTP struct
func NewDefaultServiceHTTPProbes ¶ added in v0.9.0
func NewDefaultServiceHTTPProbes(probes map[HealthzType][]interface{}) *ServiceHTTP
func NewDefaultServiceHTTPPrometheus ¶
func NewDefaultServiceHTTPPrometheus() *ServiceHTTP
func NewDefaultServiceHTTPViper ¶
func NewDefaultServiceHTTPViper() *ServiceHTTP
func NewDefaultServiceHTTPZap ¶
func NewDefaultServiceHTTPZap() *ServiceHTTP
func NewServiceHTTP ¶
func NewServiceHTTP(l *zap.Logger, name, addr string, handler http.Handler, middlewares ...middleware.Middleware) *ServiceHTTP
func NewServiceHTTPHealthz ¶ added in v0.9.2
func NewServiceHTTPHealthz(l *zap.Logger, name, addr, path string, probes map[HealthzType][]interface{}) *ServiceHTTP
func NewServiceHTTPPrometheus ¶
func NewServiceHTTPPrometheus(l *zap.Logger, name, addr, path string) *ServiceHTTP
func NewServiceHTTPViper ¶
func NewServiceHTTPZap ¶
func NewServiceHTTPZap(l *zap.Logger, name, addr, path string) *ServiceHTTP
func (*ServiceHTTP) Healthz ¶ added in v0.9.1
func (s *ServiceHTTP) Healthz() error
func (*ServiceHTTP) Name ¶ added in v0.3.3
func (s *ServiceHTTP) Name() string
type ShutdownerWithContext ¶
ShutdownerWithContext interface
type Unsubscriber ¶ added in v0.2.0
type Unsubscriber interface {
Unsubscribe()
}
Unsubscriber interface
type UnsubscriberWithContext ¶ added in v0.2.0
UnsubscriberWithContext interface