Documentation
¶
Index ¶
- Constants
- type DiagnosticsExposer
- type DiagnosticsServer
- func (s *DiagnosticsServer) RegisterInstance(instanceID manager.ID, instanceDiagnosticsHandler http.Handler)
- func (s *DiagnosticsServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (s *DiagnosticsServer) Start(ctx context.Context) error
- func (s *DiagnosticsServer) UnregisterInstance(instanceID manager.ID)
- type DiagnosticsServerOption
- type InstanceNotFoundError
- type InstanceWithIDAlreadyScheduledError
- type Manager
- type ManagerInstance
- type ManagerOption
Constants ¶
const ( // SchedulingQueueSize is the size of the scheduling queue for manager.Manager instances. It should be large enough // to handle all reasonable cases of manager.Manager instances being scheduled at the same time. SchedulingQueueSize = instances.SchedulingQueueSize )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DiagnosticsExposer ¶
type DiagnosticsExposer = instances.DiagnosticsExposer
DiagnosticsExposer is an interface that represents an object that can expose diagnostics data of manager.Manager instances.
type DiagnosticsServer ¶
type DiagnosticsServer struct {
// contains filtered or unexported fields
}
DiagnosticsServer is a server that provides diagnostics information for multiple instances managed by the manager. Each instance exposes its own diagnostics endpoints on `/{instanceID}/debug/config/` prefix. On every call to RegisterInstance or UnregisterInstance, the server rebuilds its mux to include the latest set of handlers.
func NewDiagnosticsServer ¶
func NewDiagnosticsServer(listenerPort int, opts ...DiagnosticsServerOption) *DiagnosticsServer
NewDiagnosticsServer creates a new DiagnosticsServer with the given listener port and options. It exposes diagnostics endpoints for each instance registered to it.
func (*DiagnosticsServer) RegisterInstance ¶
func (s *DiagnosticsServer) RegisterInstance(instanceID manager.ID, instanceDiagnosticsHandler http.Handler)
RegisterInstance registers a new instance to the diagnostics server.
func (*DiagnosticsServer) ServeHTTP ¶
func (s *DiagnosticsServer) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP serves the diagnostics server.
func (*DiagnosticsServer) Start ¶
func (s *DiagnosticsServer) Start(ctx context.Context) error
Start starts the diagnostics server.
func (*DiagnosticsServer) UnregisterInstance ¶
func (s *DiagnosticsServer) UnregisterInstance(instanceID manager.ID)
UnregisterInstance unregisters an instance from the diagnostics server.
type DiagnosticsServerOption ¶
type DiagnosticsServerOption func(*DiagnosticsServer)
DiagnosticsServerOption is a functional option for configuring the DiagnosticsServer.
func WithPprofHandler ¶
func WithPprofHandler() DiagnosticsServerOption
WithPprofHandler is a functional option that enables pprof handlers for the DiagnosticsServer.
type InstanceNotFoundError ¶
type InstanceNotFoundError = instances.InstanceNotFoundError
InstanceNotFoundError is an error indicating that an instance with the given ID was not found in the manager. It can indicate that the instance was never scheduled or was stopped.
func NewInstanceNotFoundError ¶
func NewInstanceNotFoundError(id manager.ID) InstanceNotFoundError
NewInstanceNotFoundError creates a new InstanceNotFoundError for the given ID.
type InstanceWithIDAlreadyScheduledError ¶
type InstanceWithIDAlreadyScheduledError = instances.InstanceWithIDAlreadyScheduledError
InstanceWithIDAlreadyScheduledError is an error indicating that an instance with the same ID is already scheduled.
func NewInstanceWithIDAlreadyScheduledError ¶
func NewInstanceWithIDAlreadyScheduledError(id manager.ID) InstanceWithIDAlreadyScheduledError
NewInstanceWithIDAlreadyScheduledError creates a new InstanceWithIDAlreadyScheduledError for the given ID.
type Manager ¶
Manager is able to dynamically run multiple instances of manager.Manager and manage their lifecycle. The generic instance lifecycle lives in the embedded instances.Registry; this type only adds the Kong Ingress Controller specifics on top of it, i.e. registering instances' admission validators.
func NewManager ¶
func NewManager(logger logr.Logger, opts ...ManagerOption) *Manager
NewManager creates a new multi-instance manager.
func (*Manager) ScheduleInstance ¶
func (m *Manager) ScheduleInstance(in ManagerInstance) error
ScheduleInstance adds a new manager.Manager instance to the multi-instance manager and starts it immediately in a separate goroutine. If an instance with the same ID already exists, it returns a InstanceWithIDAlreadyScheduledError error.
type ManagerInstance ¶
type ManagerInstance interface {
ID() manager.ID
Run(context.Context) error
ConfigHash() (string, error)
IsReady() error
DiagnosticsHandler() http.Handler
KongValidator() admission.KongHTTPValidator
}
ManagerInstance is an interface that represents a single instance of a manager.Manager, exposing only the methods needed by the multi-instance manager.
type ManagerOption ¶
type ManagerOption func(*Manager)
ManagerOption is a functional option that can be used to configure a new multi-instance manager.
func WithDiagnosticsExposer ¶
func WithDiagnosticsExposer(exposer DiagnosticsExposer) ManagerOption
WithDiagnosticsExposer configures the multi-instance manager to register diagnostics handlers of manager.Manager instances.
func WithValidator ¶
func WithValidator(admissionReqHandler *admission.RequestHandler) ManagerOption
WithValidator configures the multi-instance manager to register KongHTTPValidators of manager.Manager instances.