Documentation ¶
Overview ¶
Package rsm is a general component aims to hold role-based stateful workloads(such as databases). RSM stands for Replicated State Machine based on the truth that the workloads are solving state replication related problems.
The K8s native StatefulSet can handle stateful workloads well, but there are more works to do if the workload pods have roles(leader/follower in etcd, primary/secondary in PostgreSQL etc.).
RSM adds an abstract layer above StatefulSet, and provides: 1. role-based update strategy(Serial/Parallel/BestEffortParallel) 2. role-based access modes(ReadWrite/Readonly/None) 3. auto switchover 4. membership reconfiguration
Index ¶
- Variables
- func NewRSMPlanBuilder(ctx intctrlutil.RequestCtx, cli client.Client, req ctrl.Request) graph.PlanBuilder
- type EnqueueRequestForAncestor
- func (e *EnqueueRequestForAncestor) Create(evt event.CreateEvent, q workqueue.RateLimitingInterface)
- func (e *EnqueueRequestForAncestor) Delete(evt event.DeleteEvent, q workqueue.RateLimitingInterface)
- func (e *EnqueueRequestForAncestor) Generic(evt event.GenericEvent, q workqueue.RateLimitingInterface)
- func (e *EnqueueRequestForAncestor) InjectMapper(m meta.RESTMapper) error
- func (e *EnqueueRequestForAncestor) InjectScheme(s *runtime.Scheme) error
- func (e *EnqueueRequestForAncestor) Update(evt event.UpdateEvent, q workqueue.RateLimitingInterface)
- type FixMetaTransformer
- type MemberReconfigurationTransformer
- type ObjectDeletionTransformer
- type ObjectGenerationTransformer
- type ObjectStatusTransformer
- type Plan
- type PlanBuilder
- type PodRoleEventHandler
- type UpdateStrategyTransformer
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func NewRSMPlanBuilder ¶
func NewRSMPlanBuilder(ctx intctrlutil.RequestCtx, cli client.Client, req ctrl.Request) graph.PlanBuilder
NewRSMPlanBuilder returns a RSMPlanBuilder powered PlanBuilder
Types ¶
type EnqueueRequestForAncestor ¶
type EnqueueRequestForAncestor struct { // Client used to get owner object of Client roclient.ReadonlyClient // OwnerType is the type of the Owner object to look for in OwnerReferences. Only Group and Kind are compared. OwnerType runtime.Object // find event source up to UpToLevel UpToLevel int // InTypes specified the range to look for the ancestor, means all ancestors' type in the looking up tree should be in InTypes. // OwnerType will be included. // nil means only look for in OwnerType. InTypes []runtime.Object // contains filtered or unexported fields }
EnqueueRequestForAncestor enqueues Requests for the ancestor object. E.g. the ancestor object creates the StatefulSet/Deployment which then creates the Pod.
If a ReplicatedStateMachine creates Pods, users may reconcile the ReplicatedStateMachine in response to Pod Events using:
- a source.Kind Source with Type of Pod.
- a EnqueueRequestForAncestor EventHandler with an OwnerType of ReplicatedStateMachine and UpToLevel set to 2.
If source kind is corev1.Event, Event.InvolvedObject will be used as the source kind
func (*EnqueueRequestForAncestor) Create ¶
func (e *EnqueueRequestForAncestor) Create(evt event.CreateEvent, q workqueue.RateLimitingInterface)
Create implements EventHandler.
func (*EnqueueRequestForAncestor) Delete ¶
func (e *EnqueueRequestForAncestor) Delete(evt event.DeleteEvent, q workqueue.RateLimitingInterface)
Delete implements EventHandler.
func (*EnqueueRequestForAncestor) Generic ¶
func (e *EnqueueRequestForAncestor) Generic(evt event.GenericEvent, q workqueue.RateLimitingInterface)
Generic implements EventHandler.
func (*EnqueueRequestForAncestor) InjectMapper ¶
func (e *EnqueueRequestForAncestor) InjectMapper(m meta.RESTMapper) error
InjectMapper is called by the Controller to provide the rest mapper used by the manager.
func (*EnqueueRequestForAncestor) InjectScheme ¶
func (e *EnqueueRequestForAncestor) InjectScheme(s *runtime.Scheme) error
InjectScheme is called by the Controller to provide a singleton scheme to the EnqueueRequestForAncestor.
func (*EnqueueRequestForAncestor) Update ¶
func (e *EnqueueRequestForAncestor) Update(evt event.UpdateEvent, q workqueue.RateLimitingInterface)
Update implements EventHandler.
type FixMetaTransformer ¶
type FixMetaTransformer struct{}
func (*FixMetaTransformer) Transform ¶
func (t *FixMetaTransformer) Transform(ctx graph.TransformContext, dag *graph.DAG) error
type MemberReconfigurationTransformer ¶
type MemberReconfigurationTransformer struct{}
MemberReconfigurationTransformer handles member reconfiguration
func (*MemberReconfigurationTransformer) Transform ¶
func (t *MemberReconfigurationTransformer) Transform(ctx graph.TransformContext, dag *graph.DAG) error
type ObjectDeletionTransformer ¶
type ObjectDeletionTransformer struct{}
ObjectDeletionTransformer handles object and its secondary resources' deletion
func (*ObjectDeletionTransformer) Transform ¶
func (t *ObjectDeletionTransformer) Transform(ctx graph.TransformContext, dag *graph.DAG) error
type ObjectGenerationTransformer ¶
type ObjectGenerationTransformer struct{}
func (*ObjectGenerationTransformer) Transform ¶
func (t *ObjectGenerationTransformer) Transform(ctx graph.TransformContext, dag *graph.DAG) error
type ObjectStatusTransformer ¶
type ObjectStatusTransformer struct{}
ObjectStatusTransformer computes the current status: 1. read the underlying sts's status and copy them to the primary object's status 2. read pod role label and update the primary object's status role fields
func (*ObjectStatusTransformer) Transform ¶
func (t *ObjectStatusTransformer) Transform(ctx graph.TransformContext, dag *graph.DAG) error
type PlanBuilder ¶
type PlanBuilder struct {
// contains filtered or unexported fields
}
func (*PlanBuilder) AddParallelTransformer ¶
func (b *PlanBuilder) AddParallelTransformer(transformer ...graph.Transformer) graph.PlanBuilder
func (*PlanBuilder) AddTransformer ¶
func (b *PlanBuilder) AddTransformer(transformer ...graph.Transformer) graph.PlanBuilder
func (*PlanBuilder) Init ¶
func (b *PlanBuilder) Init() error
type PodRoleEventHandler ¶
type PodRoleEventHandler struct{}
func (*PodRoleEventHandler) Handle ¶
func (h *PodRoleEventHandler) Handle(cli client.Client, reqCtx intctrlutil.RequestCtx, recorder record.EventRecorder, event *corev1.Event) error
type UpdateStrategyTransformer ¶
type UpdateStrategyTransformer struct{}
func (*UpdateStrategyTransformer) Transform ¶
func (t *UpdateStrategyTransformer) Transform(ctx graph.TransformContext, dag *graph.DAG) error