actions

package
v1.3.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2021 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionFailure fsm.Event = fsm.NoOp
	ActionSuccess fsm.Event = "action_success"

	AllNodesUpgraded fsm.Event = "all_nodes_upgraded"
	AllRacksUpgraded fsm.Event = "all_racks_upgraded"

	BeginUpgrade           fsm.State = "begin_upgrade"
	CheckSchemaAgreement   fsm.State = "check_schema_agreement"
	CreateSystemBackup     fsm.State = "create_system_backup"
	FindNextRack           fsm.State = "find_next_rack"
	UpgradeImageInPodSpec  fsm.State = "upgrade_image_in_pod_spec"
	FindNextNode           fsm.State = "find_next_node"
	EnableMaintenanceMode  fsm.State = "enable_maintenance_mode"
	DrainNode              fsm.State = "drain_node"
	BackupData             fsm.State = "backup_data"
	DisableMaintenanceMode fsm.State = "disable_maintenance_mode"
	DeletePod              fsm.State = "delete_pod"
	ValidateUpgrade        fsm.State = "validate_upgrade"
	ClearDataBackup        fsm.State = "clear_data_backup"
	ClearSystemBackup      fsm.State = "clear_system_backup"
	RestoreUpgradeStrategy fsm.State = "restore_upgrade_strategy"
	FinishUpgrade          fsm.State = "finish_upgrade"
)
View Source
const (
	ClusterVersionUpgradeAction = "rack-version-upgrade"
)
View Source
const RackCreateAction = "rack-create"
View Source
const RackReplaceNodeAction = "rack-replace-node"
View Source
const RackScaleDownAction = "rack-scale-down"
View Source
const RackScaleUpAction = "rack-scale-up"
View Source
const (
	RackSynchronizedActionPrefix = "rack-synchronized-"
)
View Source
const (
	SidecarVersionUpgradeAction = "sidecar-upgrade"
)

Variables

View Source
var NewSessionFunc = func(hosts []string) (CQLSession, error) {
	cluster := gocql.NewCluster(hosts...)
	return gocqlx.WrapSession(cluster.CreateSession())
}
View Source
var ScyllaClientForClusterFunc = func(ctx context.Context, cc client.Client, hosts []string, logger log.Logger) (*scyllaclient.Client, error) {
	cfg := scyllaclient.DefaultConfig(hosts...)
	return scyllaclient.NewClient(cfg, logger)
}

Functions

func NewSidecarUpgrade added in v1.1.0

func NewSidecarUpgrade(c *scyllav1.ScyllaCluster, sidecar corev1.Container, l log.Logger) *rackSynchronizedAction

Types

type Action

type Action interface {
	// Name returns the action's name.
	// Useful for unit-testing.
	Name() string

	// Execute will execute the action using the
	// ClusterController to read and write the
	// state of the system.
	Execute(ctx context.Context, s *State) error
}

Action represents a discrete action that a scylla rack can take. This can be a rack creation,

type CQLSession added in v1.1.0

type CQLSession interface {
	AwaitSchemaAgreement(ctx context.Context) error
}

type ClusterVersionUpgrade

type ClusterVersionUpgrade struct {
	Cluster        *scyllav1.ScyllaCluster
	ScyllaClient   *scyllaclient.Client
	ClusterSession CQLSession
	// contains filtered or unexported fields
}

func NewClusterVersionUpgradeAction

func NewClusterVersionUpgradeAction(c *scyllav1.ScyllaCluster, l log.Logger) *ClusterVersionUpgrade

func (*ClusterVersionUpgrade) Execute

func (a *ClusterVersionUpgrade) Execute(ctx context.Context, s *State) error

TODO:(zimnx) Refactor patch version upgrade into rack_synchronized action.

func (*ClusterVersionUpgrade) Name

func (a *ClusterVersionUpgrade) Name() string

type RackCreate

type RackCreate struct {
	Rack          scyllav1.RackSpec
	Cluster       *scyllav1.ScyllaCluster
	OperatorImage string
}

func NewRackCreateAction

func NewRackCreateAction(r scyllav1.RackSpec, c *scyllav1.ScyllaCluster, image string) *RackCreate

func (*RackCreate) Execute

func (a *RackCreate) Execute(ctx context.Context, s *State) error

func (*RackCreate) Name

func (a *RackCreate) Name() string

type RackReplaceNode added in v1.0.0

type RackReplaceNode struct {
	Rack    scyllav1.RackSpec
	Cluster *scyllav1.ScyllaCluster
	Logger  log.Logger
}

func NewRackReplaceNodeAction added in v1.0.0

func NewRackReplaceNodeAction(r scyllav1.RackSpec, c *scyllav1.ScyllaCluster, l log.Logger) *RackReplaceNode

NewRackReplaceNodeAction returns action used for Scylla node replacement.

func (*RackReplaceNode) Execute added in v1.0.0

func (a *RackReplaceNode) Execute(ctx context.Context, s *State) error

Execute performs replace node operation. This action should be executed when at least one member service contain replace label. It will save IP address in Cluster status, delete PVC associated with Pod bound to marked member service which will release node affinity. Then Pod and member service itself will be deleted. Once StatefulSet controller creates new Pod and this Pod will enter ready state this action will cleanup replace label from member service, and replacement IP will be removed from Cluster status.

func (*RackReplaceNode) Name added in v1.0.0

func (a *RackReplaceNode) Name() string

Name returns name of the action.

type RackScaleDown

type RackScaleDown struct {
	Rack    scyllav1.RackSpec
	Cluster *scyllav1.ScyllaCluster
}

func (*RackScaleDown) Execute

func (a *RackScaleDown) Execute(ctx context.Context, s *State) error

func (*RackScaleDown) Name

func (a *RackScaleDown) Name() string

type RackScaleUp

type RackScaleUp struct {
	Rack    scyllav1.RackSpec
	Cluster *scyllav1.ScyllaCluster
}

func NewRackScaleUpAction

func NewRackScaleUpAction(r scyllav1.RackSpec, c *scyllav1.ScyllaCluster) *RackScaleUp

func (*RackScaleUp) Execute

func (a *RackScaleUp) Execute(ctx context.Context, s *State) error

func (*RackScaleUp) Name

func (a *RackScaleUp) Name() string

type SidecarUpgrade added in v1.1.0

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

func (*SidecarUpgrade) Name added in v1.1.0

func (a *SidecarUpgrade) Name() string

func (*SidecarUpgrade) RackUpdated added in v1.1.0

func (a *SidecarUpgrade) RackUpdated(sts *appsv1.StatefulSet) (bool, error)

func (*SidecarUpgrade) Update added in v1.1.0

func (a *SidecarUpgrade) Update(sts *appsv1.StatefulSet) error

type State

type State struct {
	// Dynamic client - uses caching for lookups
	client.Client
	// contains filtered or unexported fields
}

State contains tools to discover and modify the state of the world.

func NewState

func NewState(client client.Client, kubeclient kubernetes.Interface, recorder record.EventRecorder) *State

Jump to

Keyboard shortcuts

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