health

package
v1.92.1 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0, BSD-2-Clause, MIT, + 1 more Imports: 31 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckAPIServerAvailability

func CheckAPIServerAvailability(
	ctx context.Context,
	clock clock.Clock,
	log logr.Logger,
	condition gardencorev1beta1.Condition,
	restClient rest.Interface,
	conditioner conditionerFunc,
) gardencorev1beta1.Condition

CheckAPIServerAvailability checks if the API server of a cluster is reachable and measure the response time.

func CheckAPIService added in v1.20.0

func CheckAPIService(apiService *apiregistrationv1.APIService) error

CheckAPIService checks whether the given APIService is healthy. An APIService is considered healthy if it has the `Available` condition and its status is `True`.

func CheckAlertmanager added in v1.89.0

func CheckAlertmanager(alertManager *monitoringv1.Alertmanager) error

CheckAlertmanager checks whether the given Alertmanager is healthy.

func CheckBackupEntry added in v1.25.0

func CheckBackupEntry(obj client.Object) error

CheckBackupEntry checks if an backup entry object is healthy or not.

func CheckCertificate added in v1.91.0

func CheckCertificate(cert *certv1alpha1.Certificate) error

CheckCertificate checks whether the given certificate object is healthy.

func CheckCertificateIssuer added in v1.91.0

func CheckCertificateIssuer(issuer *certv1alpha1.Issuer) error

CheckCertificateIssuer checks whether the given issuer object is healthy.

func CheckCustomResourceDefinition added in v1.34.0

func CheckCustomResourceDefinition(crd *apiextensionsv1.CustomResourceDefinition) error

CheckCustomResourceDefinition checks whether the given CustomResourceDefinition is healthy. A CRD is considered healthy if its `NamesAccepted` and `Established` conditions are with status `True` and its `Terminating` condition is missing or has status `False`.

func CheckDaemonSet

func CheckDaemonSet(daemonSet *appsv1.DaemonSet) error

CheckDaemonSet checks whether the given DaemonSet is healthy. A DaemonSet is considered healthy if its controller observed its current revision and if its desired number of scheduled pods is equal to its updated number of scheduled pods.

func CheckDeployment

func CheckDeployment(deployment *appsv1.Deployment) error

CheckDeployment checks whether the given Deployment is healthy. A deployment is considered healthy if the controller observed its current revision and if the number of updated replicas is equal to the number of replicas.

func CheckEtcd added in v1.2.0

func CheckEtcd(etcd *druidv1alpha1.Etcd) error

CheckEtcd checks whether the given Etcd is healthy. An Etcd is considered healthy if its ready field in status is true and the BackupReady condition doesn't report false.

func CheckExtensionObject

func CheckExtensionObject(o client.Object) error

CheckExtensionObject checks if an extension Object is healthy or not. An extension object is healthy if * Its observed generation is up-to-date * No gardener.cloud/operation is set * No lastError is in the status * A last operation is state succeeded is present * gardener.cloud/timestamp annotation is not set or if its truncated value is not after last update time

func CheckJob added in v1.34.0

func CheckJob(job *batchv1.Job) error

CheckJob checks whether the given Job is healthy. A Job is considered healthy if its `JobFailed` condition is missing or has status `False`.

func CheckMachineDeployment

func CheckMachineDeployment(deployment *machinev1alpha1.MachineDeployment) error

CheckMachineDeployment checks whether the given MachineDeployment is healthy. A MachineDeployment is considered healthy if its controller observed its current revision and if its desired number of replicas is equal to its updated replicas.

func CheckManagedResource added in v1.13.0

func CheckManagedResource(mr *resourcesv1alpha1.ManagedResource) error

CheckManagedResource checks if all conditions of a ManagedResource ('ResourcesApplied' and 'ResourcesHealthy') are True and .status.observedGeneration matches the current .metadata.generation

func CheckManagedResourceApplied added in v1.34.0

func CheckManagedResourceApplied(mr *resourcesv1alpha1.ManagedResource) error

CheckManagedResourceApplied checks if the condition 'ResourcesApplied' of a ManagedResource is True and the .status.observedGeneration matches the current .metadata.generation

func CheckManagedResourceHealthy added in v1.34.0

func CheckManagedResourceHealthy(mr *resourcesv1alpha1.ManagedResource) error

CheckManagedResourceHealthy checks if the condition 'ResourcesHealthy' of a ManagedResource is True

func CheckManagedResourceProgressing added in v1.55.0

func CheckManagedResourceProgressing(mr *resourcesv1alpha1.ManagedResource) error

CheckManagedResourceProgressing checks if the condition ResourcesProgressing of a ManagedResource is False.

func CheckManagedSeed added in v1.18.0

func CheckManagedSeed(managedSeed *seedmanagementv1alpha1.ManagedSeed) error

CheckManagedSeed checks if the given ManagedSeed is up-to-date and if its Seed has been registered.

func CheckNode

func CheckNode(node *corev1.Node) error

CheckNode checks whether the given Node is healthy. A node is considered healthy if it has a `corev1.NodeReady` condition and this condition reports `corev1.ConditionTrue`.

func CheckPod added in v1.34.0

func CheckPod(pod *corev1.Pod) error

CheckPod checks whether the given Pod is healthy. A Pod is considered healthy if its `.status.phase` is `Running` or `Succeeded`.

func CheckPrometheus added in v1.89.0

func CheckPrometheus(prometheus *monitoringv1.Prometheus) error

CheckPrometheus checks whether the given Prometheus is healthy.

func CheckReplicaSet added in v1.34.0

func CheckReplicaSet(rs *appsv1.ReplicaSet) error

CheckReplicaSet checks whether the given ReplicaSet is healthy. A ReplicaSet is considered healthy if the controller observed its current revision and if the number of ready replicas is equal to the number of replicas.

func CheckReplicationController added in v1.34.0

func CheckReplicationController(rc *corev1.ReplicationController) error

CheckReplicationController checks whether the given ReplicationController is healthy. A ReplicationController is considered healthy if the controller observed its current revision and if the number of ready replicas is equal to the number of replicas.

func CheckSeed

func CheckSeed(seed *gardencorev1beta1.Seed, identity *gardencorev1beta1.Gardener) error

CheckSeed checks if the Seed is up-to-date and if its extensions have been successfully bootstrapped.

func CheckSeedForMigration added in v1.14.0

func CheckSeedForMigration(seed *gardencorev1beta1.Seed, identity *gardencorev1beta1.Gardener) error

CheckSeedForMigration checks if the Seed is up-to-date (comparing only the versions) and if its extensions have been successfully bootstrapped.

func CheckService added in v1.34.0

func CheckService(service *corev1.Service) error

CheckService checks whether the given service is healthy. A Service is considered unhealthy if it is of type `LoadBalancer` but doesn't have an ingress element in its status.

func CheckStatefulSet

func CheckStatefulSet(statefulSet *appsv1.StatefulSet) error

CheckStatefulSet checks whether the given StatefulSet is healthy. A StatefulSet is considered healthy if its controller observed its current revision, it is not in an update (i.e. UpdateRevision is empty) and if its current replicas are equal to its desired replicas.

func CheckVerticalPodAutoscaler added in v1.90.0

func CheckVerticalPodAutoscaler(vpa *vpaautoscalingv1.VerticalPodAutoscaler) error

CheckVerticalPodAutoscaler checks whether the given VPA is healthy.

func DeploymentHasExactNumberOfPods added in v1.80.0

func DeploymentHasExactNumberOfPods(ctx context.Context, reader client.Reader, deployment *appsv1.Deployment) (bool, error)

DeploymentHasExactNumberOfPods returns true when there are exactly as many pods as the .spec.replicas field of the deployment mandates.

func GetPodCondition

func GetPodCondition(status *corev1.PodStatus, conditionType corev1.PodConditionType) (int, *corev1.PodCondition)

GetPodCondition extracts the provided condition from the given status and returns that. Returns nil and -1 if the condition is not present, and the index of the located condition.

func GetPodReadyCondition

func GetPodReadyCondition(status corev1.PodStatus) *corev1.PodCondition

GetPodReadyCondition extracts the pod ready condition from the given status and returns that. Returns nil if the condition is not present.

func IsAlertmanagerProgressing added in v1.89.0

func IsAlertmanagerProgressing(alertManager *monitoringv1.Alertmanager) (bool, string)

IsAlertmanagerProgressing returns false if the Alertmanager has been fully rolled out. Otherwise, it returns true along with a reason, why the Alertmanager is not considered to be fully rolled out.

func IsCertificateIssuerProgressing added in v1.91.0

func IsCertificateIssuerProgressing(issuer *certv1alpha1.Issuer) (bool, string)

IsCertificateIssuerProgressing returns false if the Issuer's generation matches the observed generation.

func IsCertificateProgressing added in v1.91.0

func IsCertificateProgressing(cert *certv1alpha1.Certificate) (bool, string)

IsCertificateProgressing returns false if the Certificate's generation matches the observed generation.

func IsDaemonSetProgressing added in v1.47.0

func IsDaemonSetProgressing(daemonSet *appsv1.DaemonSet) (bool, string)

IsDaemonSetProgressing returns false if the DaemonSet has been fully rolled out. Otherwise, it returns true along with a reason, why the DaemonSet is not considered to be fully rolled out.

func IsDeploymentProgressing added in v1.47.0

func IsDeploymentProgressing(deployment *appsv1.Deployment) (bool, string)

IsDeploymentProgressing returns false if the Deployment has been fully rolled out. Otherwise, it returns true along with a reason, why the Deployment is not considered to be fully rolled out.

func IsDeploymentUpdated added in v1.48.0

func IsDeploymentUpdated(reader client.Reader, deployment *appsv1.Deployment) func(context.Context) (bool, error)

IsDeploymentUpdated returns a function which can be used for retry.Until. It checks if the deployment is fully updated, i.e. if it is no longer progressing, healthy, and has the exact number of desired replicas.

func IsPodReady

func IsPodReady(pod *corev1.Pod) bool

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

func IsPodReadyConditionTrue

func IsPodReadyConditionTrue(status corev1.PodStatus) bool

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

func IsPrometheusProgressing added in v1.89.0

func IsPrometheusProgressing(prometheus *monitoringv1.Prometheus) (bool, string)

IsPrometheusProgressing returns false if the Prometheus has been fully rolled out. Otherwise, it returns true along with a reason, why the Prometheus is not considered to be fully rolled out.

func IsStatefulSetProgressing added in v1.47.0

func IsStatefulSetProgressing(statefulSet *appsv1.StatefulSet) (bool, string)

IsStatefulSetProgressing returns false if the StatefulSet has been fully rolled out. Otherwise, it returns true along with a reason, why the StatefulSet is not considered to be fully rolled out.

Types

type Func added in v1.11.0

type Func func(client.Object) error

Func is a type for a function that checks the health of a runtime.Object.

func And added in v1.11.0

func And(fns ...Func) Func

And combines multiple health check funcs to a single func, checking all funcs sequentially and return the first error that occurs or nil if no error occurs.¬

func ExtensionOperationHasBeenUpdatedSince added in v1.11.0

func ExtensionOperationHasBeenUpdatedSince(lastUpdateTime metav1.Time) Func

ExtensionOperationHasBeenUpdatedSince returns a health check function that checks if an extension Object's last operation has been updated since `lastUpdateTime`.

func ObjectHasAnnotationWithValue added in v1.25.0

func ObjectHasAnnotationWithValue(key, value string) Func

ObjectHasAnnotationWithValue returns a health check function that checks if a given Object has an annotation with a specified value.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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