healthcheck

package
v0.2.0-test.1 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package healthcheck is used for basic networking healthcheck.

Index

Constants

View Source
const (
	// NetHealthcheckFile is default path for healtcheck config file.
	NetHealthcheckFile = "/opt/network-operator/net-healthcheck-config.yaml"
	// NodenameEnv is an env variable that holds Kubernetes node's name.
	NodenameEnv = "NODE_NAME"
	// TaintKey is a node's CPI taint key that causes NoSchedule effect.
	//
	// TaintKey = "node.cloudprovider.kubernetes.io/uninitialized"
	// we need to use our own TaintKey as dual-stack is not supported
	// for external cloud-providers in kubernetes until 1.27.x.
	// ref: https://kubernetes.io/docs/concepts/services-networking/dual-stack/#configure-ipv4-ipv6-dual-stack
	TaintKey = "node.schiff.telekom.de/uninitialized"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FRRInterface

type FRRInterface interface {
	GetStatusFRR() (string, string, error)
}

type HealthChecker

type HealthChecker struct {
	logr.Logger
	// contains filtered or unexported fields
}

HealthChecker is a struct that holds data required for networking healthcheck.

func NewHealthChecker

func NewHealthChecker(clusterClient client.Client, toolkit *Toolkit, netconf *NetHealthcheckConfig) (*HealthChecker, error)

NewHealthChecker creates new HealthChecker.

func (*HealthChecker) CheckInterfaces

func (hc *HealthChecker) CheckInterfaces() error

CheckInterfaces checks if all interfaces in the Interfaces slice are in UP state.

func (*HealthChecker) CheckReachability

func (hc *HealthChecker) CheckReachability() error

CheckReachability checks if all hosts in Reachability slice are reachable.

func (*HealthChecker) IsFRRActive

func (hc *HealthChecker) IsFRRActive() (bool, error)

IsFRRActive checks if FRR daemon is in active and running state.

func (*HealthChecker) IsNetworkingHealthy

func (hc *HealthChecker) IsNetworkingHealthy() bool

IsNetworkingHealthy returns value of isNetworkingHealthly bool.

func (*HealthChecker) RemoveTaint

func (hc *HealthChecker) RemoveTaint(ctx context.Context, taintKey string) error

RemoveTaint removes taint from the node.

type NetHealthcheckConfig

type NetHealthcheckConfig struct {
	Interfaces   []string              `yaml:"interfaces,omitempty"`
	Reachability []netReachabilityItem `yaml:"reachability,omitempty"`
	Timeout      string                `yaml:"timeout,omitempty"`
	Retries      int                   `yaml:"retries,omitempty"`
}

NetHealthcheckConfig is a struct that holds healtcheck config.

func LoadConfig

func LoadConfig(configFile string) (*NetHealthcheckConfig, error)

LoadConfig loads healtcheck config from file.

type TCPDialerInterface

type TCPDialerInterface interface {
	Dial(network string, address string) (net.Conn, error)
}

func NewTCPDialer

func NewTCPDialer(dialerTimeout string) TCPDialerInterface

NewTCPDialer returns new tcpDialerInterface.

type Toolkit

type Toolkit struct {
	// contains filtered or unexported fields
}

Toolkit is a helper structure that holds interfaces and functions used by HealthChecker.

func NewDefaultHealthcheckToolkit

func NewDefaultHealthcheckToolkit(frr FRRInterface, tcpDialer TCPDialerInterface) *Toolkit

NewDefaultHealthcheckToolkit returns.

func NewHealthCheckToolkit

func NewHealthCheckToolkit(frr FRRInterface, linkByName func(name string) (netlink.Link, error), tcpDialer TCPDialerInterface) *Toolkit

NewHealthCheckToolkit returns new HealthCheckToolkit.

Directories

Path Synopsis
Package mock_healthcheck is a generated GoMock package.
Package mock_healthcheck is a generated GoMock package.

Jump to

Keyboard shortcuts

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