v1alpha1

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: Apache-2.0 Imports: 30 Imported by: 2

Documentation

Overview

+groupName=storage.kubestash.com

Package v1alpha1 contains API Schema definitions for the storage v1alpha1 API group +kubebuilder:object:generate=true +groupName=storage.kubestash.com

Index

Constants

View Source
const (
	ResourceKindBackupStorage     = "BackupStorage"
	ResourceSingularBackupStorage = "backupstorage"
	ResourcePluralBackupStorage   = "backupstorages"

	BackupStorageReady    BackupStoragePhase = "Ready"
	BackupStorageNotReady BackupStoragePhase = "NotReady"
)
View Source
const (
	TypeBackendInitialized               = "BackendInitialized"
	ReasonBackendInitializationSucceeded = "BackendInitializationSucceeded"
	ReasonBackendInitializationFailed    = "BackendInitializationFailed"

	TypeBackendSecretFound          = "BackendSecretFound"
	ReasonBackendSecretNotAvailable = "BackendSecretNotAvailable"
	ReasonBackendSecretAvailable    = "BackendSecretAvailable"
)
View Source
const (
	ResourceKindRepository     = "Repository"
	ResourceSingularRepository = "repository"
	ResourcePluralRepository   = "repositories"
)
View Source
const (
	TypeRepositoryInitialized               = "RepositoryInitialized"
	ReasonRepositoryInitializationSucceeded = "RepositoryInitializationSucceeded"
	ReasonRepositoryInitializationFailed    = "RepositoryInitializationFailed"
)
View Source
const (
	ResourceKindRetentionPolicy     = "RetentionPolicy"
	ResourceSingularRetentionPolicy = "retentionpolicy"
	ResourcePluralRetentionPolicy   = "retentionpolicies"
)
View Source
const (
	ResourceKindSnapshot     = "Snapshot"
	ResourceSingularSnapshot = "snapshot"
	ResourcePluralSnapshot   = "snapshots"

	BackupTypeFull        BackupType = "FullBackup"
	BackupTypeIncremental BackupType = "IncrementalBackup"
)
View Source
const (
	TypeSnapshotMetadataUploaded               = "SnapshotMetadataUploaded"
	ReasonFailedToUploadSnapshotMetadata       = "FailedToUploadSnapshotMetadata"
	ReasonSuccessfullyUploadedSnapshotMetadata = "SuccessfullyUploadedSnapshotMetadata"

	TypeRecentSnapshotListUpdated               = "RecentSnapshotListUpdated"
	ReasonFailedToUpdateRecentSnapshotList      = "FailedToUpdateRecentSnapshotList"
	ReasonSuccessfullyUpdatedRecentSnapshotList = "SuccessfullyUpdatedRecentSnapshotList"
)

Variables

View Source
var (
	// GroupVersion is group version used to register these objects
	GroupVersion = schema.GroupVersion{Group: "storage.kubestash.com", Version: "v1alpha1"}

	// SchemeBuilder is used to add go types to the GroupVersionKind scheme
	SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

	// AddToScheme adds the types in this group-version to the given scheme.
	AddToScheme = SchemeBuilder.AddToScheme
)

Functions

func ConvertSizeToByte added in v0.2.0

func ConvertSizeToByte(sizeWithUnit []string) (uint64, error)

func FormatBytes added in v0.2.0

func FormatBytes(c uint64) string

func GenerateSnapshotName

func GenerateSnapshotName(repoName, backupSession string) string

Types

type AzureSpec

type AzureSpec struct {
	// StorageAccount specifies the name of the Azure Storage Account
	StorageAccount string `json:"storageAccount,omitempty"`

	// Container specifies the name of the Azure Blob container that will be used as storage backend.
	Container string `json:"container,omitempty"`

	// Prefix specifies a directory inside the bucket/container where the data for this backend will be stored.
	Prefix string `json:"prefix,omitempty"`

	// MaxConnections specifies the maximum number of concurrent connections to use to upload/download data to this backend.
	// +optional
	MaxConnections int64 `json:"maxConnections,omitempty"`

	// SecretName specifies the name of the Secret that contains the access credential for this storage.
	// +optional
	SecretName string `json:"secretName,omitempty"`
}

func (*AzureSpec) DeepCopy

func (in *AzureSpec) DeepCopy() *AzureSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AzureSpec.

func (*AzureSpec) DeepCopyInto

func (in *AzureSpec) DeepCopyInto(out *AzureSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Backend

type Backend struct {
	// Provider specifies the provider of the storage
	Provider StorageProvider `json:"provider,omitempty"`

	// Local specifies the storage information for local provider
	// +optional
	Local *LocalSpec `json:"local,omitempty"`

	// S3 specifies the storage information for AWS S3 and S3 compatible storage.
	// +optional
	S3 *S3Spec `json:"s3,omitempty"`

	// GCS specifies the storage information for GCS bucket
	// +optional
	GCS *GCSSpec `json:"gcs,omitempty"`

	// Azure specifies the storage information for Azure Blob container
	// +optional
	Azure *AzureSpec `json:"azure,omitempty"`
}

func (*Backend) DeepCopy

func (in *Backend) DeepCopy() *Backend

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Backend.

func (*Backend) DeepCopyInto

func (in *Backend) DeepCopyInto(out *Backend)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type BackupStorage

type BackupStorage struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   BackupStorageSpec   `json:"spec,omitempty"`
	Status BackupStorageStatus `json:"status,omitempty"`
}

BackupStorage specifies the backend information where the backed up data of different applications will be stored. You can consider BackupStorage as a representation of a bucket in Kubernetes native way. This is a namespaced object. However, you can use the BackupStorage from any namespace as long as it is permitted by the `.spec.usagePolicy` field.

func (*BackupStorage) CalculatePhase

func (b *BackupStorage) CalculatePhase() BackupStoragePhase

func (BackupStorage) CustomResourceDefinition

func (_ BackupStorage) CustomResourceDefinition() *apiextensions.CustomResourceDefinition

func (*BackupStorage) DeepCopy

func (in *BackupStorage) DeepCopy() *BackupStorage

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupStorage.

func (*BackupStorage) DeepCopyInto

func (in *BackupStorage) DeepCopyInto(out *BackupStorage)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*BackupStorage) DeepCopyObject

func (in *BackupStorage) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*BackupStorage) Default

func (r *BackupStorage) Default()

Default implements webhook.Defaulter so a webhook will be registered for the type

func (*BackupStorage) LocalNetworkVolume added in v0.2.0

func (b *BackupStorage) LocalNetworkVolume() bool

func (*BackupStorage) LocalProvider added in v0.2.0

func (b *BackupStorage) LocalProvider() bool

func (*BackupStorage) OffshootLabels added in v0.2.0

func (b *BackupStorage) OffshootLabels() map[string]string

func (*BackupStorage) SetupWebhookWithManager

func (r *BackupStorage) SetupWebhookWithManager(mgr ctrl.Manager) error

func (*BackupStorage) UsageAllowed

func (b *BackupStorage) UsageAllowed(srcNamespace *core.Namespace) bool

func (*BackupStorage) ValidateCreate

func (r *BackupStorage) ValidateCreate() (admission.Warnings, error)

ValidateCreate implements webhook.Validator so a webhook will be registered for the type

func (*BackupStorage) ValidateDelete

func (r *BackupStorage) ValidateDelete() (admission.Warnings, error)

ValidateDelete implements webhook.Validator so a webhook will be registered for the type

func (*BackupStorage) ValidateUpdate

func (r *BackupStorage) ValidateUpdate(old runtime.Object) (admission.Warnings, error)

ValidateUpdate implements webhook.Validator so a webhook will be registered for the type

type BackupStorageList

type BackupStorageList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []BackupStorage `json:"items"`
}

BackupStorageList contains a list of BackupStorage

func (*BackupStorageList) DeepCopy

func (in *BackupStorageList) DeepCopy() *BackupStorageList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupStorageList.

func (*BackupStorageList) DeepCopyInto

func (in *BackupStorageList) DeepCopyInto(out *BackupStorageList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*BackupStorageList) DeepCopyObject

func (in *BackupStorageList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type BackupStoragePhase

type BackupStoragePhase string

type BackupStorageSpec

type BackupStorageSpec struct {
	// Storage specifies the remote storage information
	Storage Backend `json:"storage,omitempty"`
	// UsagePolicy specifies a policy of how this BackupStorage will be used. For example, you can use `allowedNamespaces`
	// policy to restrict the usage of this BackupStorage to particular namespaces.
	// This field is optional. If you don't provide the usagePolicy, then it can be used only from the current namespace.
	// +optional
	UsagePolicy *apis.UsagePolicy `json:"usagePolicy,omitempty"`

	// Default specifies whether to use this BackupStorage as default storage for the current namespace
	// as well as the allowed namespaces. One namespace can have at most one default BackupStorage configured.
	// +optional
	Default bool `json:"default,omitempty"`

	// DeletionPolicy specifies what to do when you delete a BackupStorage CR.
	// The valid values are:
	// "Delete": This will delete the respective Repository and Snapshot CRs from the cluster but keep the backed up data in the remote backend. This is the default behavior.
	// "WipeOut": This will delete the respective Repository and Snapshot CRs as well as the backed up data from the backend.
	// +kubebuilder:default=Delete
	// +optional
	DeletionPolicy DeletionPolicy `json:"deletionPolicy,omitempty"`

	// RuntimeSettings allow to specify Resources, NodeSelector, Affinity, Toleration, ReadinessProbe etc.
	// for the storage initializer/cleaner job.
	// +optional
	RuntimeSettings ofst.RuntimeSettings `json:"runtimeSettings,omitempty"`
}

BackupStorageSpec defines information regarding remote backend, its access credentials, usage policy etc.

func (*BackupStorageSpec) DeepCopy

func (in *BackupStorageSpec) DeepCopy() *BackupStorageSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupStorageSpec.

func (*BackupStorageSpec) DeepCopyInto

func (in *BackupStorageSpec) DeepCopyInto(out *BackupStorageSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type BackupStorageStatus

type BackupStorageStatus struct {
	// Phase indicates the overall phase of the backup BackupStorage. Phase will be "Ready" only
	// if the Backend is initialized and Repositories are synced.
	// +optional
	Phase BackupStoragePhase `json:"phase,omitempty"`

	// TotalSize represents the total backed up data size in this storage.
	// This is simply the summation of sizes of all Repositories using this BackupStorage.
	// +optional
	TotalSize string `json:"totalSize,omitempty"`

	// Repositories holds the information of all Repositories using this BackupStorage
	// +optional
	Repositories []RepositoryInfo `json:"repositories,omitempty"`

	// Conditions represents list of conditions regarding this BackupStorage
	// +optional
	Conditions []kmapi.Condition `json:"conditions,omitempty"`
}

BackupStorageStatus defines the observed state of BackupStorage

func (*BackupStorageStatus) DeepCopy

func (in *BackupStorageStatus) DeepCopy() *BackupStorageStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BackupStorageStatus.

func (*BackupStorageStatus) DeepCopyInto

func (in *BackupStorageStatus) DeepCopyInto(out *BackupStorageStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type BackupType

type BackupType string

type Component

type Component struct {
	// Path specifies the path inside the Repository where the backed up data for this component has been stored.
	// This path is relative to Repository path.
	Path string `json:"path,omitempty"`

	// Phase represents the backup phase of the component
	// +optional
	Phase ComponentPhase `json:"phase,omitempty"`

	// Size represents the size of the restic repository for this component
	// +optional
	Size string `json:"size,omitempty"`

	// Duration specifies the total time taken to complete the backup process for this component
	// +optional
	Duration string `json:"duration,omitempty"`

	// Integrity represents the result of the restic repository integrity check for this component
	// +optional
	Integrity *bool `json:"integrity,omitempty"`

	// Error specifies the reason in case of backup failure for the component
	// +optional
	Error string `json:"error,omitempty"`

	// Driver specifies the name of the tool that has been used to upload the underlying backed up data
	Driver apis.Driver `json:"driver,omitempty"`

	// ResticStats specifies the "Restic" driver specific information
	// +optional
	ResticStats []ResticStats `json:"resticStats,omitempty"`

	// VolumeSnapshotterStats specifies the "VolumeSnapshotter" driver specific information
	// +optional
	VolumeSnapshotterStats []VolumeSnapshotterStats `json:"volumeSnapshotterStats,omitempty"`

	// WalSegments specifies a list of wall segment for individual component
	WalSegments []WalSegment `json:"walSegments,omitempty"`
}

Component represents the backup information of individual components

func (*Component) DeepCopy

func (in *Component) DeepCopy() *Component

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Component.

func (*Component) DeepCopyInto

func (in *Component) DeepCopyInto(out *Component)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ComponentPhase

type ComponentPhase string

ComponentPhase represents the backup phase of the individual component. +kubebuilder:validation:Enum=Pending;Running;Succeeded;Failed

const (
	ComponentPhasePending   ComponentPhase = "Pending"
	ComponentPhaseRunning   ComponentPhase = "Running"
	ComponentPhaseSucceeded ComponentPhase = "Succeeded"
	ComponentPhaseFailed    ComponentPhase = "Failed"
)

type DeletionPolicy

type DeletionPolicy string

DeletionPolicy specifies what to do if a resource is deleted +kubebuilder:validation:Enum=Delete;WipeOut

const (
	DeletionPolicyDelete  DeletionPolicy = "Delete"
	DeletionPolicyWipeOut DeletionPolicy = "WipeOut"
)

type Duration

type Duration struct {
	Minutes int
	Hours   int
	Days    int
	Weeks   int
	Months  int
	Years   int
}

func ParseDuration

func ParseDuration(s string) (Duration, error)

ParseDuration parses a duration from a string. The format is `6y5m234d37h`

func (*Duration) DeepCopy

func (in *Duration) DeepCopy() *Duration

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Duration.

func (*Duration) DeepCopyInto

func (in *Duration) DeepCopyInto(out *Duration)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type FailedSnapshotsKeepPolicy

type FailedSnapshotsKeepPolicy struct {
	// Last specifies how many last failed Snapshots should be kept.
	// By default, KubeStash will keep only the last 1 failed Snapshot.
	// +kubebuilder:default=1
	// +optional
	Last *int32 `json:"last,omitempty"`
}

FailedSnapshotsKeepPolicy specifies the policy for keeping failed Snapshots

func (*FailedSnapshotsKeepPolicy) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FailedSnapshotsKeepPolicy.

func (*FailedSnapshotsKeepPolicy) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type GCSSpec

type GCSSpec struct {
	// Bucket specifies the name of the bucket that will be used as storage backend.
	Bucket string `json:"bucket,omitempty"`

	// Prefix specifies a directory inside the bucket/container where the data for this backend will be stored.
	Prefix string `json:"prefix,omitempty"`

	// MaxConnections specifies the maximum number of concurrent connections to use to upload/download data to this backend.
	// +optional
	MaxConnections int64 `json:"maxConnections,omitempty"`

	// SecretName specifies the name of the Secret that contains the access credential for this storage.
	// +optional
	SecretName string `json:"secretName,omitempty"`
}

func (*GCSSpec) DeepCopy

func (in *GCSSpec) DeepCopy() *GCSSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GCSSpec.

func (*GCSSpec) DeepCopyInto

func (in *GCSSpec) DeepCopyInto(out *GCSSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type LocalSpec

type LocalSpec struct {
	// Represents the source of a volume to mount. Only one of its members may be specified.
	// Make sure the volume exist before using the volume as backend.
	ofst.VolumeSource `json:",inline"`

	// MountPath specifies the directory where this volume will be mounted
	MountPath string `json:"mountPath,omitempty"`

	// Path within the volume from which the container's volume should be mounted.
	// Defaults to "" (volume's root).
	// +optional
	SubPath string `json:"subPath,omitempty"`
}

func (*LocalSpec) DeepCopy

func (in *LocalSpec) DeepCopy() *LocalSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LocalSpec.

func (*LocalSpec) DeepCopyInto

func (in *LocalSpec) DeepCopyInto(out *LocalSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (LocalSpec) ToLocalMountPath added in v0.2.0

func (l LocalSpec) ToLocalMountPath(storageName string) (string, error)

func (LocalSpec) ToVolumeAndMount added in v0.2.0

func (l LocalSpec) ToVolumeAndMount(storageName string) (core.Volume, core.VolumeMount)

ToVolumeAndMount returns volumes and mounts for local backend

type Repository

type Repository struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   RepositorySpec   `json:"spec,omitempty"`
	Status RepositoryStatus `json:"status,omitempty"`
}

Repository specifies the information about the targeted application that has been backed up and the BackupStorage where the backed up data is being stored. It also holds a list of recent Snapshots that have been taken in this Repository. Repository is a namespaced object. It must be in the same namespace as the targeted application.

func (*Repository) CalculatePhase

func (r *Repository) CalculatePhase() RepositoryPhase

func (Repository) CustomResourceDefinition

func (_ Repository) CustomResourceDefinition() *apiextensions.CustomResourceDefinition

func (*Repository) DeepCopy

func (in *Repository) DeepCopy() *Repository

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Repository.

func (*Repository) DeepCopyInto

func (in *Repository) DeepCopyInto(out *Repository)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Repository) DeepCopyObject

func (in *Repository) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*Repository) OffshootLabels added in v0.2.0

func (r *Repository) OffshootLabels() map[string]string

func (*Repository) SetupWebhookWithManager

func (r *Repository) SetupWebhookWithManager(mgr ctrl.Manager) error

func (*Repository) ValidateCreate

func (r *Repository) ValidateCreate() (admission.Warnings, error)

ValidateCreate implements webhook.Validator so a webhook will be registered for the type

func (*Repository) ValidateDelete

func (r *Repository) ValidateDelete() (admission.Warnings, error)

ValidateDelete implements webhook.Validator so a webhook will be registered for the type

func (*Repository) ValidateUpdate

func (r *Repository) ValidateUpdate(old runtime.Object) (admission.Warnings, error)

ValidateUpdate implements webhook.Validator so a webhook will be registered for the type

type RepositoryInfo

type RepositoryInfo struct {
	// Name represents the name of the respective Repository CR
	Name string `json:"name,omitempty"`

	// Namespace represent the namespace where the Repository CR has been created
	// +optional
	Namespace string `json:"namespace,omitempty"`

	// Path represents the directory inside the BackupStorage where this Repository is storing its data
	// This path is relative to the path of BackupStorage.
	Path string `json:"path,omitempty"`

	// Size represents the size of the backed up data in this Repository
	// +optional
	Size string `json:"size,omitempty"`

	// Synced specifies whether this Repository state has been synced with the cloud state or not
	// +optional
	Synced *bool `json:"synced,omitempty"`

	// Error specifies the reason in case of Repository sync failure.
	// +optional
	Error *string `json:"error,omitempty"`
}

RepositoryInfo specifies information regarding a Repository using the BackupStorage

func (*RepositoryInfo) DeepCopy

func (in *RepositoryInfo) DeepCopy() *RepositoryInfo

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RepositoryInfo.

func (*RepositoryInfo) DeepCopyInto

func (in *RepositoryInfo) DeepCopyInto(out *RepositoryInfo)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type RepositoryList

type RepositoryList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Repository `json:"items"`
}

RepositoryList contains a list of Repository

func (*RepositoryList) DeepCopy

func (in *RepositoryList) DeepCopy() *RepositoryList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RepositoryList.

func (*RepositoryList) DeepCopyInto

func (in *RepositoryList) DeepCopyInto(out *RepositoryList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*RepositoryList) DeepCopyObject

func (in *RepositoryList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type RepositoryPhase

type RepositoryPhase string

RepositoryPhase specifies the current state of the Repository +kubebuilder:validation:Enum=NotReady;Ready

const (
	RepositoryNotReady RepositoryPhase = "NotReady"
	RepositoryReady    RepositoryPhase = "Ready"
)

type RepositorySpec

type RepositorySpec struct {
	// AppRef refers to the application that is being backed up in this Repository.
	AppRef kmapi.TypedObjectReference `json:"appRef,omitempty"`

	// StorageRef refers to the BackupStorage CR which contain the backend information where the backed
	// up data will be stored. The BackupStorage could be in a different namespace. However, the Repository
	// namespace must be allowed to use the BackupStorage.
	StorageRef kmapi.ObjectReference `json:"storageRef,omitempty"`

	// Path represents the directory inside the BackupStorage where this Repository is storing its data
	// This path is relative to the path of BackupStorage.
	Path string `json:"path,omitempty"`

	// DeletionPolicy specifies what to do when you delete a Repository CR.
	// The valid values are:
	// "Delete": This will delete the respective Snapshot CRs from the cluster but keep the backed up data in the remote backend. This is the default behavior.
	// "WipeOut": This will delete the respective Snapshot CRs as well as the backed up data from the backend.
	// +kubebuilder:default=Delete
	// +optional
	DeletionPolicy DeletionPolicy `json:"deletionPolicy,omitempty"`

	// EncryptionSecret refers to the Secret containing the encryption key which will be used to encode/decode the backed up data.
	// You can refer to a Secret of a different namespace.
	// If you don't provide the namespace field, KubeStash will look for the Secret in the same namespace as the BackupConfiguration / BackupBatch.
	EncryptionSecret *kmapi.ObjectReference `json:"encryptionSecret,omitempty"`

	// Paused specifies whether the Repository is paused or not. If the Repository is paused,
	// KubeStash will not process any further event for the Repository.
	// +optional
	Paused bool `json:"paused,omitempty"`
}

RepositorySpec specifies the application reference and the BackupStorage reference.It also specifies what should be the behavior when a Repository CR is deleted from the cluster.

func (*RepositorySpec) DeepCopy

func (in *RepositorySpec) DeepCopy() *RepositorySpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RepositorySpec.

func (*RepositorySpec) DeepCopyInto

func (in *RepositorySpec) DeepCopyInto(out *RepositorySpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type RepositoryStatus

type RepositoryStatus struct {
	// Phase represents the current state of the Repository.
	// +optional
	Phase RepositoryPhase `json:"phase,omitempty"`

	// LastBackupTime specifies the timestamp when the last successful backup has been taken
	// +optional
	LastBackupTime *metav1.Time `json:"lastBackupTime,omitempty"`

	// Integrity specifies whether the backed up data of this Repository has been corrupted or not
	// +optional
	Integrity *bool `json:"integrity,omitempty"`

	// SnapshotCount specifies the number of current Snapshots stored in this Repository
	// +optional
	SnapshotCount *int32 `json:"snapshotCount,omitempty"`

	// Size specifies the amount of backed up data stored in the Repository
	// +optional
	Size string `json:"size,omitempty"`

	// RecentSnapshots holds a list of recent Snapshot information that has been taken in this Repository
	// +optional
	RecentSnapshots []SnapshotInfo `json:"recentSnapshots,omitempty"`

	// Conditions represents list of conditions regarding this Repository
	// +optional
	Conditions []kmapi.Condition `json:"conditions,omitempty"`

	// ComponentPaths represents list of component paths in this Repository
	// +optional
	ComponentPaths []string `json:"componentPaths,omitempty"`
}

RepositoryStatus defines the observed state of Repository

func (*RepositoryStatus) DeepCopy

func (in *RepositoryStatus) DeepCopy() *RepositoryStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RepositoryStatus.

func (*RepositoryStatus) DeepCopyInto

func (in *RepositoryStatus) DeepCopyInto(out *RepositoryStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ResticStats

type ResticStats struct {
	// Id represents the restic snapshot id
	Id string `json:"id,omitempty"`

	// Uploaded specifies the amount of data that has been uploaded in the restic snapshot.
	// +optional
	Uploaded string `json:"uploaded,omitempty"`

	// HostPath represents the backup path for which restic snapshot is taken.
	// +optional
	HostPath string `json:"hostPath,omitempty"`

	// Size represents the restic snapshot size
	// +optional
	Size string `json:"size,omitempty"`
}

ResticStats specifies the "Restic" driver specific information

func (*ResticStats) DeepCopy

func (in *ResticStats) DeepCopy() *ResticStats

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResticStats.

func (*ResticStats) DeepCopyInto

func (in *ResticStats) DeepCopyInto(out *ResticStats)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type RetentionPeriod

type RetentionPeriod string

RetentionPeriod represents a duration in the format "1y2mo3w4d5h6m", where y=year, mo=month, w=week, d=day, h=hour, m=minute.

func (RetentionPeriod) ToMinutes

func (r RetentionPeriod) ToMinutes() (int, error)

type RetentionPolicy

type RetentionPolicy struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec RetentionPolicySpec `json:"spec,omitempty"`
}

RetentionPolicy specifies how the old Snapshots should be cleaned up. This is a namespaced CRD. However, you can refer it from other namespaces as long as it is permitted via `.spec.usagePolicy`.

func (RetentionPolicy) CustomResourceDefinition

func (_ RetentionPolicy) CustomResourceDefinition() *apiextensions.CustomResourceDefinition

func (*RetentionPolicy) DeepCopy

func (in *RetentionPolicy) DeepCopy() *RetentionPolicy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RetentionPolicy.

func (*RetentionPolicy) DeepCopyInto

func (in *RetentionPolicy) DeepCopyInto(out *RetentionPolicy)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*RetentionPolicy) DeepCopyObject

func (in *RetentionPolicy) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*RetentionPolicy) Default

func (r *RetentionPolicy) Default()

Default implements webhook.Defaulter so a webhook will be registered for the type

func (*RetentionPolicy) SetupWebhookWithManager

func (r *RetentionPolicy) SetupWebhookWithManager(mgr ctrl.Manager) error

func (RetentionPolicy) UsageAllowed added in v0.2.0

func (r RetentionPolicy) UsageAllowed(srcNamespace *core.Namespace) bool

func (*RetentionPolicy) ValidateCreate

func (r *RetentionPolicy) ValidateCreate() (admission.Warnings, error)

ValidateCreate implements webhook.Validator so a webhook will be registered for the type

func (*RetentionPolicy) ValidateDelete

func (r *RetentionPolicy) ValidateDelete() (admission.Warnings, error)

ValidateDelete implements webhook.Validator so a webhook will be registered for the type

func (*RetentionPolicy) ValidateUpdate

func (r *RetentionPolicy) ValidateUpdate(old runtime.Object) (admission.Warnings, error)

ValidateUpdate implements webhook.Validator so a webhook will be registered for the type

type RetentionPolicyList

type RetentionPolicyList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []RetentionPolicy `json:"items"`
}

RetentionPolicyList contains a list of RetentionPolicy

func (*RetentionPolicyList) DeepCopy

func (in *RetentionPolicyList) DeepCopy() *RetentionPolicyList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RetentionPolicyList.

func (*RetentionPolicyList) DeepCopyInto

func (in *RetentionPolicyList) DeepCopyInto(out *RetentionPolicyList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*RetentionPolicyList) DeepCopyObject

func (in *RetentionPolicyList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type RetentionPolicySpec

type RetentionPolicySpec struct {
	// MaxRetentionPeriod specifies a duration up to which the old Snapshots should be kept.
	// KubeStash will remove all the Snapshots that are older than the MaxRetentionPeriod.
	// For example, MaxRetentionPeriod of `30d` will keep only the Snapshots of last 30 days.
	// Sample duration format:
	// - years: 	2y
	// - months: 	6mo
	// - days: 		30d
	// - hours: 	12h
	// - minutes: 	30m
	// You can also combine the above durations. For example: 30d12h30m
	// +optional
	MaxRetentionPeriod RetentionPeriod `json:"maxRetentionPeriod,omitempty"`

	// UsagePolicy specifies a policy of how this RetentionPolicy will be used. For example, you can use `allowedNamespaces`
	// policy to restrict the usage of this RetentionPolicy to particular namespaces.
	// This field is optional. If you don't provide the usagePolicy, then it can be used only from the current namespace.
	// +optional
	UsagePolicy *apis.UsagePolicy `json:"usagePolicy,omitempty"`

	// SuccessfulSnapshots specifies how many successful Snapshots should be kept.
	// +optional
	SuccessfulSnapshots *SuccessfulSnapshotsKeepPolicy `json:"successfulSnapshots,omitempty"`

	// FailedSnapshots specifies how many failed Snapshots should be kept.
	// +optional
	FailedSnapshots *FailedSnapshotsKeepPolicy `json:"failedSnapshots,omitempty"`

	// Default specifies whether to use this RetentionPolicy as a default RetentionPolicy for
	// the current namespace as well as the permitted namespaces.
	// One namespace can have at most one default RetentionPolicy configured.
	// +optional
	Default bool `json:"default,omitempty"`
}

RetentionPolicySpec defines the policy of cleaning old Snapshots

func (*RetentionPolicySpec) DeepCopy

func (in *RetentionPolicySpec) DeepCopy() *RetentionPolicySpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RetentionPolicySpec.

func (*RetentionPolicySpec) DeepCopyInto

func (in *RetentionPolicySpec) DeepCopyInto(out *RetentionPolicySpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type S3Spec

type S3Spec struct {
	// Endpoint specifies the URL of the S3 or S3 compatible storage bucket.
	Endpoint string `json:"endpoint,omitempty"`

	// Bucket specifies the name of the bucket that will be used as storage backend.
	Bucket string `json:"bucket,omitempty"`

	// Prefix specifies a directory inside the bucket/container where the data for this backend will be stored.
	Prefix string `json:"prefix,omitempty"`

	// Region specifies the region where the bucket is located
	// +optional
	Region string `json:"region,omitempty"`

	// SecretName specifies the name of the Secret that contains the access credential for this storage.
	// +optional
	SecretName string `json:"secretName,omitempty"`

	// InsecureTLS controls whether a client should skip TLS certificate verification.
	// Setting this field to true disables verification, which might be necessary in cases
	// where the server uses self-signed certificates or certificates from an untrusted CA.
	// Use this option with caution, as it can expose the client to man-in-the-middle attacks
	// and other security risks. Only use it when absolutely necessary.
	// +optional
	InsecureTLS bool `json:"insecureTLS,omitempty"`
}

func (*S3Spec) DeepCopy

func (in *S3Spec) DeepCopy() *S3Spec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new S3Spec.

func (*S3Spec) DeepCopyInto

func (in *S3Spec) DeepCopyInto(out *S3Spec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Snapshot

type Snapshot struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   SnapshotSpec   `json:"spec,omitempty"`
	Status SnapshotStatus `json:"status,omitempty"`
}

Snapshot represents the state of a backup run to a particular Repository. Multiple components of the same target may be backed up in the same Snapshot. This is a namespaced CRD. It should be in the same namespace as the respective Repository. KubeStash operator is responsible for creating Snapshot CR. Snapshot is not supposed to be created/edited by the end user.

func (*Snapshot) CalculatePhase

func (s *Snapshot) CalculatePhase() SnapshotPhase

func (Snapshot) CustomResourceDefinition

func (_ Snapshot) CustomResourceDefinition() *apiextensions.CustomResourceDefinition

func (*Snapshot) DeepCopy

func (in *Snapshot) DeepCopy() *Snapshot

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Snapshot.

func (*Snapshot) DeepCopyInto

func (in *Snapshot) DeepCopyInto(out *Snapshot)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Snapshot) DeepCopyObject

func (in *Snapshot) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*Snapshot) GetComponentPath added in v0.2.0

func (s *Snapshot) GetComponentPath(componentName string) string

func (*Snapshot) GetComponentsPhase

func (s *Snapshot) GetComponentsPhase() SnapshotPhase

func (*Snapshot) GetIntegrity added in v0.2.0

func (s *Snapshot) GetIntegrity() *bool

func (*Snapshot) GetSize added in v0.2.0

func (s *Snapshot) GetSize() string

func (*Snapshot) GetTotalBackupSizeInBytes added in v0.2.0

func (s *Snapshot) GetTotalBackupSizeInBytes() (uint64, error)

func (*Snapshot) IsCompleted added in v0.2.0

func (s *Snapshot) IsCompleted() bool

func (*Snapshot) OffshootLabels added in v0.2.0

func (s *Snapshot) OffshootLabels() map[string]string

type SnapshotInfo

type SnapshotInfo struct {
	// Name represents the name of the Snapshot
	Name string `json:"name,omitempty"`

	// Phase represents the phase of the Snapshot
	// +optional
	Phase SnapshotPhase `json:"phase,omitempty"`

	// Session represents the name of the session that is responsible for this Snapshot
	Session string `json:"session,omitempty"`

	// Size represents the size of the Snapshot
	// +optional
	Size string `json:"size,omitempty"`

	// SnapshotTime represents the time when this Snapshot was taken
	// +optional
	SnapshotTime *metav1.Time `json:"snapshotTime,omitempty"`
}

SnapshotInfo specifies some basic information about the Snapshots stored in this Repository

func (*SnapshotInfo) DeepCopy

func (in *SnapshotInfo) DeepCopy() *SnapshotInfo

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SnapshotInfo.

func (*SnapshotInfo) DeepCopyInto

func (in *SnapshotInfo) DeepCopyInto(out *SnapshotInfo)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type SnapshotList

type SnapshotList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Snapshot `json:"items"`
}

SnapshotList contains a list of Snapshot

func (*SnapshotList) DeepCopy

func (in *SnapshotList) DeepCopy() *SnapshotList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SnapshotList.

func (*SnapshotList) DeepCopyInto

func (in *SnapshotList) DeepCopyInto(out *SnapshotList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*SnapshotList) DeepCopyObject

func (in *SnapshotList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type SnapshotPhase

type SnapshotPhase string

SnapshotPhase represent the overall progress of this Snapshot +kubebuilder:validation:Enum=Pending;Running;Succeeded;Failed

const (
	SnapshotPending   SnapshotPhase = "Pending"
	SnapshotRunning   SnapshotPhase = "Running"
	SnapshotSucceeded SnapshotPhase = "Succeeded"
	SnapshotFailed    SnapshotPhase = "Failed"
)

type SnapshotSpec

type SnapshotSpec struct {
	// SnapshotID represents a "Universally Unique Lexicographically Sortable Identifier" (ULID) for the Snapshot.
	// For more details about ULID, please see: https://github.com/oklog/ulid
	// +optional
	SnapshotID string `json:"snapshotID,omitempty"`

	// Type specifies whether this snapshot represents a full or incremental backup
	Type BackupType `json:"type,omitempty"`

	// Repository specifies the name of the Repository where this Snapshot is being stored.
	Repository string `json:"repository,omitempty"`

	// Session specifies the name of the session which is responsible for this Snapshot
	Session string `json:"session,omitempty"`

	// BackupSession represents the name of the respective BackupSession which is responsible for this Snapshot.
	// +optional
	BackupSession string `json:"backupSession,omitempty"`

	// Version denotes the respective data organization structure inside the Repository
	Version string `json:"version,omitempty"`

	// AppRef specifies the reference of the application that has been backed up in this Snapshot.
	AppRef kmapi.TypedObjectReference `json:"appRef,omitempty"`

	// DeletionPolicy specifies what to do when you delete a Snapshot CR.
	// The valid values are:
	// - "Delete": This will delete just the Snapshot CR from the cluster but keep the backed up data in the remote backend. This is the default behavior.
	// - "WipeOut": This will delete the Snapshot CR as well as the backed up data from the backend.
	// +kubebuilder:default=Delete
	// +optional
	DeletionPolicy DeletionPolicy `json:"deletionPolicy,omitempty"`

	// Paused specifies whether the Snapshot is paused or not. If the Snapshot is paused,
	// KubeStash will not process any further event for the Snapshot.
	// +optional
	Paused bool `json:"paused,omitempty"`
}

SnapshotSpec specifies the information regarding the application that is being backed up, the Repository where the backed up data is being stored, and the session which is responsible for this snapshot etc.

func (*SnapshotSpec) DeepCopy

func (in *SnapshotSpec) DeepCopy() *SnapshotSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SnapshotSpec.

func (*SnapshotSpec) DeepCopyInto

func (in *SnapshotSpec) DeepCopyInto(out *SnapshotSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type SnapshotStatus

type SnapshotStatus struct {
	// Phase represents the backup state of this Snapshot
	// +optional
	Phase SnapshotPhase `json:"phase,omitempty"`

	// VerificationStatus specifies whether this Snapshot has been verified or not
	// +optional
	VerificationStatus VerificationStatus `json:"verificationStatus,omitempty"`

	// SnapshotTime represents the timestamp when this Snapshot was taken.
	// +optional
	SnapshotTime *metav1.Time `json:"snapshotTime,omitempty"`

	// LastUpdateTime specifies the timestamp when this Snapshot was last updated.
	// +optional
	LastUpdateTime *metav1.Time `json:"lastUpdateTime,omitempty"`

	// Size represents the size of the Snapshot
	// +optional
	Size string `json:"size,omitempty"`

	// Integrity represents whether the Snapshot data has been corrupted or not
	// +optional
	Integrity *bool `json:"integrity,omitempty"`

	// Conditions represents list of conditions regarding this Snapshot
	// +optional
	Conditions []kmapi.Condition `json:"conditions,omitempty"`

	// TotalComponents represents the number of total components for this Snapshot
	// +optional
	TotalComponents int32 `json:"totalComponents,omitempty"`

	// Components represents the backup information of the individual components of this Snapshot
	// +optional
	// +mapType=granular
	Components map[string]Component `json:"components,omitempty"`
}

SnapshotStatus defines the observed state of Snapshot

func (*SnapshotStatus) DeepCopy

func (in *SnapshotStatus) DeepCopy() *SnapshotStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SnapshotStatus.

func (*SnapshotStatus) DeepCopyInto

func (in *SnapshotStatus) DeepCopyInto(out *SnapshotStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type StorageProvider

type StorageProvider string
const (
	ProviderLocal StorageProvider = "local"
	ProviderS3    StorageProvider = "s3"
	ProviderGCS   StorageProvider = "gcs"
	ProviderAzure StorageProvider = "azure"
)

type SuccessfulSnapshotsKeepPolicy

type SuccessfulSnapshotsKeepPolicy struct {
	// Last specifies how many last Snapshots should be kept.
	// +optional
	Last *int32 `json:"last,omitempty"`

	// Hourly specifies how many hourly Snapshots should be kept.
	// +optional
	Hourly *int32 `json:"hourly,omitempty"`

	// Daily specifies how many daily Snapshots should be kept.
	// +optional
	Daily *int32 `json:"daily,omitempty"`

	// Weekly specifies how many weekly Snapshots should be kept.
	// +optional
	Weekly *int32 `json:"weekly,omitempty"`

	// Monthly specifies how many monthly Snapshots should be kept.
	// +optional
	Monthly *int32 `json:"monthly,omitempty"`

	// Yearly specifies how many yearly Snapshots should be kept.
	// +optional
	Yearly *int32 `json:"yearly,omitempty"`
}

SuccessfulSnapshotsKeepPolicy specifies the policy for keeping successful Snapshots

func (*SuccessfulSnapshotsKeepPolicy) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SuccessfulSnapshotsKeepPolicy.

func (*SuccessfulSnapshotsKeepPolicy) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type VerificationStatus

type VerificationStatus string

VerificationStatus represents whether the Snapshot has been verified or not. +kubebuilder:validation:Enum=Verified;NotVerified;VerificationFailed

const (
	SnapshotVerified           VerificationStatus = "Verified"
	SnapshotNotVerified        VerificationStatus = "NotVerified"
	SnapshotVerificationFailed VerificationStatus = "VerificationFailed"
)

type VolumeSnapshotterStats

type VolumeSnapshotterStats struct {

	// PVCName represents the backup PVC name for which volumeSnapshot is created.
	// +optional
	PVCName string `json:"pvcName,omitempty"`

	// HostPath represents the corresponding path of PVC for which volumeSnapshot is created.
	// +optional
	HostPath string `json:"hostPath,omitempty"`

	// VolumeSnapshotName represents the name of created volumeSnapshot.
	// +optional
	VolumeSnapshotName string `json:"volumeSnapshotName,omitempty"`

	// VolumeSnapshotTime indicates the timestamp at which the volumeSnapshot was created.
	VolumeSnapshotTime *metav1.Time `json:"volumeSnapshotTime,omitempty"`
}

VolumeSnapshotterStats specifies the "VolumeSnapshotter" driver specific information

func (*VolumeSnapshotterStats) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VolumeSnapshotterStats.

func (*VolumeSnapshotterStats) DeepCopyInto

func (in *VolumeSnapshotterStats) DeepCopyInto(out *VolumeSnapshotterStats)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type WalSegment

type WalSegment struct {
	Start *metav1.Time `json:"start,omitempty"`
	End   *metav1.Time `json:"end,omitempty"`
}

WalSegment specifies the "WalG" driver specific information

func (*WalSegment) DeepCopy

func (in *WalSegment) DeepCopy() *WalSegment

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WalSegment.

func (*WalSegment) DeepCopyInto

func (in *WalSegment) DeepCopyInto(out *WalSegment)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

Jump to

Keyboard shortcuts

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