Documentation ¶
Index ¶
Constants ¶
View Source
const ( // ComponentPhaseTransition the event reason indicates that the component transits to a new phase. ComponentPhaseTransition = "ComponentPhaseTransition" // PodContainerFailedTimeout the timeout for container of pod failures, the component phase will be set to Failed/Abnormal after this time. PodContainerFailedTimeout = 10 * time.Second // PodScheduledFailedTimeout timeout for scheduling failure. PodScheduledFailedTimeout = 30 * time.Second )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Component ¶
type Component interface { GetName() string GetNamespace() string GetClusterName() string GetDefinitionName() string GetWorkloadType() appsv1alpha1.WorkloadType GetCluster() *appsv1alpha1.Cluster GetClusterVersion() *appsv1alpha1.ClusterVersion GetSynthesizedComponent() *component.SynthesizedComponent GetMatchingLabels() client.MatchingLabels GetReplicas() int32 GetConsensusSpec() *appsv1alpha1.ConsensusSetSpec GetPrimaryIndex() int32 GetPhase() appsv1alpha1.ClusterComponentPhase // GetBuiltObjects returns all objects that will be created by this component GetBuiltObjects(reqCtx intctrlutil.RequestCtx, cli client.Client) ([]client.Object, error) Create(reqCtx intctrlutil.RequestCtx, cli client.Client) error Delete(reqCtx intctrlutil.RequestCtx, cli client.Client) error Update(reqCtx intctrlutil.RequestCtx, cli client.Client) error Status(reqCtx intctrlutil.RequestCtx, cli client.Client) error Restart(reqCtx intctrlutil.RequestCtx, cli client.Client) error ExpandVolume(reqCtx intctrlutil.RequestCtx, cli client.Client) error HorizontalScale(reqCtx intctrlutil.RequestCtx, cli client.Client) error // TODO(impl): impl-related, replace them with component workload SetWorkload(obj client.Object, action *ictrltypes.LifecycleAction, parent *ictrltypes.LifecycleVertex) AddResource(obj client.Object, action *ictrltypes.LifecycleAction, parent *ictrltypes.LifecycleVertex) *ictrltypes.LifecycleVertex }
type ComponentSet ¶
type ComponentSet interface { SetComponent(component Component) // 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 // GetPhaseWhenPodsReadyAndProbeTimeout when the pods of component are ready but the probe timed-out, // calculate the component phase is Failed or Abnormal. GetPhaseWhenPodsReadyAndProbeTimeout(pods []*corev1.Pod) (appsv1alpha1.ClusterComponentPhase, appsv1alpha1.ComponentMessageMap) // 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, originPhaseIsUpRunning bool) (appsv1alpha1.ClusterComponentPhase, appsv1alpha1.ComponentMessageMap, error) HandleRestart(ctx context.Context, obj client.Object) ([]graph.Vertex, error) HandleRoleChange(ctx context.Context, obj client.Object) ([]graph.Vertex, error) HandleHA(ctx context.Context, obj client.Object) ([]graph.Vertex, error) }
type ComponentSetBase ¶
type ComponentSetBase struct { Cli client.Client Cluster *appsv1alpha1.Cluster ComponentSpec *appsv1alpha1.ClusterComponentSpec ComponentDef *appsv1alpha1.ClusterComponentDefinition Component Component }
ComponentSetBase is a common component set base struct.
type ComponentWorkload ¶
type ComponentWorkload interface{}
Click to show internal directories.
Click to hide internal directories.