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 ¶
- func AddMemory(memFactor int, name string)
- func Dig(ip string) (string, error)
- func DigIPs(client *kubernetes.Clientset, dn string, mf int, IPs map[string][]string)
- func FindIPs(ns string, sn string, rep int, clnt *kubernetes.Clientset) map[string][]string
- func GetClient(pathToCfg string) (*kubernetes.Clientset, error)
- func GetMemory() resource.Quantity
- func GetPods(svc *v1.Service, namespace string, client *kubernetes.Clientset) (*v1.PodList, error)
- func GetService() (*v1.Service, error)
- func GetServiceByPort(port int32, client *kubernetes.Clientset) (*v1.Service, error)
- func InitDClient(client *kubernetes.Clientset, ns string)
- func IsOutOfMemory(ts []time.Time) bool
- func IsValidOutput(out string) bool
- func PodsReady() bool
- func RemedyPod(client *kubernetes.Clientset, namespace string, ts []time.Time, ips ...string)
- func RestartPod(pod v1.Pod)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddMemory ¶ added in v1.1.0
AddMemory multiplies the existing memory limit of deployment by memFactor
func Dig ¶
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 ¶
DigIPs performs queries on kubernetes service running on the default namespace using coreDNS pods and svcs
func FindIPs ¶
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
GetMemory returns the memory limit of the container in the pod specified by the name param
func GetPods ¶
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 ¶
GetService returns a Service struct using the given parameters
func GetServiceByPort ¶
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
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 ¶
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 RestartPod ¶
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.