Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockHealthHTTPServerFactory ¶
type MockHealthHTTPServerFactory struct {
// contains filtered or unexported fields
}
MockHealthHTTPServerFactory mocks the healthHTTPServerFactory interface
func NewMockHealthHTTPServerFactory ¶
func NewMockHealthHTTPServerFactory() *MockHealthHTTPServerFactory
NewMockHealthHTTPServerFactory creates a new health server factory for testing
func (*MockHealthHTTPServerFactory) ServiceByPort ¶
func (m *MockHealthHTTPServerFactory) ServiceByPort(port uint16) *Service
ServiceByPort returns the service for a given health check node port
type Service ¶
type Service struct { Service ServiceName `json:"service"` LocalEndpoints int `json:"localEndpoints"` }
Service represents the object returned by the health server
func NewService ¶
NewService creates a new service
type ServiceHealthServer ¶
type ServiceHealthServer struct {
// contains filtered or unexported fields
}
ServiceHealthServer manages HTTP health check ports. For each added service, it opens a HTTP server on the specified HealthCheckNodePort and either responds with 200 OK if there are local endpoints for the service, or with 503 Service Unavailable if the service does not have any local endpoints.
func New ¶
func New() *ServiceHealthServer
New creates a new health service server which services health checks by serving an HTTP endpoint for each service on the given HealthCheckNodePort.
func WithHealthHTTPServerFactory ¶
func WithHealthHTTPServerFactory(healthHTTPServerFactory healthHTTPServerFactory) *ServiceHealthServer
WithHealthHTTPServerFactory creates a new health server with a specific health server factory for testing purposes.
func (*ServiceHealthServer) DeleteService ¶
func (s *ServiceHealthServer) DeleteService(svcID lb.ID)
DeleteService stops the health server for the given service with 'svcID'. Access to this method is not synchronized. It is the caller's responsibility to ensure this method is called in a thread-safe manner.
func (*ServiceHealthServer) UpsertService ¶
func (s *ServiceHealthServer) UpsertService(svcID lb.ID, ns, name string, localEndpoints int, port uint16)
UpsertService inserts or updates a service health check server on 'port'. If 'port' is zero, the listener for the added service is stopped. Access to this method is not synchronized. It is the caller's responsibility to ensure this method is called in a thread-safe manner.
type ServiceName ¶
ServiceName is the name and namespace of the service