opscore

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ActionRegistry map[string]ActionHandler

ActionRegistry is a map of operationjob.spec.action to actionHandler

View Source
var EnablePodOpsLifecycleRegistry map[string]bool

EnablePodOpsLifecycleRegistry is a map of operationjob.spec.action to enablePodOpsLifecycle

Functions

func IsActionFinished added in v0.6.0

func IsActionFinished(actionProgress ActionProgress) bool

func IsCandidateOpsFinished

func IsCandidateOpsFinished(candidate *OpsCandidate) bool

func IsCandidateOpsPending

func IsCandidateOpsPending(candidate *OpsCandidate) bool

func IsCandidateServiceAvailable added in v0.6.0

func IsCandidateServiceAvailable(candidate *OpsCandidate) bool

func NewLifecycleAdapter

func NewLifecycleAdapter(ojName, lifecycleType string) podopslifecycle.LifecycleAdapter

func RegisterAction

func RegisterAction(action string, handler ActionHandler, enablePodOpsLifecycle bool)

RegisterAction will register an operationJob action with handler and lifecycleAdapter Note: if enablePodOpsLifecycle=false, this operation will be done directly, ignoring podOpsLifecycle

Types

type ActionHandler

type ActionHandler interface {
	// Setup sets up action with manager in AddToMgr, i.e., watch, cache...
	Setup(controller.Controller, *mixin.ReconcilerMixin) error

	// OperateTarget do real operation to target
	OperateTarget(context.Context, *OpsCandidate, *appsv1alpha1.OperationJob) error

	// GetOpsProgress returns target's current opsStatus, e.g., progress, reason, message
	GetOpsProgress(context.Context, *OpsCandidate, *appsv1alpha1.OperationJob) (progress ActionProgress, err error)

	// ReleaseTarget releases the target from operation when the operationJob is deleted
	ReleaseTarget(context.Context, *OpsCandidate, *appsv1alpha1.OperationJob) error
}

func GetActionResources

func GetActionResources(action string) (ActionHandler, bool)

type ActionProgress

type ActionProgress string
const (
	ActionProgressProcessing ActionProgress = "Processing"
	ActionProgressFailed     ActionProgress = "Failed"
	ActionProgressSucceeded  ActionProgress = "Succeeded"
)

type GenericLifecycleAdapter

type GenericLifecycleAdapter struct {
	ID   string
	Type podopslifecycle.OperationType
}

func (GenericLifecycleAdapter) AllowMultiType

func (g GenericLifecycleAdapter) AllowMultiType() bool

func (GenericLifecycleAdapter) GetID

func (g GenericLifecycleAdapter) GetID() string

func (GenericLifecycleAdapter) GetType

func (GenericLifecycleAdapter) WhenBegin

func (g GenericLifecycleAdapter) WhenBegin(_ client.Object) (bool, error)

func (GenericLifecycleAdapter) WhenFinish

func (g GenericLifecycleAdapter) WhenFinish(_ client.Object) (bool, error)

type OpsCandidate

type OpsCandidate struct {
	*corev1.Pod
	PodName    string
	Containers []string
	OpsStatus  *appsv1alpha1.OpsStatus
}

func DecideCandidateByPartition

func DecideCandidateByPartition(instance *appsv1alpha1.OperationJob, candidates []*OpsCandidate) []*OpsCandidate

Jump to

Keyboard shortcuts

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