action

package
v0.9.1-beta.17 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 License: AGPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action interface {
	// Execute executes the action.
	Execute(actCtx ActionContext) (*dpv1alpha1.ActionStatus, error)

	// GetName returns the Name of the action.
	GetName() string

	// Type returns the type of the action.
	Type() dpv1alpha1.ActionType
}

type ActionContext added in v0.9.0

type ActionContext struct {
	Ctx      context.Context
	Client   client.Client
	Recorder record.EventRecorder

	Scheme           *runtime.Scheme
	RestClientConfig *rest.Config
}

type CreateVolumeSnapshotAction

type CreateVolumeSnapshotAction struct {
	// Name is the Name of the action.
	Name string

	TargetName string

	// the target pod index.
	Index int

	TargetPodName string

	// Owner is the owner of the volume snapshot.
	Owner client.Object

	// ObjectMeta is the metadata of the volume snapshot.
	ObjectMeta metav1.ObjectMeta

	// PersistentVolumeClaimWrappers is the list of persistent volume claims wrapper to snapshot.
	PersistentVolumeClaimWrappers []PersistentVolumeClaimWrapper
}

CreateVolumeSnapshotAction is an action that creates the volume snapshot.

func (*CreateVolumeSnapshotAction) Execute

func (*CreateVolumeSnapshotAction) GetName

func (c *CreateVolumeSnapshotAction) GetName() string

func (*CreateVolumeSnapshotAction) Type

type ErrorMode

type ErrorMode string
const (
	ErrorModeContinue ErrorMode = "Continue"
	ErrorModeFail     ErrorMode = "Fail"
)

type ExecAction

type ExecAction struct {
	JobAction

	// PodName is the Name of the pod to execute the command on.
	PodName string

	// Namespace is the Namespace of the pod to execute the command on.
	Namespace string

	// Command is the command to execute.
	Command []string

	// Container is the container to execute the command on.
	Container string

	// ServiceAccountName is the service account to use to build the job object.
	ServiceAccountName string

	// Timeout is the timeout for the command.
	Timeout metav1.Duration
}

ExecAction is an action that executes a command on a pod. This action will create a job to execute the command.

func (*ExecAction) Execute

type JobAction

type JobAction struct {
	// Name is the Name of the action.
	Name string

	// Owner is the owner of the job.
	Owner client.Object

	// ObjectMeta is the metadata of the job.
	ObjectMeta metav1.ObjectMeta

	PodSpec *corev1.PodSpec

	// BackOffLimit is the number of retries before considering a JobAction as failed.
	BackOffLimit *int32
}

JobAction is an action that creates a batch job.

func (*JobAction) Execute

func (j *JobAction) Execute(actCtx ActionContext) (*dpv1alpha1.ActionStatus, error)

func (*JobAction) GetName

func (j *JobAction) GetName() string

func (*JobAction) Type

func (j *JobAction) Type() dpv1alpha1.ActionType

type PersistentVolumeClaimWrapper

type PersistentVolumeClaimWrapper struct {
	VolumeName            string
	PersistentVolumeClaim corev1.PersistentVolumeClaim
}

func NewPersistentVolumeClaimWrapper

func NewPersistentVolumeClaimWrapper(pvc corev1.PersistentVolumeClaim, volumeName string) PersistentVolumeClaimWrapper

type StatefulSetAction added in v0.8.2

type StatefulSetAction struct {
	// Name is the Name of the action.
	Name string

	Backup *dpv1alpha1.Backup

	// ObjectMeta is the metadata of the volume snapshot.
	ObjectMeta metav1.ObjectMeta
	Replicas   *int32

	PodSpec *corev1.PodSpec

	ActionSet *dpv1alpha1.ActionSet
}

StatefulSetAction is an action that creates or updates the StatefulSet of Continuous backup.

func (*StatefulSetAction) Execute added in v0.8.2

func (s *StatefulSetAction) Execute(ctx ActionContext) (actionStatus *dpv1alpha1.ActionStatus, err error)

func (*StatefulSetAction) GetName added in v0.8.2

func (s *StatefulSetAction) GetName() string

func (*StatefulSetAction) Type added in v0.8.2

Jump to

Keyboard shortcuts

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