Documentation ¶
Overview ¶
Package handlers contains all functionality necessary to launch individual daemons
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseServiceHandler ¶
type BaseServiceHandler struct {
// contains filtered or unexported fields
}
BaseServiceHandler serves as a base type for all handlers in github.com/vs-eth/microkube/pkg/handlers, bundling common functions
func NewHandler ¶
func NewHandler(exit ExitHandler, healthCheckValidator HealthCheckValidatorFunction, healthCheckEndpoint string, stopHandler StopHandler, startHandler StartHandler, ca, client *pki.RSACertificate) *BaseServiceHandler
NewHandler creates a new helper handler. For detailed field descriptions, refer to the struct docs.
func (*BaseServiceHandler) EnableHealthChecks ¶
func (handler *BaseServiceHandler) EnableHealthChecks(messages chan HealthMessage, forever bool)
EnableHealthChecks enables health checks, see interface ServiceHandler.
func (*BaseServiceHandler) HandleExit ¶
func (handler *BaseServiceHandler) HandleExit(success bool, exitError *exec.ExitError)
HandleExit handles a process exit. Other handlers are expected to call this method on process exit
func (*BaseServiceHandler) Stop ¶
func (handler *BaseServiceHandler) Stop()
Stop stops the service. See interface ServiceHandler.
type ExecutionEnvironment ¶
type ExecutionEnvironment struct { // Binary contains the full path to the program to run Binary string // SudoMethod contains the binary to execute when running programs as root (sudo, pkexec, ...) SudoMethod string // Workdir contains a path where an application may store it's data Workdir string // ListenAddress is the address to bind exposed services to ListenAddress net.IP // ServiceAddress is the first address in the k8s service network, reserved for K8S API ServiceAddress net.IP // DNSAddress is the second address in the k8s service network, reserved for DNS DNSAddress net.IP // OutputHandler to pass command output to OutputHandler OutputHandler // ExitHandler to notify on command exit ExitHandler ExitHandler // Etcd client port EtcdClientPort int // Etcd peer port EtcdPeerPort int // Kubernetes API port KubeApiPort int // Kubernetes API server port for node communication KubeNodeApiPort int // Kubernetes ControllerManager port KubeControllerManagerPort int // Kubelet health endpoint port KubeletHealthPort int // Kube-proxy health endpoint port KubeProxyHealthPort int // Kube-proxy metrics endpoint port KubeProxyMetricsPort int // Kube-scheduler health endpoint port KubeSchedulerHealthPort int // Kube-scheduler metrics endpoint port KubeSchedulerMetricsPort int }
ExecutionEnvironment describes the environment to execute something in
func (*ExecutionEnvironment) CopyInformationFromBase ¶
func (e *ExecutionEnvironment) CopyInformationFromBase(o *ExecutionEnvironment)
CopyInformationFromBase copies all ports, all addresses and the sudo method from 'o' to this structure
func (*ExecutionEnvironment) InitPorts ¶
func (e *ExecutionEnvironment) InitPorts(base int)
InitPorts initializes the ports in 'e' starting from 'base'
type ExitHandler ¶
ExitHandler describes a function that is called when a process exits.
type HealthCheckValidatorFunction ¶
type HealthCheckValidatorFunction func(result *io.ReadCloser) error
HealthCheckValidatorFunction describes a function that get's called with the result of a health check to decode the result
type HealthMessage ¶
type HealthMessage struct { // Is this service healthy? IsHealthy bool // If the service isn't healthy, is there a specific reason as to why? Error error }
HealthMessage describes health check results from services
type OutputHandler ¶
type OutputHandler func(output []byte)
OutputHandler describes a function that is called whenever a process outputs something
type ServiceHandler ¶
type ServiceHandler interface { // Start starts this service. If no error is returned, you are responsible for stopping it Start() error // EnableHealthChecks enable health checks, either for one check (forever == false) or until the process is stopped. // Each health probe will write it's result to the channel provided EnableHealthChecks(messages chan HealthMessage, forever bool) // Stop stops this service and all associated goroutines (e.g. health checks). If it as already stopped, // this method does nothing. Stop() }
ServiceHandler handle some kind of running service. This interface is implemented by all service handlers below this package
type StartHandler ¶
type StartHandler func() error
StartHandler describes a function that get's called to start a process, possibly returing an error
type StopHandler ¶
type StopHandler func()
StopHandler describes a function that get's called to stop a process