server

package
v1.6.6 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2020 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// PortToPaths is a convenience map for access to the ports and their
	// common string representations
	PortToPaths = map[int]string{
		defaults.HTTPPathPort: "Via L3",
	}
)

Functions

func NewGetHealthzHandler

func NewGetHealthzHandler(s *Server) GetHealthzHandler

NewGetHealthzHandler handles health requests.

func NewGetStatusHandler

func NewGetStatusHandler(s *Server) GetStatusHandler

NewGetStatusHandler handles requests for cached connectivity status.

func NewHealthNode

func NewHealthNode(elem *models.NodeElement) healthNode

NewHealthNode creates a new node structure based on the specified model.

func NewPutStatusProbeHandler

func NewPutStatusProbeHandler(s *Server) PutStatusProbeHandler

NewPutStatusProbeHandler handles requests for connectivity probes.

Types

type Config

type Config struct {
	Debug         bool
	CiliumURI     string
	ProbeInterval time.Duration
	ProbeDeadline time.Duration
}

Config stores the configuration data for a cilium-health server.

type Server

type Server struct {
	healthApi.Server  // Server to provide cilium-health API
	*ciliumPkg.Client // Client to "GET /healthz" on cilium daemon
	Config

	// The lock protects against read and write access to the IP->Node map,
	// the list of statuses as most recently seen, and the last time a
	// probe was conducted.
	lock.RWMutex
	// contains filtered or unexported fields
}

Server is the cilium-health daemon that is in charge of performing health and connectivity checks periodically, and serving the cilium-health API.

func NewServer

func NewServer(config Config) (*Server, error)

NewServer creates a server to handle health requests.

func (*Server) DumpUptime

func (s *Server) DumpUptime() string

DumpUptime returns the time that this server has been running.

func (*Server) FetchStatusResponse

func (s *Server) FetchStatusResponse() (*healthModels.HealthStatusResponse, error)

FetchStatusResponse updates the cluster with the latest set of nodes, runs a synchronous probe across the cluster, updates the connectivity cache and returns the results.

func (*Server) GetStatusResponse

func (s *Server) GetStatusResponse() *healthModels.HealthStatusResponse

GetStatusResponse returns the most recent cluster connectivity status.

func (*Server) Serve

func (s *Server) Serve() (err error)

Serve spins up the following goroutines:

  • TCP API Server: Responders to the health API "/hello" message, one per path
  • Prober: Periodically run pings across the cluster at a configured interval and update the server's connectivity status cache.
  • Unix API Server: Handle all health API requests over a unix socket.

Callers should first defer the Server.Shutdown(), then call Serve().

func (*Server) Shutdown

func (s *Server) Shutdown()

Shutdown server and clean up resources

Jump to

Keyboard shortcuts

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