goldpinger

package
v3.10.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GoldpingerConfig = struct {
	StaticFilePath   string  `long:"static-file-path" description:"Folder for serving static files" env:"STATIC_FILE_PATH"`
	ZapConfigPath    string  `long:"zap-config" description:"Path to zap config file" env:"ZAP_CONFIG" default:"/config/zap.json"`
	KubeConfigPath   string  `long:"kubeconfig" description:"Path to kubeconfig file" env:"KUBECONFIG"`
	RefreshInterval  int     `` /* 136-byte string literal not displayed */
	JitterFactor     float64 `long:"jitter-factor" description:"The amount of jitter to add while pinging clients" env:"JITTER_FACTOR" default:"0.05"`
	Hostname         string  `long:"hostname" description:"Hostname to use" env:"HOSTNAME"`
	PodIP            string  `long:"pod-ip" description:"Pod IP to use" env:"POD_IP"`
	PodName          string  `` /* 129-byte string literal not displayed */
	PingNumber       uint    `` /* 138-byte string literal not displayed */
	Port             int     `long:"client-port-override" description:"(for testing) use this port when calling other instances" env:"CLIENT_PORT_OVERRIDE"`
	UseHostIP        bool    `long:"use-host-ip" description:"When making the calls, use host ip (defaults to pod ip)" env:"USE_HOST_IP"`
	LabelSelector    string  `` /* 146-byte string literal not displayed */
	Namespace        *string `` /* 181-byte string literal not displayed */
	DisplayNodeName  bool    `long:"display-nodename" description:"Display nodename other than podname in UI (defaults is podname)." env:"DISPLAY_NODENAME"`
	KubernetesClient *kubernetes.Clientset

	DnsHosts    []string `long:"host-to-resolve" description:"A host to attempt dns resolve on (space delimited)" env:"HOSTS_TO_RESOLVE" env-delim:" "`
	TCPTargets  []string `` /* 165-byte string literal not displayed */
	HTTPTargets []string `` /* 209-byte string literal not displayed */

	IPVersions []string `` /* 151-byte string literal not displayed */

	// Timeouts
	PingTimeoutMs     int64         `` /* 153-byte string literal not displayed */
	CheckTimeoutMs    int64         `` /* 157-byte string literal not displayed */
	CheckAllTimeoutMs int64         `` /* 169-byte string literal not displayed */
	PingTimeout       time.Duration `long:"ping-timeout" description:"The timeout for a ping call to other goldpinger pods" env:"PING_TIMEOUT" default:"300ms"`
	CheckTimeout      time.Duration `long:"check-timeout" description:"The timeout for a check call to other goldpinger pods" env:"CHECK_TIMEOUT" default:"1000ms"`
	CheckAllTimeout   time.Duration `` /* 137-byte string literal not displayed */
	TCPCheckTimeout   time.Duration `` /* 138-byte string literal not displayed */
	DnsCheckTimeout   time.Duration `` /* 138-byte string literal not displayed */
	HTTPCheckTimeout  time.Duration `` /* 142-byte string literal not displayed */
}{}

GoldpingerConfig represents the configuration for goldpinger

View Source
var PodNamespace = getPodNamespace()

PodNamespace is the auto-detected namespace for this goldpinger pod

Functions

func CheckAllPods

func CheckAllPods(checkAllCtx context.Context, pods map[string]*GoldpingerPod) *models.CheckAllResults

CheckAllPods calls all neighbours and returns a detailed report

func CheckCluster added in v3.2.0

func CheckCluster(ctx context.Context) *models.ClusterHealthResults

CheckCluster does a CheckNeighboursNeighbours and analyses results to produce a binary OK or not OK

func CheckNeighbours

func CheckNeighbours(ctx context.Context) *models.CheckResults

CheckNeighbours queries the kubernetes API server for all other goldpinger pods then calls Ping() on each one

func CheckNeighboursNeighbours

func CheckNeighboursNeighbours(ctx context.Context) *models.CheckAllResults

CheckNeighboursNeighbours queries the kubernetes API server for all other goldpinger pods then calls Check() on each one

func CountCall

func CountCall(group string, call string)

counts various calls received and made

func CountDnsError

func CountDnsError(host string)

counts instances of dns errors

func CountError

func CountError(errorType string)

counts instances of various errors

func CountHealthyUnhealthyNodes

func CountHealthyUnhealthyNodes(healthy, unhealthy float64)

counts healthy and unhealthy nodes

func CountHttpError added in v3.6.0

func CountHttpError(host string)

CountHttpError counts instances of tcp errors for prober

func CountTcpError added in v3.6.0

func CountTcpError(host string)

CountTcpError counts instances of tcp errors for prober

func GetAllPods

func GetAllPods() map[string]*GoldpingerPod

GetAllPods returns a mapping from a pod name to a pointer to a GoldpingerPod(s)

func GetLabeledKubernetesCallsTimer

func GetLabeledKubernetesCallsTimer() *prometheus.Timer

returns a timer for easy observing of the durations of calls to kubernetes API

func GetLabeledPeersCallsTimer

func GetLabeledPeersCallsTimer(callType, hostIP, podIP string) *prometheus.Timer

returns a timer for easy observing of the duration of calls to peers

func GetStats

func GetStats(ctx context.Context) *models.PingResults

func HealthCheck

func HealthCheck() *models.HealthCheckResults

HealthCheck returns a simple 200 OK response to verify the API is up

func HeatmapHandler

func HeatmapHandler(w http.ResponseWriter, r *http.Request)

HeatmapHandler returns a PNG with a heatmap representation

func SelectPods

func SelectPods() map[string]*GoldpingerPod

SelectPods selects a set of pods from the results of GetAllPods depending on the count according to a rendezvous hash

func SetClusterHealth added in v3.2.0

func SetClusterHealth(healthy bool)

SetClusterHealth sets the cluster health gauge to 1 (healthy) or 0 (unhealthy)

func StartUpdater

func StartUpdater()

Types

type CheckServicePodsResult

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

CheckServicePodsResult results of the /check operation

type GoldpingerPod

type GoldpingerPod struct {
	Name   string // Name is the name of the pod
	PodIP  string // PodIP is the IP address of the pod
	HostIP string // HostIP is the IP address of the host where the pod lives
}

GoldpingerPod contains just the basic info needed to ping and keep track of a given goldpinger pod

type PingAllPodsResult

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

PingAllPodsResult holds results from pinging all nodes

type Pinger

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

Pinger contains all the info needed by a goroutine to continuously ping a pod

func NewPinger

func NewPinger(pod *GoldpingerPod, resultsChan chan<- PingAllPodsResult) *Pinger

NewPinger constructs and returns a Pinger object responsible for pinging a single goldpinger pod

func (*Pinger) Ping

func (p *Pinger) Ping()

Ping makes a single ping request to the given pod

func (*Pinger) PingContinuously

func (p *Pinger) PingContinuously(initialWait time.Duration, period time.Duration, jitterFactor float64)

PingContinuously continuously pings the given pod with a delay between `period` and `period + jitterFactor * period`

Jump to

Keyboard shortcuts

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