health

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2024 License: Apache-2.0 Imports: 17 Imported by: 5

Documentation

Index

Constants

View Source
const (
	AWSResourceTypeEBS    string = "ebs"
	AWSResourceTypeEC2    string = "ec2"
	AWSResourceTypeEKS    string = "eks"
	AWSResourceTypeELB    string = "elb"
	AWSResourceTypeRDS    string = "rds"
	AWSResourceTypeVPC    string = "vpc"
	AWSResourceTypeSubnet string = "subnet"
)
View Source
const (
	SecretKind                   = "Secret"
	ServiceKind                  = "Service"
	ServiceAccountKind           = "ServiceAccount"
	EndpointsKind                = "Endpoints"
	DeploymentKind               = "Deployment"
	ReplicaSetKind               = "ReplicaSet"
	StatefulSetKind              = "StatefulSet"
	DaemonSetKind                = "DaemonSet"
	IngressKind                  = "Ingress"
	JobKind                      = "Job"
	PersistentVolumeClaimKind    = "PersistentVolumeClaim"
	CustomResourceDefinitionKind = "CustomResourceDefinition"
	PodKind                      = "Pod"
	APIServiceKind               = "APIService"
	NamespaceKind                = "Namespace"
	HorizontalPodAutoscalerKind  = "HorizontalPodAutoscaler"
)

Variables

This section is empty.

Functions

func GetHealthCheckFunc

func GetHealthCheckFunc(gvk schema.GroupVersionKind) func(obj *unstructured.Unstructured) (*HealthStatus, error)

GetHealthCheckFunc returns built-in health check function or nil if health check is not supported

func IsPodAvailable

func IsPodAvailable(pod *corev1.Pod, minReadySeconds int32, now metav1.Time) bool

IsPodAvailable returns true if a pod is available; false otherwise. Precondition for an available pod is that it must be ready. On top of that, there are two cases when a pod can be considered available: 1. minReadySeconds == 0, or 2. LastTransitionTime (is set) + minReadySeconds < current time

func IsPodReady

func IsPodReady(pod *corev1.Pod) bool

IsPodReady returns true if a pod is ready; false otherwise.

func IsWorse

func IsWorse(current, new HealthStatusCode) bool

IsWorse returns whether or not the new health status code is a worse condition than the current

func MapAWSStatus added in v1.0.1

func MapAWSStatus(status string, resourceType string) string

MapAWSStatus maps an AWS resource's statuses to a Health Code

Types

type HealthOverride

type HealthOverride interface {
	GetResourceHealth(obj *unstructured.Unstructured) (*HealthStatus, error)
}

Implements custom health assessment that overrides built-in assessment

type HealthStatus

type HealthStatus struct {
	// Status holds the status code of the application or resource
	Status HealthStatusCode `json:"status,omitempty" protobuf:"bytes,1,opt,name=status"`
	// Message is a human-readable informational message describing the health status
	Message string `json:"message,omitempty" protobuf:"bytes,2,opt,name=message"`
}

func GetArgoWorkflowHealth added in v1.0.2

func GetArgoWorkflowHealth(obj *unstructured.Unstructured) (*HealthStatus, error)

func GetResourceHealth

func GetResourceHealth(obj *unstructured.Unstructured, healthOverride HealthOverride) (health *HealthStatus, err error)

GetResourceHealth returns the health of a k8s resource

type HealthStatusCode

type HealthStatusCode string

Represents resource health status

const (
	// Indicates that health assessment failed and actual health status is unknown
	HealthStatusUnknown HealthStatusCode = "Unknown"
	// Progressing health status means that resource is not healthy but still have a chance to reach healthy state
	HealthStatusProgressing HealthStatusCode = "Progressing"
	// Resource is 100% healthy
	HealthStatusHealthy HealthStatusCode = "Healthy"
	// Assigned to resources that are suspended or paused. The typical example is a
	// [suspended](https://kubernetes.io/docs/tasks/job/automated-tasks-with-cron-jobs/#suspend) CronJob.
	HealthStatusSuspended HealthStatusCode = "Suspended"
	// Degrade status is used if resource status indicates failure or resource could not reach healthy state
	// within some timeout.
	HealthStatusDegraded HealthStatusCode = "Degraded"
	// Indicates that resource is missing in the cluster.
	HealthStatusMissing HealthStatusCode = "Missing"

	HealthStatusCreating    HealthStatusCode = "Creating"
	HealthStatusDeleted     HealthStatusCode = "Deleted"
	HealthStatusDeleting    HealthStatusCode = "Deleting"
	HealthStatusError       HealthStatusCode = "Error"
	HealthStatusInaccesible HealthStatusCode = "Inaccesible"
	HealthStatusInfo        HealthStatusCode = "Info"
	HealthStatusPending     HealthStatusCode = "Pending"
	HealthStatusMaintenance HealthStatusCode = "Maintenance"
	HealthStatusScaling     HealthStatusCode = "Scaling"
	HealthStatusUnhealthy   HealthStatusCode = "Unhealthy"
	HealthStatusUpdating    HealthStatusCode = "Updating"
	HealthStatusWarning     HealthStatusCode = "Warning"
	HealthStatusStopped     HealthStatusCode = "Stopped"
	HealthStatusStopping    HealthStatusCode = "Stopping"
)

Jump to

Keyboard shortcuts

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