healthserver

package
v1.10.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 11, 2022 License: Apache-2.0 Imports: 13 Imported by: 1

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

func NewService(ns, name string, localEndpoints int) *Service

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

type ServiceName struct {
	Namespace string `json:"namespace"`
	Name      string `json:"name"`
}

ServiceName is the name and namespace of the service

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL