action

package
v0.9.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: AGPL-3.0 Imports: 22 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

	// 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

Jump to

Keyboard shortcuts

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