snapshot

package
v4.11.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2026 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// APIVersion is the snapshot request API version.
	APIVersion = "v1beta1"

	// RequestKey is the ConfigMap data key that stores a snapshot request.
	RequestKey = "snapshotRequest"

	// OptionsKey is the Secret data key that stores snapshot options.
	OptionsKey = "snapshotOptions"

	// SnapshotRequestLabel marks ConfigMaps and Secrets as snapshot request resources.
	SnapshotRequestLabel = "vcluster.loft.sh/snapshot-request"

	// RestoreRequestLabel marks ConfigMaps and Secrets as restore request resources.
	RestoreRequestLabel = "vcluster.loft.sh/restore-request"

	// VClusterNamespaceLabel stores the namespace of the vCluster that owns the request.
	VClusterNamespaceLabel = "vcluster.loft.sh/vcluster-namespace"

	// VClusterNameLabel stores the name of the vCluster that owns the request.
	VClusterNameLabel = "vcluster.loft.sh/vcluster-name"

	// SnapshotReleaseKey stores info about the vCluster Helm release in the snapshot archive.
	SnapshotReleaseKey = "/vcluster/snapshot/release"

	DefaultRequestTTL = 24 * time.Hour
)

Variables

This section is empty.

Functions

func NewOptionsSecret

func NewOptionsSecret(requestLabel, vClusterNamespace, vClusterName string, options *Options) (*corev1.Secret, error)

func NewSnapshotDeleteOptionsSecret

func NewSnapshotDeleteOptionsSecret(vClusterNamespace, vClusterName string, options *Options) (*corev1.Secret, error)

func NewSnapshotOptionsSecret

func NewSnapshotOptionsSecret(vClusterNamespace, vClusterName string, options *Options) (*corev1.Secret, error)

func NewSnapshotRequestConfigMap

func NewSnapshotRequestConfigMap(vClusterNamespace, vClusterName string, request *Request) (*corev1.ConfigMap, error)

Types

type AzureOptions

type AzureOptions struct {
	// BlobURL is the full Azure Blob Storage URL.
	BlobURL string `json:"blob-url,omitempty"`

	// SAS is the Azure storage blob SAS token.
	SAS string `json:"sas,omitempty"`

	// SubscriptionID is the Azure subscription ID where the storage account is located.
	SubscriptionID string `json:"subscription-id,omitempty"`

	// ResourceGroup is the Azure resource group where the storage account is located.
	ResourceGroup string `json:"resource-group,omitempty"`

	// StorageKey is the Azure storage account access key.
	StorageKey string `json:"storage-key,omitempty"`

	// TenantID is the Azure tenant ID for service principal auth.
	TenantID string `json:"tenant-id,omitempty"`

	// ClientID is the Azure client ID for service principal auth.
	ClientID string `json:"client-id,omitempty"`

	// ClientSecret is the client secret for service principal auth.
	ClientSecret string `json:"client-secret,omitempty"`
}

type ContainerOptions

type ContainerOptions struct {
	Path string `json:"path,omitempty"`
}

type FileOptions

type FileOptions struct {
	Path string `json:"path,omitempty"`
}

type HelmRelease

type HelmRelease struct {
	ReleaseName      string `json:"releaseName"`
	ReleaseNamespace string `json:"releaseNamespace"`

	ChartName    string `json:"chartName"`
	ChartVersion string `json:"chartVersion"`

	Values []byte `json:"values"`
}

type LongRunningRequest

type LongRunningRequest interface {
	GetPhase() RequestPhase
}

type OCIOptions

type OCIOptions struct {
	Repository string `json:"repository,omitempty"`

	Username string `json:"username,omitempty" url:"username"`
	Password string `json:"password,omitempty" url:"password,base64"`

	SkipClientCredentials bool `json:"skip-client-credentials,omitempty" url:"skip-client-credentials"`
}

type Options

type Options struct {
	Type string `json:"type,omitempty"`

	S3        S3Options        `json:"s3"`
	Container ContainerOptions `json:"container"`
	OCI       OCIOptions       `json:"oci"`
	Azure     AzureOptions     `json:"azure"`
	File      FileOptions      `json:"file"`

	Release *HelmRelease `json:"release,omitempty"`
	// DelegateFromCLIToCluster indicates that the snapshot options are saved in a Kubernetes Secret because the
	// snapshot/restore operation will be executed in a Kubernetes cluster.
	DelegateFromCLIToCluster bool `json:"delegateFromCLIToCluster,omitempty"`

	// SnapshotTempDir is the temporary directory used for snapshot operations.
	// If set to empty string, the default directory for temporary files will be used, as returned by os.TempDir().
	SnapshotTempDir string `json:"snapshotTempDir,omitempty"`
}

func UnmarshalOptions

func UnmarshalOptions(secret *corev1.Secret) (*Options, error)

func (*Options) GetURL

func (o *Options) GetURL() string

type Request

type Request struct {
	RequestMetadata `json:"metadata,omitempty"`
	Spec            RequestSpec   `json:"spec,omitempty"`
	Status          RequestStatus `json:"status,omitempty"`
}

func NewRequest

func NewRequest(name string, creationTimestamp metav1.Time, options *Options) *Request

func UnmarshalRequest

func UnmarshalRequest(configMap *corev1.ConfigMap) (*Request, error)

func (*Request) Done

func (r *Request) Done() bool

func (*Request) GetPhase

func (r *Request) GetPhase() RequestPhase

func (*Request) ShouldCancel

func (r *Request) ShouldCancel(otherRequest *Request) bool

type RequestMetadata

type RequestMetadata struct {
	Name              string      `json:"name"`
	CreationTimestamp metav1.Time `json:"creationTimestamp,omitempty"`
}

type RequestPhase

type RequestPhase string
const (
	RequestPhaseNotStarted         RequestPhase = ""
	RequestPhaseCreatingEtcdBackup RequestPhase = "CreatingEtcdBackup"
	RequestPhaseCompleted          RequestPhase = "Completed"
	RequestPhasePartiallyFailed    RequestPhase = "PartiallyFailed"
	RequestPhaseFailed             RequestPhase = "Failed"

	RequestPhaseCanceling RequestPhase = "Canceling"
	RequestPhaseCanceled  RequestPhase = "Canceled"

	RequestPhaseDeleting           RequestPhase = "Deleting"
	RequestPhaseDeletingEtcdBackup RequestPhase = "DeletingEtcdBackup"
	RequestPhaseDeleted            RequestPhase = "Deleted"

	RequestPhaseUnknown RequestPhase = "Unknown"
)

func (RequestPhase) Next

func (r RequestPhase) Next() RequestPhase

type RequestSpec

type RequestSpec struct {
	URL     string  `json:"url,omitempty"`
	Options Options `json:"-"`
}

type RequestStatus

type RequestStatus struct {
	Phase RequestPhase  `json:"phase,omitempty"`
	Error SnapshotError `json:"error,omitempty"`
}

type S3Options

type S3Options struct {
	Bucket string `json:"bucket,omitempty"`
	Key    string `json:"key,omitempty"`

	SkipClientCredentials bool `json:"skip-client-credentials,omitempty" url:"skip-client-credentials"`

	AccessKeyID     string `json:"access-key-id,omitempty" url:"access-key-id,base64"`
	SecretAccessKey string `json:"secret-access-key,omitempty" url:"secret-access-key,base64"`
	SessionToken    string `json:"session-token,omitempty" url:"session-token,base64"`

	Region    string `json:"region,omitempty" url:"region"`
	Profile   string `json:"profile,omitempty" url:"profile"`
	S3URL     string `json:"url,omitempty" url:"url,base64"`
	PublicURL string `json:"public-url,omitempty" url:"public-url,base64"`
	KmsKeyID  string `json:"kms-key-id,omitempty" url:"kms-key-id,base64"`
	Tagging   string `json:"tagging,omitempty" url:"tagging,base64"`

	S3ForcePathStyle      bool `json:"force-path-style,omitempty" url:"force-path-style"`
	InsecureSkipTLSVerify bool `json:"insecure-skip-tls-verify,omitempty" url:"insecure-skip-tls-verify"`

	CustomerKeyEncryptionFile string `json:"custom-key-encryption-file,omitempty" url:"custom-key-encryption-file,base64"`
	CredentialsFile           string `json:"credentials-file,omitempty" url:"credentials-file,base64"`
	ServerSideEncryption      string `json:"server-side-encryption,omitempty" url:"server-side-encryption,base64"`
	CACert                    string `json:"ca-cert,omitempty" url:"ca-cert,base64"`
	ChecksumAlgorithm         string `json:"checksum-algorithm,omitempty" url:"checksum-algorithm"`
}

type Snapshot

type Snapshot struct {
	ID        string    `json:"id"`
	URL       string    `json:"url"`
	Timestamp time.Time `json:"timestamp"`
}

type SnapshotError

type SnapshotError struct {
	Message string `json:"message,omitempty"`
}

SnapshotError describes the error that occurred while taking the snapshot.

func (SnapshotError) Equals

func (err SnapshotError) Equals(other SnapshotError) bool

type VClusterConfig

type VClusterConfig struct {
	ChartVersion string `json:"chartVersion"`
	Values       string `json:"values"`
}

Directories

Path Synopsis
oci
s3

Jump to

Keyboard shortcuts

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