types

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// MaxHealthScore is the max number of health score.
	MaxHealthScore = 100
	// OneQuarter is the fraction of one quarter.
	OneQuarter = 0.25
	// TwoQuarters is the fraction of two quarters.
	TwoQuarters = 0.5
	// ThreeQuarters is the fraction of three quarters.
	ThreeQuarters = 0.75
	// FourQuarters is the fraction of four quarters.
	FourQuarters = 1.0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type APIServerHealth

type APIServerHealth struct {
	// Score is a weighted score of apiserver health.
	Score int
}

APIServerHealth represents the health of apiserver in kubernetes cluster.

type ClusterHealth

type ClusterHealth struct {
	// Score is a weighted score of kubernetes cluster health.
	Score int
	// WorkloadHealth represents the health of workloads in kubernetes cluster.
	WorkloadHealth WorkloadHealth
	// NodeHealth represents the health of nodes in kubernetes cluster.
	NodeHealth NodeHealth
	// ControlPlaneComponentHealth represents the health of control plane components in kubernetes cluster.
	ControlPlaneComponentHealth ControlPlaneComponentHealth
	// NodeComponentHealth represents the health of node components in kubernetes cluster.
	NodeComponentHealth NodeComponentHealth
}

ClusterHealth represents the health of kubernetes cluster.

type ControlPlaneComponentHealth

type ControlPlaneComponentHealth struct {
	// Score is a weighted score of control plane component health.
	Score int
	// EtcdHealth represents the health of etcd in kubernetes cluster.
	EtcdHealth EtcdHealth
	// APIServerHealth represents the health of apiserver in kubernetes cluster.
	APIServerHealth APIServerHealth
	// ControllerManagerHealth represents the health of controller manager in kubernetes cluster.
	ControllerManagerHealth ControllerManagerHealth
	// SchedulerHealth represents the health of scheduler in kubernetes cluster.
	SchedulerHealth SchedulerHealth
}

ControlPlaneComponentHealth represents the health of control plane components.

type ControllerManagerHealth

type ControllerManagerHealth struct {
	// Score is a weighted score of controller manager health.
	Score int
}

ControllerManagerHealth represents the health of controller manager in kubernetes cluster.

type DaemonSetHealth

type DaemonSetHealth struct {
	// Score is a weighted score of daemonset health.
	Score int
	// Statistics contains information about healthy and unhealthy daemonsets.
	Statistics DaemonSetStatistics
}

DaemonSetHealth represents the health of daemonsets in kubernetes cluster.

type DaemonSetStatistics

type DaemonSetStatistics struct {
	// Total is the total number of daemonsets in kubernetes cluster.
	Total int
	// Healthy contains information about healthy daemonsets. The is one condition type of a healthy daemonset:
	//
	// AvailableAndScheduled: All pods of the daemonset are available and all pods are scheduled correctly.
	Healthy int
	// Unhealthy contains information about unhealthy daemonsets.
	Unhealthy UnhealthyDaemonSetStatistics
}

DaemonSetStatistics contains information about healthy and unhealthy daemonsets.

type DeploymentHealth

type DeploymentHealth struct {
	// Score is a weighted score of deployment health.
	Score int
	// Statistics contains information about healthy and unhealthy deployments.
	Statistics DeploymentStatistics
}

DeploymentHealth represents the health of deployments in kubernetes cluster.

type DeploymentStatistics

type DeploymentStatistics struct {
	// Total is the total number of deployments in kubernetes cluster.
	Total int
	// Healthy contains information about healthy deployments. The is one condition type of a healthy deployment:
	//
	// Available: All pods of the deployment are available.
	Healthy int
	// Unhealthy contains information about unhealthy deployments.
	Unhealthy UnhealthyDeploymentStatistics
}

DeploymentStatistics contains information about healthy and unhealthy deployments.

type EtcdHealth

type EtcdHealth struct {
	// Score is a weighted score of etcd health.
	Score int
}

EtcdHealth represents the health of etcd in kubernetes cluster.

type FileStatus

type FileStatus struct {
	// UID is the uid of a file.
	UID uint32 `json:"uid"`
	// GID is the gid of a file.
	GID uint32 `json:"gid"`
	// Inode represents inode number of a file.
	Inode uint64 `json:"inode"`
	// Links represents number of hard links of a file.
	Links uint64 `json:"links"`
	// Mode represents a file's mode and permission.
	Mode string `json:"mode"`
	// ModTime is the modification time of a file.
	ModTime time.Time `json:"modTime"`
	// DiskUsage is the disk usage of a file in bytes.
	DiskUsage int `json:"diskUsage"`
	// Path is the absolute path of a file.
	Path string `json:"path"`
}

FileStatus contains information of a file. See stat(2) linux manual page for more details:

https://man7.org/linux/man-pages/man2/stat.2.html

type FileStatusList

type FileStatusList struct {
	// FileStatus contains information of a specified file or directory.
	FileStatus `json:",inline"`
	// FileStatuses contains information of files under the specified directory.
	FileStatuses []FileStatus `json:"fileStatuses,omitempty"`
}

FileStatusList contains information of itself and all files it contains if it is a directory. The caller of sort.Interface must ensure FileStatuses is not nil. It satisfies sort.Interface by implemeting the following methods and comparing disk usage of files:

Len() int Less(i, j int) bool Swap(i, j int)

func (FileStatusList) Len

func (fl FileStatusList) Len() int

Len is the number of elements in FileStatusList.

func (FileStatusList) Less

func (fl FileStatusList) Less(i, j int) bool

Less reports whether the element with index i should sort before the element with index j.

func (FileStatusList) Swap

func (fl FileStatusList) Swap(i, j int)

Swap swaps the elements with indexes i and j.

type HealthyPodStatistics

type HealthyPodStatistics struct {
	// Ready is the number of pods in Running phase and all containers in the pod are ready.
	Ready int
	// Succeeded is the number of pods in Succeeded phase.
	Succeeded int
}

HealthyPodStatistics contains information about healthy pods. The are two types of healthy pods:

Ready: The pod is in Running phase and all containers in the pod are ready. Succeeded: The pod is in Succeeded phase.

type KubeProxyHealth

type KubeProxyHealth struct {
	// Score is a weighted score of kube proxy health.
	Score int
}

KubeProxyHealth represents the health of kube proxy in kubernetes cluster.

type KubeletHealth

type KubeletHealth struct {
	// Score is a weighted score of kubelet health.
	Score int
}

KubeletHealth represents the health of kubelet in kubernetes cluster.

type NodeComponentHealth

type NodeComponentHealth struct {
	// Score is a weighted score of node component health.
	Score int
	// KubeletHealth represents the health of kubelet in kubernetes cluster.
	KubeletHealth KubeletHealth
	// KubeProxyHealth represents the health of kube proxy in kubernetes cluster.
	KubeProxyHealth KubeProxyHealth
}

NodeComponentHealth represents the health of node components.

type NodeHealth

type NodeHealth struct {
	// Score is a weighted score of node health.
	Score int
	// Statistics contains information about healthy and unhealthy nodes.
	Statistics NodeStatistics
}

NodeHealth represents the health of nodes in kubernetes cluster.

type NodeStatistics

type NodeStatistics struct {
	// Total is the total number of nodes in kubernetes cluster.
	Total int
	// Healthy contains information about healthy nodes. The is one condition type of a healthy node:
	//
	// Ready: The node is in Ready condition.
	Healthy int
	// Unhealthy contains information about unhealthy nodes. The key is the first unhealthy condition type and
	// the value is the count of that condition type. The following are possible types of an unhealthy node:
	//
	// OutOfDisk: The node is in OutOfDisk condition.
	// MemoryPressure: The node is in MemoryPressure condition.
	// DiskPressure: The node is in DiskPressure condition.
	// PIDPressure: The node is in PIDPressure condition.
	// NetworkUnavailable: The node is in NetworkUnavailable condition.
	// Unknown: The node does not report any condition.
	Unhealthy map[corev1.NodeConditionType]int
}

NodeStatistics contains information about healthy and unhealthy nodes.

type PodDiskUsage

type PodDiskUsage struct {
	// ObjectMeta is metadata of the pod.
	metav1.ObjectMeta `json:"metadata"`
	// DiskUsage is the disk usage of the pod in bytes.
	DiskUsage int `json:"diskUsage"`
	// Path is the pod data path.
	Path string `json:"path"`
}

PodDiskUsage contains disk usage information of a pod.

type PodDiskUsageList

type PodDiskUsageList []PodDiskUsage

PodDiskUsageList contains disk usage information of pods. It satisfies sort.Interface by implemeting the following methods:

Len() int Less(i, j int) bool Swap(i, j int)

func (PodDiskUsageList) Len

func (pl PodDiskUsageList) Len() int

Len is the number of elements in PodDiskUsageList.

func (PodDiskUsageList) Less

func (pl PodDiskUsageList) Less(i, j int) bool

Less reports whether the element with index i should sort before the element with index j.

func (PodDiskUsageList) Swap

func (pl PodDiskUsageList) Swap(i, j int)

Swap swaps the elements with indexes i and j.

type PodHealth

type PodHealth struct {
	// Score is a weighted score of pod health.
	Score int
	// Statistics contains information about healthy and unhealthy pods.
	Statistics PodStatistics
}

PodHealth represents the health of pods in kubernetes cluster.

type PodStatistics

type PodStatistics struct {
	// Total is the total number of pods in kubernetes cluster.
	Total int
	// Healthy contains information about healthy pods.
	Healthy HealthyPodStatistics
	// Unhealthy contains information about unhealthy pods.
	Unhealthy UnhealthyPodStatistics
}

PodStatistics contains information about healthy and unhealthy pods.

type Process

type Process struct {
	// PID is process ID of the process.
	PID int32 `json:"pid"`
	// PPID is parent process ID of the process.
	PPID int32 `json:"ppid"`
	// TGID is thread Group ID of the process.
	TGID int32 `json:"tgid"`
	// Command contains a slice of the process command line arguments.
	Command []string `json:"command"`
	// Status is the process status.
	Status string `json:"status"`
	// CreateTime is created time of the process.
	CreateTime time.Time `json:"createTime"`
	// CPUPercent is percent of the CPU time this process uses.
	CPUPercent float64 `json:"cpuPercent"`
	// Nice is nice value of the process.
	Nice int32 `json:"nice"`
	// MemoryInfo contains memory information.
	MemoryInfo *psutil.MemoryInfoStat `json:"memoryInfo"`
}

Process contains information of a process.

type Property

type Property struct {
	// Name is the name of a property.
	Name string `json:"name"`
	// Value is the value of a property.
	Value string `json:"value"`
}

Property represents a property entry of unit, job or the manager itself.

func ParseProperties

func ParseProperties(buf *bytes.Buffer) ([]Property, error)

ParseProperties parses a "systemctl show" output to a property slice.

func SystemdUnitProperties

func SystemdUnitProperties(name string) ([]Property, error)

SystemdUnitProperties returns a slice which contains all properties of specified systemd unit. See systemctl(1) linux manual page for more details:

https://www.man7.org/linux/man-pages/man1/systemctl.1.html

type SchedulerHealth

type SchedulerHealth struct {
	// Score is a weighted score of scheduler health.
	Score int
}

SchedulerHealth represents the health of scheduler in kubernetes cluster.

type Signal

type Signal struct {
	// PID is process ID of the process.
	PID int `json:"pid"`
	// Signal is the signal to send.
	Signal syscall.Signal `json:"signal"`
}

Signal contains details to send a signal to a process.

type SignalList

type SignalList []Signal

SignalList contains details to send signals to processes.

type SortedDiagnosisListByStartTime

type SortedDiagnosisListByStartTime []diagnosisv1.Diagnosis

SortedDiagnosisListByStartTime contains sorted diagnoses by StartTime in ascending order. It satisfies sort.Interface by implemeting the following methods:

Len() int Less(i, j int) bool Swap(i, j int)

func (SortedDiagnosisListByStartTime) Len

Len is the number of elements in SortedDiagnosisListByStartTime.

func (SortedDiagnosisListByStartTime) Less

func (al SortedDiagnosisListByStartTime) Less(i, j int) bool

Less reports whether the element with index i should sort before the element with index j.

func (SortedDiagnosisListByStartTime) Swap

func (al SortedDiagnosisListByStartTime) Swap(i, j int)

Swap swaps the elements with indexes i and j.

type StatefulSetHealth

type StatefulSetHealth struct {
	// Score is a weighted score of statefulset health.
	Score int
	// Statistics contains information about healthy and unhealthy statefulsets.
	Statistics StatefulSetStatistics
}

StatefulSetHealth represents the health of statefulsets in kubernetes cluster.

type StatefulSetStatistics

type StatefulSetStatistics struct {
	// Total is the total number of statefulsets in kubernetes cluster.
	Total int
	// Healthy contains information about healthy statefulsets. The is one condition type of a healthy statefulset:
	//
	// Ready: All pods of the statefulset are ready.
	Healthy int
	// Unhealthy contains information about unhealthy statefulsets.
	Unhealthy UnhealthyStatefulSetStatistics
}

StatefulSetStatistics contains information about healthy and unhealthy statefulsets.

type UnhealthyDaemonSetStatistics

type UnhealthyDaemonSetStatistics struct {
	// OneQuarterAvailableAndScheduled is the number of daemonsets which the fraction of available and correctly
	// scheduled pods divided by desired pods is less than one quarter.
	OneQuarterAvailableAndScheduled int
	// TwoQuartersAvailableAndScheduled is the number of daemonsets which the fraction of available and correctly
	// scheduled pods divided by desired pods is less than two quarters and greater than or equal to one quarter.
	TwoQuartersAvailableAndScheduled int
	// ThreeQuartersAvailableAndScheduled is the number of daemonsets which the fraction of available and correctly
	// scheduled pods divided by desired pods is less than three quarters and greater than or equal to two quarters.
	ThreeQuartersAvailableAndScheduled int
	// FourQuartersAvailableAndScheduled is the number of daemonsets which the fraction of available and correctly
	// scheduled pods divided by desired pods is less than four quarters and greater than or equal to three quarters.
	FourQuartersAvailableAndScheduled int
}

UnhealthyDaemonSetStatistics contains information about unhealthy daemonsets. The are four types of unhealthy daemonsets:

OneQuarterAvailableAndScheduled: The fraction of available and correctly scheduled pods divided by desired pods is less than one quarter. TwoQuartersAvailableAndScheduled: The fraction of available and correctly scheduled pods divided by desired pods is less than two quarters and greater than or equal to one quarter. ThreeQuartersAvailableAndScheduled: The fraction of available and correctly scheduled pods divided by desired pods is less than three quarters and greater than or equal to two quarters. FourQuartersAvailableAndScheduled: The fraction of available and correctly scheduled pods divided by desired pods is less than four quarters and greater than or equal to three quarters.

type UnhealthyDeploymentStatistics

type UnhealthyDeploymentStatistics struct {
	// OneQuarterAvailable is the number of deployments which the fraction of available pods divided by
	// desired pods is less than one quarter.
	OneQuarterAvailable int
	// TwoQuartersAvailable is the number of deployments which the fraction of available pods divided by
	// desired pods is less than two quarters and greater than or equal to one quarter.
	TwoQuartersAvailable int
	// ThreeQuartersAvailable is the number of deployments which the fraction of available pods divided by
	// desired pods is less than three quarters and greater than or equal to two quarters.
	ThreeQuartersAvailable int
	// FourQuartersAvailable is the number of deployments which the fraction of available pods divided by
	// desired pods is less than four quarters and greater than or equal to three quarters.
	FourQuartersAvailable int
}

UnhealthyDeploymentStatistics contains information about unhealthy deployments. The are four types of unhealthy deployments:

OneQuarterAvailable: The fraction of available pods divided by desired pods is less than one quarter. TwoQuartersAvailable: The fraction of available pods divided by desired pods is less than two quarters and greater than or equal to one quarter. ThreeQuartersAvailable: The fraction of available pods divided by desired pods is less than three quarters and greater than or equal to two quarters. FourQuartersAvailable: The fraction of available pods divided by desired pods is less than four quarters and greater than or equal to three quarters.

type UnhealthyPodStatistics

type UnhealthyPodStatistics struct {
	// Unready is the number of pods in Running phase and some container in the pod is not ready.
	Unready int
	// Terminating is the number of pods in Running phase and has a DeletionTimestamp.
	Terminating int
	// Pending is the number of pods in Pending phase.
	Pending int
	// Failed is the number of pods in Failed phase.
	Failed int
	// Unknown is the number of pods in Unknown phase.
	Unknown int
	// ContainerStateReasons statisticizes reasons of unhealthy containers in pods. The key is the reason
	// of the first waiting or terminated container and the value is the count of that reason.
	// The following are possible reasons of a waiting or terminated container:
	//
	// CrashLoopBackOff
	// RunContainerError
	// KillContainerError
	// VerifyNonRootError
	// RunInitContainerError
	// CreatePodSandboxError
	// ConfigPodSandboxError
	// KillPodSandboxError
	// SetupNetworkError
	// TeardownNetworkError
	// OOMKilled
	// Error
	// ContainerCannotRun
	ContainerStateReasons map[string]int
}

UnhealthyPodStatistics contains information about unhealthy pods. The are five types of unhealthy pods:

Unready: The pod is in Running phase and some container in the pod is not ready. Terminating: The pod in Running phase and has a DeletionTimestamp. Pending: The pod is in Pending phase. Failed: The pod is in Failed phase. Unknown: The pod is in Unknown phase.

type UnhealthyStatefulSetStatistics

type UnhealthyStatefulSetStatistics struct {
	// OneQuarterReady is the number of statefulsets which the fraction of ready pods divided by
	// desired pods is less than one quarter.
	OneQuarterReady int
	// TwoQuartersReady is the number of statefulsets which the fraction of ready pods divided by
	// desired pods is less than two quarters and greater than or equal to one quarter.
	TwoQuartersReady int
	// ThreeQuartersReady is the number of statefulsets which the fraction of ready pods divided by
	// desired pods is less than three quarters and greater than or equal to two quarters.
	ThreeQuartersReady int
	// FourQuartersReady is the number of statefulsets which the fraction of ready pods divided by
	// desired pods is less than four quarters and greater than or equal to three quarters.
	FourQuartersReady int
}

UnhealthyStatefulSetStatistics contains information about unhealthy statefulsets. The are four types of unhealthy statefulsets:

OneQuarterReady: The fraction of ready pods divided by desired pods is less than one quarter. TwoQuartersReady: The fraction of ready pods divided by desired pods is less than two quarters and greater than or equal to one quarter. ThreeQuartersReady: The fraction of ready pods divided by desired pods is less than three quarters and greater than or equal to two quarters. FourQuartersReady: The fraction of ready pods divided by desired pods is less than four quarters and greater than or equal to three quarters.

type Unit

type Unit struct {
	// Name is the name of an unit, a job or the manager itself.
	Name string `json:"name"`
	// Properties is the property list of an unit, a job or the manager itself.
	Properties []Property `json:"properties"`
}

Unit represents an unit, a job or the manager itself. See systemctl(1) linux manual page for more details:

https://www.man7.org/linux/man-pages/man1/systemctl.1.html

type WorkloadHealth

type WorkloadHealth struct {
	// Score is a weighted score of workload health.
	Score int
	// PodHealth represents the health of pods in kubernetes cluster.
	PodHealth PodHealth
	// DeploymentHealth represents the health of deployments in kubernetes cluster.
	DeploymentHealth DeploymentHealth
	// StatefulSetHealth represents the health of statefulsets in kubernetes cluster.
	StatefulSetHealth StatefulSetHealth
	// DaemonSetHealth represents the health of daemonsets in kubernetes cluster.
	DaemonSetHealth DaemonSetHealth
}

WorkloadHealth represents the health of workloads in kubernetes cluster.

Jump to

Keyboard shortcuts

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