kubeobjects

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RequestsMapKeyedByName

func RequestsMapKeyedByName(requestsStruct Requests) map[string]Request

Types

type CaptureSpec

type CaptureSpec struct {
	//+optional
	Name string `json:"name,omitempty"`
	Spec `json:",inline"`
}

type Check

type Check struct {
	// Name of the check. Needs to be unique within the hook
	Name string `json:"name"`
	// The condition to check for
	Condition string `json:"condition,omitempty"`
	// How to handle when check does not become true. Defaults to Fail.
	OnError string `json:"onError,omitempty"`
	// How long to wait for the check to execute, in seconds
	Timeout int `json:"timeout,omitempty"`
}

type HookSpec

type HookSpec struct {
	Name           string                `json:"name"`
	Namespace      string                `json:"namespace"`
	Type           string                `json:"type"`
	SelectResource string                `json:"selectResource,omitempty"`
	LabelSelector  *metav1.LabelSelector `json:"labelSelector,omitempty"`
	NameSelector   string                `json:"nameSelector,omitempty"`
	SinglePodOnly  bool                  `json:"singlePodOnly,omitempty"`
	//+optional
	OnError string `json:"onError,omitempty"`

	//+optional
	Timeout   int   `json:"timeout,omitempty"`
	Essential *bool `json:"essential,omitempty"`

	// Flag to skip a Hook.
	SkipHookIfNotPresent bool `json:"skipHookIfNotPresent,omitempty"`

	Op Operation `json:"operation,omitempty"`

	Chk Check `json:"check,omitempty"`

	Scale ScaleSpec `json:"scale,omitempty"`

	Job JobSpec `json:"job,omitempty"`
}

HookSpec provides spec of either check, exec, scale, or job hook that needs to be executed

type JobSpec

type JobSpec struct {
	// Name of the job. Should be unique within the hook
	Name string `json:"name"`
	// How to handle job failure. Defaults to Fail.
	OnError string `json:"onError,omitempty"`
	// How long to wait for the job to complete, in seconds
	Timeout int `json:"timeout,omitempty"`
	// Name of another job that reverts the effect of this job (e.g. backup vs. restore)
	InverseOp string `json:"inverseOp,omitempty"`
	// Whether to create the Job or not if it already exists. Default to false.
	ForceCreate *bool `json:"forceCreate,omitempty"`
}

type KubeResourcesSpec

type KubeResourcesSpec struct {
	//+optional
	IncludedNamespaces []string `json:"includedNamespaces,omitempty"`
	//+optional
	IncludedResources []string `json:"includedResources,omitempty"`

	//+optional
	ExcludedResources []string `json:"excludedResources,omitempty"`

	//+optional
	Hook HookSpec `json:"hooks,omitempty"`

	//+optional
	IsHook bool `json:"isHook,omitempty"`

	//+optional
	GroupEssential *bool `json:"essential,omitempty"`
}

type Operation

type Operation struct {
	// Name of the operation. Needs to be unique within the hook
	Name string `json:"name"`
	// The container where the command should be executed
	Container string `json:"container,omitempty"`
	// The command to execute
	Command string `json:"command"`
	// How to handle command returning with non-zero exit code. Defaults to Fail.
	OnError string `json:"onError,omitempty"`
	// How long to wait for the command to execute, in seconds
	Timeout int `json:"timeout,omitempty"`
	// Name of another operation that reverts the effect of this operation (e.g. quiesce vs. unquiesce)
	InverseOp string `json:"inverseOp,omitempty"`
}

type ProtectRequest

type ProtectRequest interface{ Request }

type RecoverRequest

type RecoverRequest interface{ Request }

type RecoverSpec

type RecoverSpec struct {
	//+optional
	BackupName string `json:"backupName,omitempty"`
	Spec       `json:",inline"`
	//+optional
	NamespaceMapping map[string]string `json:"namespaceMapping,omitempty"`
	//+optional
	RestoreStatus *velero.RestoreStatusSpec `json:"restoreStatus,omitempty"`
	//+optional
	ExistingResourcePolicy velero.PolicyType `json:"existingResourcePolicy,omitempty"`
	//+optional
	// ResourceModifier specifies the ConfigMap reference for Velero resource modifier rules
	// applied during restore (e.g. static IP translation).
	ResourceModifier *corev1.TypedLocalObjectReference `json:"resourceModifier,omitempty"`
}

type Request

type Request interface {
	Object() client.Object
	Name() string
	StartTime() metav1.Time
	EndTime() metav1.Time
	Status(logr.Logger) error
	Deallocate(context.Context, client.Client, logr.Logger) error
}

type RequestProcessingError

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

func RequestProcessingErrorCreate

func RequestProcessingErrorCreate(s string) RequestProcessingError

func (RequestProcessingError) Error

func (e RequestProcessingError) Error() string

func (RequestProcessingError) Is

func (RequestProcessingError) Is(target error) bool

Called by errors.Is() to match target.

type Requests

type Requests interface {
	Count() int
	Get(i int) Request
}

type RequestsManager

type RequestsManager interface {
	ProtectsPath() string
	RecoversPath() string
	ProtectRequestNew() ProtectRequest
	RecoverRequestNew() RecoverRequest
	ProtectRequestCreate(
		c context.Context, w client.Client, l logr.Logger,
		s3Url string,
		s3BucketName string,
		s3RegionName string,
		s3KeyPrefix string,
		secretKeyRef *corev1.SecretKeySelector,
		caCertificates []byte,
		objectsSpec Spec,
		requestNamespaceName string,
		protectRequestName string,
		labels map[string]string,
		annotations map[string]string,
	) (ProtectRequest, error)
	RecoverRequestCreate(
		c context.Context, w client.Client, l logr.Logger,
		s3Url string,
		s3BucketName string,
		s3RegionName string,
		s3KeyPrefix string,
		secretKeyRef *corev1.SecretKeySelector,
		caCertificates []byte,
		recoverSpec RecoverSpec,
		requestNamespaceName string,
		protectRequestName string,
		protectRequest ProtectRequest,
		recoverRequestName string,
		labels map[string]string,
		annotations map[string]string,
	) (RecoverRequest, error)
	ProtectRequestsGet(
		c context.Context, r client.Reader, requestNamespaceName string, labels map[string]string,
	) (Requests, error)
	RecoverRequestsGet(
		c context.Context, r client.Reader, requestNamespaceName string, labels map[string]string,
	) (Requests, error)
	// ProtectRequestsDelete deletes Backup objects only; BSLs are kept alive for reuse
	// across capture cycles and cleaned up only via ProtectBSLsDelete on VRG deletion.
	ProtectRequestsDelete(c context.Context, w client.Writer, requestNamespaceName string, labels map[string]string) error
	RecoverRequestsDelete(c context.Context, w client.Writer, requestNamespaceName string, labels map[string]string) error
	// ProtectBSLsDelete deletes all BSLs owned by the VRG, called only on VRG deletion.
	ProtectBSLsDelete(c context.Context, w client.Writer, requestNamespaceName string, labels map[string]string) error
}

type ScaleSpec

type ScaleSpec struct {
	Operation string `json:"operation,omitempty"`
}

type Spec

type Spec struct {
	KubeResourcesSpec `json:",inline"`
	//+optional
	LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty"`

	//+optional
	OrLabelSelectors []*metav1.LabelSelector `json:"orLabelSelectors,omitempty"`

	//+optional
	IncludeClusterResources *bool `json:"includeClusterResources,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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