rsm

package
v0.6.0-beta.26 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2023 License: AGPL-3.0 Imports: 40 Imported by: 0

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

Constants

This section is empty.

Variables

View Source
var (
	ErrContinue error
	ErrWait     = errors.New("wait")
	ErrStop     = errors.New("stop")
)

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

Create implements EventHandler.

func (*EnqueueRequestForAncestor) Delete

Delete implements EventHandler.

func (*EnqueueRequestForAncestor) Generic

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

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

type ObjectDeletionTransformer

type ObjectDeletionTransformer struct{}

ObjectDeletionTransformer handles object and its secondary resources' deletion

func (*ObjectDeletionTransformer) Transform

type ObjectGenerationTransformer

type ObjectGenerationTransformer struct{}

func (*ObjectGenerationTransformer) Transform

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 Plan

type Plan struct {
	// contains filtered or unexported fields
}

func (*Plan) Execute

func (p *Plan) Execute() 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) Build

func (b *PlanBuilder) Build() (graph.Plan, error)

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

Jump to

Keyboard shortcuts

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