Documentation ¶
Index ¶
- Constants
- func GetHealthCheckFunc(gvk schema.GroupVersionKind) func(obj *unstructured.Unstructured) (*HealthStatus, error)
- func GetStartDeadline(containers ...corev1.Container) time.Duration
- func HumanCase(s string) string
- func IsContainerStarting(creation time.Time, containers ...corev1.Container) bool
- func IsPodAvailable(pod *corev1.Pod, minReadySeconds int32, now metav1.Time) bool
- func IsPodReady(pod *corev1.Pod) bool
- func IsValidHealth(s string) bool
- func IsWorse(current, new HealthStatusCode) bool
- func SetDefaultCertificateExpiryWarningPeriod(p time.Duration)
- type Condition
- type ContainerRecord
- type GenericStatus
- type Health
- type HealthOverride
- type HealthStatus
- func GetAWSResourceHealth(_, status string) (health HealthStatus)
- func GetArgoWorkflowHealth(obj *unstructured.Unstructured) (*HealthStatus, error)
- func GetCertificateHealth(obj *unstructured.Unstructured) (*HealthStatus, error)
- func GetCertificateRequestHealth(obj *unstructured.Unstructured) (*HealthStatus, error)
- func GetDefaultHealth(obj *unstructured.Unstructured) (*HealthStatus, error)
- func GetECSTaskHealth(obj map[string]any) (health HealthStatus)
- func GetHealth(obj *unstructured.Unstructured, statusMap StatusMap) (*HealthStatus, error)
- func GetHealthByConfigType(configType string, obj map[string]any, states ...string) HealthStatus
- func GetHealthFromStatus(k GenericStatus, statusMap StatusMap) (*HealthStatus, error)
- func GetHealthFromStatusName(status string, reasons ...string) (health HealthStatus)
- func GetMongoHealth(obj map[string]any) (health HealthStatus)
- func GetResourceHealth(obj *unstructured.Unstructured, healthOverride HealthOverride) (health *HealthStatus, err error)
- type HealthStatusCode
- type OnCondition
- type ReplicaStatus
- type StatusMap
Constants ¶
const ( SecretKind = "Secret" ServiceKind = "Service" ServiceAccountKind = "ServiceAccount" EndpointsKind = "Endpoints" DeploymentKind = "Deployment" ReplicaSetKind = "ReplicaSet" StatefulSetKind = "StatefulSet" DaemonSetKind = "DaemonSet" IngressKind = "Ingress" JobKind = "Job" CronJobKind = "CronJob" PersistentVolumeClaimKind = "PersistentVolumeClaim" CustomResourceDefinitionKind = "CustomResourceDefinition" PodKind = "Pod" APIServiceKind = "APIService" NamespaceKind = "Namespace" HorizontalPodAutoscalerKind = "HorizontalPodAutoscaler" )
const NoCondition = "none"
const PodStartingBufferPeriod = time.Minute * 10
duration after the creation of a replica set within which we never deem the it to be unhealthy.
const (
SyncStatusCodeSynced = "Synced"
)
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 GetStartDeadline ¶ added in v1.0.40
func IsContainerStarting ¶ added in v1.0.40
func IsPodAvailable ¶
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 ¶
IsPodReady returns true if a pod is ready; false otherwise.
func IsValidHealth ¶ added in v1.0.41
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 SetDefaultCertificateExpiryWarningPeriod ¶ added in v1.0.34
Types ¶
type Condition ¶ added in v1.0.3
type Condition struct { OnCondition `yaml:",inline" json:",inline"` OnFalse *OnCondition `yaml:"onFalse,omitempty" json:"onFalse,omitempty"` OnUnknown *OnCondition `yaml:"onUnknown,omitempty" json:"onUnknown,omitempty"` // Custom settings per reason Reasons map[string]OnCondition `yaml:"reasons,omitempty" json:"reasons,omitempty"` }
type ContainerRecord ¶ added in v1.0.20
type ContainerRecord struct { Spec corev1.Container Status corev1.ContainerStatus }
type GenericStatus ¶ added in v1.0.3
func GetGenericStatus ¶ added in v1.0.3
func GetGenericStatus(obj *unstructured.Unstructured) GenericStatus
func (GenericStatus) FindCondition ¶ added in v1.0.3
func (s GenericStatus) FindCondition(name string) metav1.Condition
func (GenericStatus) IsEqualInt ¶ added in v1.0.3
func (s GenericStatus) IsEqualInt(a, b string) bool
type HealthOverride ¶
type HealthOverride interface {
GetResourceHealth(obj *unstructured.Unstructured) (*HealthStatus, error)
}
Implements custom health assessment that overrides built-in assessment
var DefaultOverrides HealthOverride
type HealthStatus ¶
type HealthStatus struct { Ready bool `json:"ready"` Health Health `json:"health"` // 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"` // contains filtered or unexported fields }
func GetAWSResourceHealth ¶ added in v1.0.7
func GetAWSResourceHealth(_, status string) (health HealthStatus)
func GetArgoWorkflowHealth ¶ added in v1.0.2
func GetArgoWorkflowHealth(obj *unstructured.Unstructured) (*HealthStatus, error)
func GetCertificateHealth ¶ added in v1.0.14
func GetCertificateHealth(obj *unstructured.Unstructured) (*HealthStatus, error)
func GetCertificateRequestHealth ¶ added in v1.0.36
func GetCertificateRequestHealth(obj *unstructured.Unstructured) (*HealthStatus, error)
func GetDefaultHealth ¶ added in v1.0.3
func GetDefaultHealth(obj *unstructured.Unstructured) (*HealthStatus, error)
func GetECSTaskHealth ¶ added in v1.0.40
func GetECSTaskHealth(obj map[string]any) (health HealthStatus)
func GetHealth ¶ added in v1.0.3
func GetHealth(obj *unstructured.Unstructured, statusMap StatusMap) (*HealthStatus, error)
func GetHealthByConfigType ¶ added in v1.0.24
func GetHealthByConfigType(configType string, obj map[string]any, states ...string) HealthStatus
func GetHealthFromStatus ¶ added in v1.0.3
func GetHealthFromStatus(k GenericStatus, statusMap StatusMap) (*HealthStatus, error)
func GetHealthFromStatusName ¶ added in v1.0.40
func GetHealthFromStatusName(status string, reasons ...string) (health HealthStatus)
func GetMongoHealth ¶ added in v1.0.22
func GetMongoHealth(obj map[string]any) (health HealthStatus)
func GetResourceHealth ¶
func GetResourceHealth( obj *unstructured.Unstructured, healthOverride HealthOverride, ) (health *HealthStatus, err error)
GetResourceHealth returns the health of a k8s resource
func (*HealthStatus) AppendMessage ¶ added in v1.0.3
func (hs *HealthStatus) AppendMessage(msg string, args ...interface{})
func (*HealthStatus) PrependMessage ¶ added in v1.0.24
func (hs *HealthStatus) PrependMessage(msg string, args ...interface{})
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" HealthStatusEvicted HealthStatusCode = "Evicted" HealthStatusCompleted HealthStatusCode = "Completed" HealthStatusCrashLoopBackoff HealthStatusCode = "CrashLoopBackOff" HealthStatusCrashLoop HealthStatusCode = "CrashLoop" HealthStatusCrashed HealthStatusCode = "Crashed" HealthStatusCreating HealthStatusCode = "Creating" HealthStatusDeleted HealthStatusCode = "Deleted" HealthStatusDeleting HealthStatusCode = "Deleting" HealthStatusTerminating HealthStatusCode = "Terminating" HealthStatusError HealthStatusCode = "Error" HealthStatusRolloutFailed HealthStatusCode = "Rollout Failed" HealthStatusInaccesible HealthStatusCode = "Inaccessible" HealthStatusInfo HealthStatusCode = "Info" HealthStatusPending HealthStatusCode = "Pending" HealthStatusMaintenance HealthStatusCode = "Maintenance" HealthStatusScaling HealthStatusCode = "Scaling" HealthStatusRestart HealthStatusCode = "Restarting" HealthStatusStarting HealthStatusCode = "Starting" HealthStatusUnschedulable HealthStatusCode = "Unschedulable" HealthStatusUpgradeFailed HealthStatusCode = "UpgradeFailed" HealthStatusScalingUp HealthStatusCode = "Scaling Up" HealthStatusScaledToZero HealthStatusCode = "Scaled to Zero" HealthStatusScalingDown HealthStatusCode = "Scaling Down" HealthStatusRunning HealthStatusCode = "Running" HealthStatusRollingOut HealthStatusCode = "Rolling Out" HealthStatusUnhealthy HealthStatusCode = "Unhealthy" HealthStatusUpdating HealthStatusCode = "Updating" HealthStatusWarning HealthStatusCode = "Warning" HealthStatusStopped HealthStatusCode = "Stopped" HealthStatusStopping HealthStatusCode = "Stopping" )
type OnCondition ¶ added in v1.0.3
type OnCondition struct { // When 2 conditions are true, which one takes precedence from a status/message perspective Order int `yaml:"order,omitempty" json:"order,omitempty"` // If the condition matches, mark ready Ready bool `yaml:"ready" json:"ready"` // If the condition matches, mark not ready NotReady bool `json:"notReady" yaml:"notReady,omitempty"` // If the condition is true, use the conditions message Message bool `json:"message" yaml:"message"` Health Health `json:"health,omitempty" yaml:"health,omitempty"` Status HealthStatusCode `json:"status,omitempty" yaml:"status,omitempty"` }
func (*OnCondition) Apply ¶ added in v1.0.3
func (mapped *OnCondition) Apply(health *HealthStatus, c *metav1.Condition)
type ReplicaStatus ¶ added in v1.0.40
type ReplicaStatus struct { Object *unstructured.Unstructured Containers []corev1.Container }
func (ReplicaStatus) String ¶ added in v1.0.40
func (rs ReplicaStatus) String() string
Source Files ¶
- health.go
- health_apiservice.go
- health_argo.go
- health_aws.go
- health_aws_ecs.go
- health_cert_manager.go
- health_cronjob.go
- health_daemonset.go
- health_deployment.go
- health_hpa.go
- health_ingress.go
- health_job.go
- health_mongo.go
- health_namespace.go
- health_node.go
- health_pod.go
- health_pvc.go
- health_replicaset.go
- health_service.go
- health_statefulset.go
- status.go
- status_name.go
- utils.go