replication

package
v0.6.0-alpha.24 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultRole

func DefaultRole(i int32) string

DefaultRole is used to get the default role of the Pod of the Replication workload.

func HandleReplicationSetRoleChangeEvent

func HandleReplicationSetRoleChangeEvent(cli client.Client,
	reqCtx intctrlutil.RequestCtx,
	cluster *appsv1alpha1.Cluster,
	compName string,
	pod *corev1.Pod,
	newRole string) error

HandleReplicationSetRoleChangeEvent handles the role change event of the replication workload when switchPolicy is Noop.

func NewReplicationComponent

func NewReplicationComponent(cli client.Client,
	recorder record.EventRecorder,
	cluster *appsv1alpha1.Cluster,
	clusterVersion *appsv1alpha1.ClusterVersion,
	synthesizedComponent *component.SynthesizedComponent,
	dag *graph.DAG) *replicationComponent

Types

type ReplicationSet

type ReplicationSet struct {
	stateful.Stateful
}

ReplicationSet is a component object used by Cluster, ClusterComponentDefinition and ClusterComponentSpec

func (*ReplicationSet) GetPhaseWhenPodsNotReady

func (r *ReplicationSet) GetPhaseWhenPodsNotReady(ctx context.Context,
	componentName string,
	originPhaseIsUpRunning bool) (appsv1alpha1.ClusterComponentPhase, appsv1alpha1.ComponentMessageMap, error)

GetPhaseWhenPodsNotReady is the implementation of the type Component interface method, when the pods of replicationSet 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.

func (*ReplicationSet) GetPhaseWhenPodsReadyAndProbeTimeout

func (r *ReplicationSet) GetPhaseWhenPodsReadyAndProbeTimeout(pods []*corev1.Pod) (appsv1alpha1.ClusterComponentPhase, appsv1alpha1.ComponentMessageMap)

func (*ReplicationSet) HandleRestart

func (r *ReplicationSet) HandleRestart(ctx context.Context, obj client.Object) ([]graph.Vertex, error)

HandleRestart is the implementation of the type Component interface method, which is used to handle the restart of the Replication workload. TODO(xingran): handle the restart of the Replication workload with rolling update by Pod role.

func (*ReplicationSet) HandleRoleChange

func (r *ReplicationSet) HandleRoleChange(ctx context.Context, obj client.Object) ([]graph.Vertex, error)

HandleRoleChange is the implementation of the type Component interface method, which is used to handle the role change of the Replication workload.

func (*ReplicationSet) IsRunning

func (r *ReplicationSet) IsRunning(ctx context.Context, obj client.Object) (bool, error)

IsRunning is the implementation of the type Component interface method, which is used to check whether the replicationSet component is running normally.

func (*ReplicationSet) PodIsAvailable

func (r *ReplicationSet) PodIsAvailable(pod *corev1.Pod, minReadySeconds int32) bool

PodIsAvailable is the implementation of the type Component interface method, Check whether the status of a Pod of the replicationSet is ready, including the role label on the Pod

func (*ReplicationSet) PodsReady

func (r *ReplicationSet) PodsReady(ctx context.Context, obj client.Object) (bool, error)

PodsReady is the implementation of the type Component interface method, which is used to check whether all the pods of replicationSet component are ready.

Jump to

Keyboard shortcuts

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