types

package
v0.5.3-beta.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// RoleProbeTimeoutReason the event reason when all pods of the component role probe timed out.
	RoleProbeTimeoutReason = "RoleProbeTimeout"

	// PodContainerFailedTimeout the timeout for container of pod failures, the component phase will be set to Failed/Abnormal after this time.
	PodContainerFailedTimeout = time.Minute
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Component

type Component interface {
	// IsRunning when relevant k8s workloads changes, it checks whether the component is running.
	// you can also reconcile the pods of component till the component is Running here.
	IsRunning(ctx context.Context, obj client.Object) (bool, error)

	// PodsReady checks whether all pods of the component are ready.
	// it means the pods are available in StatefulSet or Deployment.
	PodsReady(ctx context.Context, obj client.Object) (bool, error)

	// PodIsAvailable checks whether a pod of the component is available.
	// if the component is Stateless/StatefulSet, the available conditions follows as:
	// 1. the pod is ready.
	// 2. readyTime reached minReadySeconds.
	// if the component is ConsensusSet,it will be available when the pod is ready and labeled with its role.
	PodIsAvailable(pod *corev1.Pod, minReadySeconds int32) bool

	// HandleProbeTimeoutWhenPodsReady if the component has no role probe, return false directly. otherwise,
	// we should handle the component phase when the role probe timeout and return a bool.
	// if return true, means probe is not timing out and need to requeue after an interval time to handle probe timeout again.
	// else return false, means probe has timed out and needs to update the component phase to Failed or Abnormal.
	HandleProbeTimeoutWhenPodsReady(ctx context.Context, recorder record.EventRecorder) (bool, error)

	// GetPhaseWhenPodsNotReady when the pods of component are not ready, calculate the component phase is Failed or Abnormal.
	// if return an empty phase, means the pods of component are ready and skips it.
	GetPhaseWhenPodsNotReady(ctx context.Context, componentName string) (appsv1alpha1.ClusterComponentPhase, error)

	// HandleUpdate handles component updating when basic workloads of the components are updated
	HandleUpdate(ctx context.Context, obj client.Object) error
}

Component is the interface to use for component status

type ComponentBase

type ComponentBase struct {
	Cli          client.Client
	Cluster      *appsv1alpha1.Cluster
	Component    *appsv1alpha1.ClusterComponentSpec
	ComponentDef *appsv1alpha1.ClusterComponentDefinition
}

ComponentBase is a common component base struct

Jump to

Keyboard shortcuts

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