snapshot

package
v1.108.6 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: Apache-2.0 Imports: 70 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FileSystemMinioConfigMapName, FileSystemMinioSecretName                   = "kotsadm-fs-minio", "kotsadm-fs-minio-creds"
	FileSystemMinioDeploymentName, FileSystemMinioServiceName                 = "kotsadm-fs-minio", "kotsadm-fs-minio"
	FileSystemMinioProvider, FileSystemMinioBucketName, FileSystemMinioRegion = "aws", "velero", "minio"
	FileSystemMinioServicePort                                                = 9000
)
View Source
const (
	DefaultBackupStorageLocationName = "default"
	CloudCredentialsSecretName       = "cloud-credentials"
	RegistryImagePullSecretName      = "registry-credentials"
	SnapshotMigrationArtifactName    = "kotsadm-velero-migration"
	SnapshotStoreHostPathProvider    = "replicated.com/hostpath"
	SnapshotStoreNFSProvider         = "replicated.com/nfs"
	SnapshotStorePVCProvider         = "replicated.com/pvc"
	SnapshotStorePVCBucket           = "velero-internal-snapshots"
)
View Source
const (
	FileSystemLVPConfigMapName = "kotsadm-fs-lvp"
)
View Source
const (
	VeleroNamespaceConfigMapName = "kotsadm-velero-namespace"
)

Variables

This section is empty.

Functions

func BuildAWSCredentials

func BuildAWSCredentials(accessKeyID, secretAccessKey string) ([]byte, error)

func BuildLvpStoreFileSystem

func BuildLvpStoreFileSystem(config *types.FileSystemConfig) *types.StoreFileSystem

func BuildMinioStoreFileSystem

func BuildMinioStoreFileSystem(ctx context.Context, clientset kubernetes.Interface, kotsadmNamespace string) (*types.StoreFileSystem, error)

func CheckKotsadmVeleroAccess

func CheckKotsadmVeleroAccess(ctx context.Context, kotsadmNamespace string) (requiresAccess bool, finalErr error)

func ConfigureStore

func ConfigureStore(ctx context.Context, options ConfigureStoreOptions) (*types.Store, error)

func CreateFileSystemMinioBucket

func CreateFileSystemMinioBucket(ctx context.Context, clientset kubernetes.Interface, namespace string, registryConfig kotsadmtypes.RegistryConfig) error

func DeleteFileSystemMinio

func DeleteFileSystemMinio(ctx context.Context, kotsadmNamespace string) error

DeleteFileSystemMinio cleans up the minio resources for hostpath and nfs snapshot deployments. The secret is not deleted, just in case.

func DeployFileSystemLvp

func DeployFileSystemLvp(ctx context.Context, clientset kubernetes.Interface, deployOptions FileSystemDeployOptions, registryConfig kotsadmtypes.RegistryConfig) error

func DeployFileSystemMinio

func DeployFileSystemMinio(ctx context.Context, clientset kubernetes.Interface, deployOptions FileSystemDeployOptions, registryConfig kotsadmtypes.RegistryConfig) error

func DetectVeleroNamespace

func DetectVeleroNamespace(ctx context.Context, clientset kubernetes.Interface, kotsadmNamespace string) (string, error)

DetectVeleroNamespace will detect and validate the velero namespace kotsadmNamespace is only required in minimal rbac installations. if empty, cluster scope privileges will be needed to detect and validate velero

func EnsureLocalVolumeProviderConfigMaps added in v1.91.1

func EnsureLocalVolumeProviderConfigMaps(deployOptions FileSystemDeployOptions, veleroNamespace string) error

EnsureLocalVolumeProviderConfigMaps ensures two configmaps: one customizes the LVP plugin deployment with a config map based on the chosen file system backing and the detection of Openshift. This ensures that Velero and NodeAgent have permissions to write to the disk. the second config map is used to store the current file system configuration.

func EnsureVeleroNamespaceConfigMap

func EnsureVeleroNamespaceConfigMap(ctx context.Context, clientset kubernetes.Interface, veleroNamespace string, kotsadmNamespace string) error

func EnsureVeleroPermissions

func EnsureVeleroPermissions(ctx context.Context, clientset kubernetes.Interface, veleroNamespace string, kotsadmNamespace string) error

func FindBackupStoreLocation

func FindBackupStoreLocation(ctx context.Context, clientset kubernetes.Interface, veleroClient veleroclientv1.VeleroV1Interface, kotsadmNamespace string) (*velerov1.BackupStorageLocation, error)

FindBackupStoreLocation will find the backup storage location used by velero kotsadmNamespace is only required in minimal rbac installations. if empty, cluster scope privileges will be needed to detect and validate velero

func GetCurrentFileSystemConfig

func GetCurrentFileSystemConfig(ctx context.Context, namespace string, isMinioDisabled bool) (*types.FileSystemConfig, error)

func GetCurrentLvpFileSystemConfig

func GetCurrentLvpFileSystemConfig(ctx context.Context, namespace string) (*types.FileSystemConfig, error)

func GetCurrentMinioFileSystemConfig

func GetCurrentMinioFileSystemConfig(ctx context.Context, namespace string) (*types.FileSystemConfig, error)

func GetFileSystemMinioErrors

func GetFileSystemMinioErrors(ctx context.Context, clientset kubernetes.Interface) map[string]string

Finds the latest FS utility pod of every kind and looks for errors in the events for the pods.

func GetGlobalStore

func GetGlobalStore(ctx context.Context, kotsadmNamespace string, bsl *velerov1.BackupStorageLocation) (*types.Store, error)

GetGlobalStore will return the global store from the current backup storage location or will find it, if the param is nil

func GetLvpBucket

func GetLvpBucket(fsConfig *types.FileSystemConfig) (string, error)

GetLvpBucket returns the bucket/volume name used for the LVP backup. It includes a hash of the Filesystem configuration

func GetLvpProvider

func GetLvpProvider(fsConfig *types.FileSystemConfig) string

GetLvpProvider returns the name of the Lvp provider corresponding to the desired filesystem configuration

func IsFileSystemMinioDisabled

func IsFileSystemMinioDisabled(kotsadmNamespace string) (bool, error)

IsFileSystemMinioDisable returns the value of an internal KOTS config map entry indicating if this installation has opted in or out of migrating from Minio to the LVP plugin.

func ListAllBackups

func ListAllBackups(ctx context.Context, options ListInstanceBackupsOptions) ([]velerov1.Backup, error)

func ListInstanceBackups

func ListInstanceBackups(ctx context.Context, options ListInstanceBackupsOptions) ([]velerov1.Backup, error)

func ListInstanceRestores

func ListInstanceRestores(ctx context.Context, options ListInstanceRestoresOptions) ([]velerov1.Restore, error)

func Redact

func Redact(store *types.Store) error

func RestoreInstanceBackup

func RestoreInstanceBackup(ctx context.Context, options RestoreInstanceBackupOptions) error

func RevertToMinioFS

func RevertToMinioFS(ctx context.Context, clientset kubernetes.Interface, veleroClient veleroclientv1.VeleroV1Interface, kotsadmNamespace, veleroNamespace string, previousBsl *velerov1api.BackupStorageLocation) error

RevertToMinioFS will apply the spec of the previous BSL to the current one and then update. Used for recovery during a failed migration from Minio to LVP.

func TryGetVeleroNamespaceFromConfigMap

func TryGetVeleroNamespaceFromConfigMap(ctx context.Context, clientset kubernetes.Interface, kotsadmNamespace string) string

TryGetVeleroNamespaceFromConfigMap in the case of minimal rbac installations, a configmap containing the velero namespace will be created once the user gives kotsadm access to velero using the cli

func UpdateBackupStorageLocation

func UpdateBackupStorageLocation(ctx context.Context, veleroNamespace string, bsl *velerov1.BackupStorageLocation) error

UpdateBackupStorageLocation applies an updated Velero backup storage location resource to the cluster

func ValidateFileSystemDeployment

func ValidateFileSystemDeployment(ctx context.Context, clientset kubernetes.Interface, deployOptions FileSystemDeployOptions, registryConfig kotsadmtypes.RegistryConfig) (bool, bool, error)

func WaitForDefaultBslAvailableAndSynced

func WaitForDefaultBslAvailableAndSynced(ctx context.Context, veleroNamespace string, start metav1.Time) error

WaitForDefaultBslAvailableAndSynced blocks execution until the default backup storage location to display a status as "AVAILABLE" and also until the backups in the location are available through the Velero api. There is a timeout of 5 minutes, though the default Velero sync time is only 1 minute.

Types

type BackupResponse

type BackupResponse struct {
	Success    bool   `json:"success"`
	BackupName string `json:"backupName,omitempty"`
	Error      string `json:"error,omitempty"`
}

func CreateInstanceBackup

func CreateInstanceBackup(ctx context.Context, options CreateInstanceBackupOptions) (*BackupResponse, error)

type ConfigureStoreOptions

type ConfigureStoreOptions struct {
	Provider   string
	Bucket     string
	Path       string
	CACertData []byte

	AWS        *types.StoreAWS
	Google     *types.StoreGoogle
	Azure      *types.StoreAzure
	Other      *types.StoreOther
	Internal   bool
	FileSystem *types.FileSystemConfig

	KotsadmNamespace string
	RegistryConfig   *kotsadmtypes.RegistryConfig

	// If set to true, will validate the endpoint and the bucket using a pod instead (when applicable).
	// Will be ignored if SkipValidation is set to true.
	ValidateUsingAPod bool
	SkipValidation    bool
	IsMinioDisabled   bool
}

type CreateInstanceBackupOptions

type CreateInstanceBackupOptions struct {
	Namespace string
	Wait      bool
	Silent    bool
}

type FileSystemDeployOptions

type FileSystemDeployOptions struct {
	Namespace        string
	IsOpenShift      bool
	ForceReset       bool
	FileSystemConfig types.FileSystemConfig
}

type HostPathNotFoundError

type HostPathNotFoundError struct {
	Message string
}

func (HostPathNotFoundError) Error

func (e HostPathNotFoundError) Error() string

type InvalidStoreDataError

type InvalidStoreDataError struct {
	Message string
}

func (*InvalidStoreDataError) Error

func (e *InvalidStoreDataError) Error() string

type ListInstanceBackupsOptions

type ListInstanceBackupsOptions struct {
	Namespace string
}

type ListInstanceRestoresOptions

type ListInstanceRestoresOptions struct {
	Namespace string
}

type ResetFileSystemError

type ResetFileSystemError struct {
	Message string
}

func (ResetFileSystemError) Error

func (e ResetFileSystemError) Error() string

type RestoreInstanceBackupOptions

type RestoreInstanceBackupOptions struct {
	BackupName          string
	ExcludeAdminConsole bool
	ExcludeApps         bool
	WaitForApps         bool
	VeleroNamespace     string
	Silent              bool
}

type ValidateStoreOptions

type ValidateStoreOptions struct {
	KotsadmNamespace string
	RegistryConfig   *kotsadmtypes.RegistryConfig
	CACertData       []byte
	// If set to true, will validate the endpoint and the bucket using a pod instead (when applicable)
	ValidateUsingAPod bool
}

type VeleroRBACResponse

type VeleroRBACResponse struct {
	Success                     bool   `json:"success"`
	Error                       string `json:"error,omitempty"`
	KotsadmNamespace            string `json:"kotsadmNamespace,omitempty"`
	KotsadmRequiresVeleroAccess bool   `json:"kotsadmRequiresVeleroAccess,omitempty"`
}

type VeleroStatus

type VeleroStatus struct {
	Version       string
	Plugins       []string
	Status        string
	Namespace     string
	VeleroPod     string
	NodeAgentPods []string

	NodeAgentVersion string
	NodeAgentStatus  string
}

func DetectVelero

func DetectVelero(ctx context.Context, kotsadmNamespace string) (*VeleroStatus, error)

func (*VeleroStatus) ContainsPlugin

func (s *VeleroStatus) ContainsPlugin(plugin string) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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