health

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package health has functions that help with connecting to the api-server, looking up pods and services, performing dns queries on them and fixing failed deployments.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddMemory added in v1.1.0

func AddMemory(memFactor int, name string)

AddMemory multiplies the existing memory limit of deployment by memFactor

func Dig

func Dig(ip string) (string, error)

Dig calls the q executable with arg ip this functionality was not implemented in-line in main because we might change the working later depending on best practices.

func DigIPs

func DigIPs(client *kubernetes.Clientset, dn string, mf int, IPs map[string][]string)

DigIPs performs queries on kubernetes service running on the default namespace using coreDNS pods and svcs

func FindIPs

func FindIPs(ns string, sn string, rep int,
	clnt *kubernetes.Clientset) map[string][]string

FindIPs will return a map of IP addresses grouped by Service and Pods * These IP addresses will be used by the application when it's running inside the cluster We take both Service IPs and Pod IPs to be pinged because there it is possible that there are multiple point of failures. On top of that, individual pods can be remedied.

func GetClient

func GetClient(pathToCfg string) (*kubernetes.Clientset, error)

GetClient returns a clientset and initializes the metrics client

func GetMemory added in v1.1.0

func GetMemory() resource.Quantity

GetMemory returns the memory limit of the container in the pod specified by the name param

func GetPods

func GetPods(svc *v1.Service, namespace string,
	client *kubernetes.Clientset) (*v1.PodList, error)

GetPods will return a PodList of the pods served by the service svc Possible package name: pods. so that func call becomes pods.GetByService and pods.GetByIP (which can be used by pods.Restart())

func GetService

func GetService() (*v1.Service, error)

GetService returns a Service struct using the given parameters

func GetServiceByPort

func GetServiceByPort(port int32,
	client *kubernetes.Clientset) (*v1.Service, error)

GetServiceByPort uses the port in the params to find external services exposing that port.

func InitDClient added in v1.1.0

func InitDClient(client *kubernetes.Clientset, ns string)

InitDClient initializes the deployment client for future use.

func IsOutOfMemory added in v1.1.0

func IsOutOfMemory(ts []time.Time) bool

IsOutOfMemory checks the timestamp array of Pod restarts to figure out if the pods are running out of memory. If the restart times are too frequent we can assume that further restarts won't be helpful and so it is a memory issue.

func IsValidOutput

func IsValidOutput(out string) bool

IsValidOutput checks the output string to determine if the output is a valid DNS response

func PodsReady added in v1.1.0

func PodsReady() bool

PodsReady checks if the new pods created after the remedial action are up and running

func RemedyPod added in v1.1.0

func RemedyPod(client *kubernetes.Clientset, namespace string, ts []time.Time, ips ...string)

RemedyPod chooses the right way to bring failed pods back to life

func RestartPod

func RestartPod(pod v1.Pod)

RestartPod restarts the coredns pods. For this purpose, we only need to delete the pods; The deployment controller will create new pods automatically

Types

This section is empty.

Jump to

Keyboard shortcuts

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