Documentation ¶
Index ¶
- Constants
- Variables
- func GarbageCollectCommonStruct()
- func GetBackup(uid types.UID, name string, namespace string) (*velero.Backup, error)
- func GetBackupStorageLocation(name, namespace string) (*velero.BackupStorageLocation, error)
- func GetOwnerReferences(item runtime.Unstructured) ([]metav1.OwnerReference, error)
- func GetRegistryInfo(log logrus.FieldLogger) (string, error)
- func GetSecretKeyForBackupStorageLocation(name, namespace string) (*corev1.Secret, string, error)
- func GetServerVersion() (int, int, error)
- func GetSrcAndDestRegistryInfo(item runtime.Unstructured) (string, string, error)
- func GetVeleroV1Client() (*rest.RESTClient, error)
- func HasImageRefPrefix(s, prefix string) bool
- func ReplaceImageRefPrefix(s, oldPrefix, newPrefix string, namespaceMapping map[string]string) (string, error)
- func StringInSlice(a string, list []string) bool
- func StringPtr(s string) *string
- func SwapContainerImageRefs(containers []corev1API.Container, oldRegistry, newRegistry string, ...)
- func UpdatePullSecret(secretRef *corev1API.LocalObjectReference, secretList *corev1API.SecretList, ...) (*corev1API.LocalObjectReference, error)
- type APIServerConfig
- type BackupPlugin
- type CommonStruct
- type LocalImageReference
- type ResourceHookSelector
- type RestorePlugin
Constants ¶
const ( BackupServerVersion string = "openshift.io/backup-server-version" RestoreServerVersion string = "openshift.io/restore-server-version" BackupRegistryHostname string = "openshift.io/backup-registry-hostname" RestoreRegistryHostname string = "openshift.io/restore-registry-hostname" MigrationRegistry string = "openshift.io/migration-registry" PausedOwnerRef string = "openshift.io/paused-owner-ref" // distinction for B/R and migration MigrationApplicationLabelKey string = "app.kubernetes.io/part-of" MigrationApplicationLabelValue string = "openshift-migration" )
src/dest cluster annotations, general migration
const ( // Whether the backup/restore is associated with a stage or a final migration StageOrFinalMigrationAnnotation string = "migration.openshift.io/migmigration-type" // (stage|final) StageMigration string = "stage" FinalMigration string = "final" // Resources included in the stage backup. // Referenced by the Backup.LabelSelector. The value is the Task.UID(). IncludedInStageBackupLabel = "migration-included-stage-backup" // Designated as an `initial` Backup. // The value is the Task.UID(). InitialBackupLabel = "migration-initial-backup" // Designated as an `stage` Backup. // The value is the Task.UID(). StageBackupLabel = "migration-stage-backup" // Designated as an `stage` Restore. // The value is the Task.UID(). StageRestoreLabel = "migration-stage-restore" // Designated as a `final` Restore. // The value is the Task.UID(). FinalRestoreLabel = "migration-final-restore" // Exclude PVCs if marked "move" or "snapshot" in the plan ExcludePVCPodAnnotation = "migration.openshift.io/exclude-pvcs" )
annotations and labels related to stage vs. initial/final migrations/restores
const ( MigrateTypeAnnotation string = "openshift.io/migrate-type" // copy, move MigrateStorageClassAnnotation string = "openshift.io/target-storage-class" MigrateAccessModeAnnotation string = "openshift.io/target-access-mode" MigrateCopyMethodAnnotation string = "migration.openshift.io/copy-method" // snapshot, filesystem PvCopyAction string = "copy" PvMoveAction string = "move" PvFilesystemCopyMethod string = "filesystem" PvSnapshotCopyMethod string = "snapshot" )
PV selection annotations
const ( StagePodImageAnnotation string = "migration.openshift.io/stage-pod-image" // Stage pod (sleep) image RelatedIsTagNsAnnotation string = "migration.openshift.io/related-istag-ns" // Related istag ns RelatedIsTagAnnotation string = "migration.openshift.io/related-istag" // Related istag name PVCSelectedNodeAnnotation string = "volume.kubernetes.io/selected-node" // kubernetes PVC annotations ResticBackupAnnotation string = "backup.velero.io/backup-volumes" // Restic annotations PVOriginalReclaimPolicy string = "migration.openshift.io/orig-reclaim-policy" // Original PersistentVolumeReclaimPolicy )
Other annotations
const ( DCPodDeploymentLabel string = "deployment" // identifies associated RC DCPodDeploymentConfigLabel string = "deploymentconfig" // identifies associated DC DCPodDisconnectedLabel string = "oadp.openshift.io/disconnected-from-dc" // pod had DC labels removed on restore DCOriginalReplicas string = "oadp.openshift.io/original-replicas" // replicas value from backup DCOriginalPaused string = "oadp.openshift.io/original-paused" // replicas value from backup DCReplicasModifiedLabel string = "oadp.openshift.io/replicas-modified" // DC replicas modified on restore )
DC-related labels/annotations
const ( MigMigrationLabelKey string = "migration.openshift.io/migrated-by-migmigration" MigPlanLabelKey string = "migration.openshift.io/migrated-by-migplan" )
Restored items label
const ( // Post Restore Hook must contain this annotation PostRestoreHookAnnotation string = "post.hook.restore.velero.io/command" //InitContainer restore hook must contain this annotation InitContainerRestoreHookAnnotation string = "init.hook.restore.velero.io/container-image" )
const DisableImageCopy string = "migration.openshift.io/disable-image-copy"
const RegistryConfigMap string = "oadp-registry-config"
Configmap Name
const SkipImageCopy string = "openshift.io/skip-image-copy"
Variables ¶
var (
BackupUidMap map[types.UID]*CommonStruct
)
Functions ¶
func GarbageCollectCommonStruct ¶ added in v1.1.0
func GarbageCollectCommonStruct()
GarbageCollectCommonStructs removes old entries from the cache
func GetBackupStorageLocation ¶ added in v1.1.0
func GetBackupStorageLocation(name, namespace string) (*velero.BackupStorageLocation, error)
func GetOwnerReferences ¶
func GetOwnerReferences(item runtime.Unstructured) ([]metav1.OwnerReference, error)
GetOwnerReferences returns the array of OwnerReferences associated with the resource
func GetRegistryInfo ¶
func GetRegistryInfo(log logrus.FieldLogger) (string, error)
func GetSecretKeyForBackupStorageLocation ¶ added in v1.1.0
Get secret for backup storage location along with key to use to get secret data.
func GetServerVersion ¶
returns major, minor versions for kube
func GetSrcAndDestRegistryInfo ¶
func GetSrcAndDestRegistryInfo(item runtime.Unstructured) (string, string, error)
GetSrcAndDestRegistryInfo returns the Registry hostname for both src and dest clusters
func GetVeleroV1Client ¶ added in v1.1.0
func GetVeleroV1Client() (*rest.RESTClient, error)
func HasImageRefPrefix ¶
HasImageRefPrefix returns true if the input image reference begins with the input prefix followed by "/"
func ReplaceImageRefPrefix ¶
func ReplaceImageRefPrefix(s, oldPrefix, newPrefix string, namespaceMapping map[string]string) (string, error)
ReplaceImageRefPrefix replaces an image reference prefix with newPrefix. If the input image reference does not start with oldPrefix, an error is returned
func StringInSlice ¶
func SwapContainerImageRefs ¶
func SwapContainerImageRefs(containers []corev1API.Container, oldRegistry, newRegistry string, log logrus.FieldLogger, namespaceMapping map[string]string)
SwapContainerImageRefs updates internal image references from backup registry to restore registry pathnames
func UpdatePullSecret ¶
func UpdatePullSecret( secretRef *corev1API.LocalObjectReference, secretList *corev1API.SecretList, log logrus.FieldLogger, ) (*corev1API.LocalObjectReference, error)
UpdatePullSecret updates registry pull (or push) secret with a secret found in the dest cluster
Types ¶
type APIServerConfig ¶
type APIServerConfig struct { ImagePolicyConfig imagePolicyConfig `json:"imagePolicyConfig"` RoutingConfig routingConfig `json:"routingConfig"` }
APIServerConfig stores configuration information about the current cluster
type BackupPlugin ¶
type BackupPlugin struct {
Log logrus.FieldLogger
}
BackupPlugin is a backup item action plugin for Heptio Ark.
func (*BackupPlugin) AppliesTo ¶
func (p *BackupPlugin) AppliesTo() (velero.ResourceSelector, error)
AppliesTo returns a velero.ResourceSelector that applies to the listed resources in the slice.
func (*BackupPlugin) Execute ¶
func (p *BackupPlugin) Execute(item runtime.Unstructured, backup *v1.Backup) (runtime.Unstructured, []velero.ResourceIdentifier, error)
Execute sets a custom annotation on the item being backed up. Finds OADP Registry to copy images to and set as migrationRegistry.
type CommonStruct ¶ added in v1.1.0
type CommonStruct struct { Backup *velero.Backup Ut *udistribution.UdistributionTransport // contains filtered or unexported fields }
common cache for backup UIDs
func (*CommonStruct) JustAccessed ¶ added in v1.1.0
func (c *CommonStruct) JustAccessed()
JustAccessed marks the item as recently accessed and triggers garbage collection
type LocalImageReference ¶
type LocalImageReference struct { Registry string Namespace string Name string Tag string Digest string }
LocalImageReference describes an image in the internal openshift registry
func ParseLocalImageReference ¶
func ParseLocalImageReference(s, prefix string) (*LocalImageReference, error)
ParseLocalImageReference
type ResourceHookSelector ¶
type ResourceHookSelector struct { Namespaces *collections.IncludesExcludes Resources *collections.IncludesExcludes LabelSelector labels.Selector }
func (ResourceHookSelector) ApplicableTo ¶
func (r ResourceHookSelector) ApplicableTo(groupResource schema.GroupResource, namespace string, labels labels.Set) bool
type RestorePlugin ¶
type RestorePlugin struct {
Log logrus.FieldLogger
}
RestorePlugin is a restore item action plugin for Heptio Ark.
func (*RestorePlugin) AppliesTo ¶
func (p *RestorePlugin) AppliesTo() (velero.ResourceSelector, error)
AppliesTo returns a velero.ResourceSelector that applies to the listed resources in the slice.
func (*RestorePlugin) Execute ¶
func (p *RestorePlugin) Execute(input *velero.RestoreItemActionExecuteInput) (*velero.RestoreItemActionExecuteOutput, error)
Execute sets a custom annotation on the item being restored.