velero API type changes for structural schema CRDs (#1898)

* velero API type changes for structural schema CRDs

- make optional fields consistent with comment and omitempty struct tags
- adds kubebuilder annotations for structural schema validations

Signed-off-by: Adnan Abdulhussein <aadnan@vmware.com>

* update generated crds

Signed-off-by: Adnan Abdulhussein <aadnan@vmware.com>

* update velero install to use structural schema generated crds

Signed-off-by: Adnan Abdulhussein <aadnan@vmware.com>

* move enum declarations closer to type declarations

Signed-off-by: Adnan Abdulhussein <aadnan@vmware.com>

* add labels to generated crds

Signed-off-by: Adnan Abdulhussein <aadnan@vmware.com>

* allow null values in some fields

Signed-off-by: Adnan Abdulhussein <aadnan@vmware.com>

* allow labelSelector to be null

Signed-off-by: Adnan Abdulhussein <aadnan@vmware.com>

* remove debug statement

Signed-off-by: Adnan Abdulhussein <aadnan@vmware.com>

* make update

Signed-off-by: Adnan Abdulhussein <aadnan@vmware.com>

* add enum validations for CRD phases

Signed-off-by: Adnan Abdulhussein <aadnan@vmware.com>

* changelog

Signed-off-by: Adnan Abdulhussein <aadnan@vmware.com>
This commit is contained in:
Adnan Abdulhussein
2019-09-24 15:37:28 -07:00
committed by Nolan Brubaker
parent 5e22f9c1c8
commit dd088e3475
27 changed files with 526 additions and 340 deletions

View File

@@ -0,0 +1 @@
adds structural schema to Velero CRDs created on Velero install, enabling validation of Velero API fields

View File

@@ -24,52 +24,72 @@ import (
type BackupSpec struct {
// IncludedNamespaces is a slice of namespace names to include objects
// from. If empty, all namespaces are included.
IncludedNamespaces []string `json:"includedNamespaces"`
// +optional
// +nullable
IncludedNamespaces []string `json:"includedNamespaces,omitempty"`
// ExcludedNamespaces contains a list of namespaces that are not
// included in the backup.
ExcludedNamespaces []string `json:"excludedNamespaces"`
// +optional
// +nullable
ExcludedNamespaces []string `json:"excludedNamespaces,omitempty"`
// IncludedResources is a slice of resource names to include
// in the backup. If empty, all resources are included.
IncludedResources []string `json:"includedResources"`
// +optional
// +nullable
IncludedResources []string `json:"includedResources,omitempty"`
// ExcludedResources is a slice of resource names that are not
// included in the backup.
ExcludedResources []string `json:"excludedResources"`
// +optional
// +nullable
ExcludedResources []string `json:"excludedResources,omitempty"`
// LabelSelector is a metav1.LabelSelector to filter with
// when adding individual objects to the backup. If empty
// or nil, all objects are included. Optional.
LabelSelector *metav1.LabelSelector `json:"labelSelector"`
// +optional
// +nullable
LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty"`
// SnapshotVolumes specifies whether to take cloud snapshots
// of any PV's referenced in the set of objects included
// in the Backup.
// +optional
// +nullable
SnapshotVolumes *bool `json:"snapshotVolumes,omitempty"`
// TTL is a time.Duration-parseable string describing how long
// the Backup should be retained for.
TTL metav1.Duration `json:"ttl"`
// +optional
TTL metav1.Duration `json:"ttl,omitempty"`
// IncludeClusterResources specifies whether cluster-scoped resources
// should be included for consideration in the backup.
IncludeClusterResources *bool `json:"includeClusterResources"`
// +optional
// +nullable
IncludeClusterResources *bool `json:"includeClusterResources,omitempty"`
// Hooks represent custom behaviors that should be executed at different phases of the backup.
Hooks BackupHooks `json:"hooks"`
// +optional
Hooks BackupHooks `json:"hooks,omitempty"`
// StorageLocation is a string containing the name of a BackupStorageLocation where the backup should be stored.
StorageLocation string `json:"storageLocation"`
// +optional
StorageLocation string `json:"storageLocation,omitempty"`
// VolumeSnapshotLocations is a list containing names of VolumeSnapshotLocations associated with this backup.
VolumeSnapshotLocations []string `json:"volumeSnapshotLocations"`
// +optional
VolumeSnapshotLocations []string `json:"volumeSnapshotLocations,omitempty"`
}
// BackupHooks contains custom behaviors that should be executed at different phases of the backup.
type BackupHooks struct {
// Resources are hooks that should be executed when backing up individual instances of a resource.
Resources []BackupResourceHookSpec `json:"resources"`
// +optional
// +nullable
Resources []BackupResourceHookSpec `json:"resources,omitempty"`
}
// BackupResourceHookSpec defines one or more BackupResourceHooks that should be executed based on
@@ -77,23 +97,42 @@ type BackupHooks struct {
type BackupResourceHookSpec struct {
// Name is the name of this hook.
Name string `json:"name"`
// IncludedNamespaces specifies the namespaces to which this hook spec applies. If empty, it applies
// to all namespaces.
IncludedNamespaces []string `json:"includedNamespaces"`
// +optional
// +nullable
IncludedNamespaces []string `json:"includedNamespaces,omitempty"`
// ExcludedNamespaces specifies the namespaces to which this hook spec does not apply.
ExcludedNamespaces []string `json:"excludedNamespaces"`
// +optional
// +nullable
ExcludedNamespaces []string `json:"excludedNamespaces,omitempty"`
// IncludedResources specifies the resources to which this hook spec applies. If empty, it applies
// to all resources.
IncludedResources []string `json:"includedResources"`
// +optional
// +nullable
IncludedResources []string `json:"includedResources,omitempty"`
// ExcludedResources specifies the resources to which this hook spec does not apply.
ExcludedResources []string `json:"excludedResources"`
// +optional
// +nullable
ExcludedResources []string `json:"excludedResources,omitempty"`
// LabelSelector, if specified, filters the resources to which this hook spec applies.
// +optional
// +nullable
LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty"`
// PreHooks is a list of BackupResourceHooks to execute prior to storing the item in the backup.
// These are executed before any "additional items" from item actions are processed.
// +optional
PreHooks []BackupResourceHook `json:"pre,omitempty"`
// PostHooks is a list of BackupResourceHooks to execute after storing the item in the backup.
// These are executed after all "additional items" from item actions are processed.
// +optional
PostHooks []BackupResourceHook `json:"post,omitempty"`
}
@@ -107,23 +146,32 @@ type BackupResourceHook struct {
type ExecHook struct {
// Container is the container in the pod where the command should be executed. If not specified,
// the pod's first container is used.
Container string `json:"container"`
// +optional
Container string `json:"container,omitempty"`
// Command is the command and arguments to execute.
// +kubebuilder:validation:MinItems=1
Command []string `json:"command"`
// OnError specifies how Velero should behave if it encounters an error executing this hook.
OnError HookErrorMode `json:"onError"`
// +optional
OnError HookErrorMode `json:"onError,omitempty"`
// Timeout defines the maximum amount of time Velero should wait for the hook to complete before
// considering the execution a failure.
Timeout metav1.Duration `json:"timeout"`
// +optional
Timeout metav1.Duration `json:"timeout,omitempty"`
}
// HookErrorMode defines how Velero should treat an error from a hook.
// +kubebuilder:validation:Enum=Continue;Fail
type HookErrorMode string
const (
// HookErrorModeContinue means that an error from a hook is acceptable, and the backup can
// proceed.
HookErrorModeContinue HookErrorMode = "Continue"
// HookErrorModeFail means that an error from a hook is problematic, and the backup should be in
// error.
HookErrorModeFail HookErrorMode = "Fail"
@@ -131,6 +179,7 @@ const (
// BackupPhase is a string representation of the lifecycle phase
// of a Velero backup.
// +kubebuilder:validation:Enum=New;FailedValidation;InProgress;Completed;PartiallyFailed;Failed;Deleting
type BackupPhase string
const (
@@ -164,47 +213,61 @@ const (
// BackupStatus captures the current status of a Velero backup.
type BackupStatus struct {
// Version is the backup format version.
Version int `json:"version"`
// +optional
Version int `json:"version,omitempty"`
// Expiration is when this Backup is eligible for garbage-collection.
Expiration metav1.Time `json:"expiration"`
// +optional
// +nullable
Expiration metav1.Time `json:"expiration,omitempty"`
// Phase is the current state of the Backup.
Phase BackupPhase `json:"phase"`
// +optional
Phase BackupPhase `json:"phase,omitempty"`
// ValidationErrors is a slice of all validation errors (if
// applicable).
ValidationErrors []string `json:"validationErrors"`
// +optional
// +nullable
ValidationErrors []string `json:"validationErrors,omitempty"`
// StartTimestamp records the time a backup was started.
// Separate from CreationTimestamp, since that value changes
// on restores.
// The server's time is used for StartTimestamps
StartTimestamp metav1.Time `json:"startTimestamp"`
// +optional
// +nullable
StartTimestamp metav1.Time `json:"startTimestamp,omitempty"`
// CompletionTimestamp records the time a backup was completed.
// Completion time is recorded even on failed backups.
// Completion time is recorded before uploading the backup object.
// The server's time is used for CompletionTimestamps
CompletionTimestamp metav1.Time `json:"completionTimestamp"`
// +optional
// +nullable
CompletionTimestamp metav1.Time `json:"completionTimestamp,omitempty"`
// VolumeSnapshotsAttempted is the total number of attempted
// volume snapshots for this backup.
VolumeSnapshotsAttempted int `json:"volumeSnapshotsAttempted"`
// +optional
VolumeSnapshotsAttempted int `json:"volumeSnapshotsAttempted,omitempty"`
// VolumeSnapshotsCompleted is the total number of successfully
// completed volume snapshots for this backup.
VolumeSnapshotsCompleted int `json:"volumeSnapshotsCompleted"`
// +optional
VolumeSnapshotsCompleted int `json:"volumeSnapshotsCompleted,omitempty"`
// Warnings is a count of all warning messages that were generated during
// execution of the backup. The actual warnings are in the backup's log
// file in object storage.
Warnings int `json:"warnings"`
// +optional
Warnings int `json:"warnings,omitempty"`
// Errors is a count of all error messages that were generated during
// execution of the backup. The actual errors are in the backup's log
// file in object storage.
Errors int `json:"errors"`
// +optional
Errors int `json:"errors,omitempty"`
}
// +genclient
@@ -213,10 +276,15 @@ type BackupStatus struct {
// Backup is a Velero resource that respresents the capture of Kubernetes
// cluster state at a point in time (API objects and associated volume state).
type Backup struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata"`
metav1.TypeMeta `json:",inline"`
Spec BackupSpec `json:"spec"`
// +optional
metav1.ObjectMeta `json:"metadata,omitempty"`
// +optional
Spec BackupSpec `json:"spec,omitempty"`
// +optional
Status BackupStatus `json:"status,omitempty"`
}
@@ -225,6 +293,9 @@ type Backup struct {
// BackupList is a list of Backups.
type BackupList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []Backup `json:"items"`
// +optional
metav1.ListMeta `json:"metadata,omitempty"`
Items []Backup `json:"items"`
}

View File

@@ -26,11 +26,16 @@ import (
// BackupStorageLocation is a location where Velero stores backup objects.
type BackupStorageLocation struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata"`
metav1.TypeMeta `json:",inline"`
Spec BackupStorageLocationSpec `json:"spec"`
Status BackupStorageLocationStatus `json:"status"`
// +optional
metav1.ObjectMeta `json:"metadata,omitempty"`
// +optional
Spec BackupStorageLocationSpec `json:"spec,omitempty"`
// +optional
Status BackupStorageLocationStatus `json:"status,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
@@ -38,14 +43,17 @@ type BackupStorageLocation struct {
// BackupStorageLocationList is a list of BackupStorageLocations.
type BackupStorageLocationList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []BackupStorageLocation `json:"items"`
// +optional
metav1.ListMeta `json:"metadata,omitempty"`
Items []BackupStorageLocation `json:"items"`
}
// StorageType represents the type of storage that a backup location uses.
// ObjectStorage must be non-nil, since it is currently the only supported StorageType.
type StorageType struct {
ObjectStorage *ObjectStorageLocation `json:"objectStorage,omitempty"`
ObjectStorage *ObjectStorageLocation `json:"objectStorage"`
}
// ObjectStorageLocation specifies the settings necessary to connect to a provider's object storage.
@@ -54,7 +62,8 @@ type ObjectStorageLocation struct {
Bucket string `json:"bucket"`
// Prefix is the path inside a bucket to use for Velero storage. Optional.
Prefix string `json:"prefix"`
// +optional
Prefix string `json:"prefix,omitempty"`
}
// BackupStorageLocationSpec defines the specification for a Velero BackupStorageLocation.
@@ -63,15 +72,18 @@ type BackupStorageLocationSpec struct {
Provider string `json:"provider"`
// Config is for provider-specific configuration fields.
Config map[string]string `json:"config"`
// +optional
Config map[string]string `json:"config,omitempty"`
StorageType `json:",inline"`
// AccessMode defines the permissions for the backup storage location.
// +optional
AccessMode BackupStorageLocationAccessMode `json:"accessMode,omitempty"`
}
// BackupStorageLocationPhase is the lifecyle phase of a Velero BackupStorageLocation.
// +kubebuilder:validation:Enum=Available;Unavailable
type BackupStorageLocationPhase string
const (
@@ -83,6 +95,7 @@ const (
)
// BackupStorageLocationAccessMode represents the permissions for a BackupStorageLocation.
// +kubebuilder:validation:Enum=ReadOnly;ReadWrite
type BackupStorageLocationAccessMode string
const (
@@ -97,13 +110,20 @@ const (
// BackupStorageLocationStatus describes the current status of a Velero BackupStorageLocation.
type BackupStorageLocationStatus struct {
Phase BackupStorageLocationPhase `json:"phase,omitempty"`
LastSyncedRevision types.UID `json:"lastSyncedRevision,omitempty"`
LastSyncedTime metav1.Time `json:"lastSyncedTime,omitempty"`
// +optional
Phase BackupStorageLocationPhase `json:"phase,omitempty"`
// +optional
LastSyncedRevision types.UID `json:"lastSyncedRevision,omitempty"`
// +optional
// +nullable
LastSyncedTime metav1.Time `json:"lastSyncedTime,omitempty"`
// AccessMode is an unused field.
//
// Deprecated: there is now an AccessMode field on the Spec and this field
// will be removed entirely as of v2.0.
// +optional
AccessMode BackupStorageLocationAccessMode `json:"accessMode,omitempty"`
}

View File

@@ -24,13 +24,16 @@ type DeleteBackupRequestSpec struct {
}
// DeleteBackupRequestPhase represents the lifecycle phase of a DeleteBackupRequest.
// +kubebuilder:validation:Enum=New;InProgress;Processed
type DeleteBackupRequestPhase string
const (
// DeleteBackupRequestPhaseNew means the DeleteBackupRequest has not been processed yet.
DeleteBackupRequestPhaseNew DeleteBackupRequestPhase = "New"
// DeleteBackupRequestPhaseInProgress means the DeleteBackupRequest is being processed.
DeleteBackupRequestPhaseInProgress DeleteBackupRequestPhase = "InProgress"
// DeleteBackupRequestPhaseProcessed means the DeleteBackupRequest has been processed.
DeleteBackupRequestPhaseProcessed DeleteBackupRequestPhase = "Processed"
)
@@ -38,9 +41,13 @@ const (
// DeleteBackupRequestStatus is the current status of a DeleteBackupRequest.
type DeleteBackupRequestStatus struct {
// Phase is the current state of the DeleteBackupRequest.
Phase DeleteBackupRequestPhase `json:"phase"`
// +optional
Phase DeleteBackupRequestPhase `json:"phase,omitempty"`
// Errors contains any errors that were encountered during the deletion process.
Errors []string `json:"errors"`
// +optional
// +nullable
Errors []string `json:"errors,omitempty"`
}
// +genclient
@@ -48,10 +55,15 @@ type DeleteBackupRequestStatus struct {
// DeleteBackupRequest is a request to delete one or more backups.
type DeleteBackupRequest struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata"`
metav1.TypeMeta `json:",inline"`
Spec DeleteBackupRequestSpec `json:"spec"`
// +optional
metav1.ObjectMeta `json:"metadata,omitempty"`
// +optional
Spec DeleteBackupRequestSpec `json:"spec,omitempty"`
// +optional
Status DeleteBackupRequestStatus `json:"status,omitempty"`
}
@@ -60,6 +72,9 @@ type DeleteBackupRequest struct {
// DeleteBackupRequestList is a list of DeleteBackupRequests.
type DeleteBackupRequestList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []DeleteBackupRequest `json:"items"`
// +optional
metav1.ListMeta `json:"metadata,omitempty"`
Items []DeleteBackupRequest `json:"items"`
}

View File

@@ -25,6 +25,7 @@ type DownloadRequestSpec struct {
}
// DownloadTargetKind represents what type of file to download.
// +kubebuilder:validation:Enum=BackupLog;BackupContents;BackupVolumeSnapshot;BackupResourceList;RestoreLog;RestoreResults
type DownloadTargetKind string
const (
@@ -41,17 +42,20 @@ const (
type DownloadTarget struct {
// Kind is the type of file to download.
Kind DownloadTargetKind `json:"kind"`
// Name is the name of the kubernetes resource with which the file is associated.
Name string `json:"name"`
}
// DownloadRequestPhase represents the lifecycle phase of a DownloadRequest.
// +kubebuilder:validation:Enum=New;Processed
type DownloadRequestPhase string
const (
// DownloadRequestPhaseNew means the DownloadRequest has not been processed by the
// DownloadRequestController yet.
DownloadRequestPhaseNew DownloadRequestPhase = "New"
// DownloadRequestPhaseProcessed means the DownloadRequest has been processed by the
// DownloadRequestController.
DownloadRequestPhaseProcessed DownloadRequestPhase = "Processed"
@@ -60,11 +64,17 @@ const (
// DownloadRequestStatus is the current status of a DownloadRequest.
type DownloadRequestStatus struct {
// Phase is the current state of the DownloadRequest.
Phase DownloadRequestPhase `json:"phase"`
// +optional
Phase DownloadRequestPhase `json:"phase,omitempty"`
// DownloadURL contains the pre-signed URL for the target file.
DownloadURL string `json:"downloadURL"`
// +optional
DownloadURL string `json:"downloadURL,omitempty"`
// Expiration is when this DownloadRequest expires and can be deleted by the system.
Expiration metav1.Time `json:"expiration"`
// +optional
// +nullable
Expiration metav1.Time `json:"expiration,omitempty"`
}
// +genclient
@@ -73,10 +83,15 @@ type DownloadRequestStatus struct {
// DownloadRequest is a request to download an artifact from backup object storage, such as a backup
// log file.
type DownloadRequest struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata"`
metav1.TypeMeta `json:",inline"`
Spec DownloadRequestSpec `json:"spec"`
// +optional
metav1.ObjectMeta `json:"metadata,omitempty"`
// +optional
Spec DownloadRequestSpec `json:"spec,omitempty"`
// +optional
Status DownloadRequestStatus `json:"status,omitempty"`
}
@@ -85,6 +100,9 @@ type DownloadRequest struct {
// DownloadRequestList is a list of DownloadRequests.
type DownloadRequestList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []DownloadRequest `json:"items"`
// +optional
metav1.ListMeta `json:"metadata,omitempty"`
Items []DownloadRequest `json:"items"`
}

View File

@@ -42,10 +42,12 @@ type PodVolumeBackupSpec struct {
// Tags are a map of key-value pairs that should be applied to the
// volume backup as tags.
Tags map[string]string `json:"tags"`
// +optional
Tags map[string]string `json:"tags,omitempty"`
}
// PodVolumeBackupPhase represents the lifecycle phase of a PodVolumeBackup.
// +kubebuilder:validation:Enum=New;InProgress;Completed;Failed
type PodVolumeBackupPhase string
const (
@@ -58,43 +60,57 @@ const (
// PodVolumeBackupStatus is the current status of a PodVolumeBackup.
type PodVolumeBackupStatus struct {
// Phase is the current state of the PodVolumeBackup.
Phase PodVolumeBackupPhase `json:"phase"`
// +optional
Phase PodVolumeBackupPhase `json:"phase,omitempty"`
// Path is the full path within the controller pod being backed up.
Path string `json:"path"`
// +optional
Path string `json:"path,omitempty"`
// SnapshotID is the identifier for the snapshot of the pod volume.
SnapshotID string `json:"snapshotID"`
// +optional
SnapshotID string `json:"snapshotID,omitempty"`
// Message is a message about the pod volume backup's status.
Message string `json:"message"`
// +optional
Message string `json:"message,omitempty"`
// StartTimestamp records the time a backup was started.
// Separate from CreationTimestamp, since that value changes
// on restores.
// The server's time is used for StartTimestamps
StartTimestamp metav1.Time `json:"startTimestamp"`
// +optional
// +nullable
StartTimestamp metav1.Time `json:"startTimestamp,omitempty"`
// CompletionTimestamp records the time a backup was completed.
// Completion time is recorded even on failed backups.
// Completion time is recorded before uploading the backup object.
// The server's time is used for CompletionTimestamps
CompletionTimestamp metav1.Time `json:"completionTimestamp"`
// +optional
// +nullable
CompletionTimestamp metav1.Time `json:"completionTimestamp,omitempty"`
// Progress holds the total number of bytes of the volume and the current
// number of backed up bytes. This can be used to display progress information
// about the backup operation.
Progress PodVolumeOperationProgress `json:"progress"`
// +optional
Progress PodVolumeOperationProgress `json:"progress,omitempty"`
}
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type PodVolumeBackup struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata"`
metav1.TypeMeta `json:",inline"`
Spec PodVolumeBackupSpec `json:"spec"`
// +optional
metav1.ObjectMeta `json:"metadata,omitempty"`
// +optional
Spec PodVolumeBackupSpec `json:"spec,omitempty"`
// +optional
Status PodVolumeBackupStatus `json:"status,omitempty"`
}
@@ -103,6 +119,9 @@ type PodVolumeBackup struct {
// PodVolumeBackupList is a list of PodVolumeBackups.
type PodVolumeBackupList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []PodVolumeBackup `json:"items"`
// +optional
metav1.ListMeta `json:"metadata,omitempty"`
Items []PodVolumeBackup `json:"items"`
}

View File

@@ -19,6 +19,9 @@ package v1
// PodVolumeOperationProgress represents the progress of a
// PodVolumeBackup/Restore (restic) operation
type PodVolumeOperationProgress struct {
TotalBytes int64 `json:"totalBytes"`
BytesDone int64 `json:"bytesDone"`
// +optional
TotalBytes int64 `json:"totalBytes,omitempty"`
// +optional
BytesDone int64 `json:"bytesDone,omitempty"`
}

View File

@@ -41,6 +41,7 @@ type PodVolumeRestoreSpec struct {
}
// PodVolumeRestorePhase represents the lifecycle phase of a PodVolumeRestore.
// +kubebuilder:validation:Enum=New;InProgress;Completed;Failed
type PodVolumeRestorePhase string
const (
@@ -53,34 +54,46 @@ const (
// PodVolumeRestoreStatus is the current status of a PodVolumeRestore.
type PodVolumeRestoreStatus struct {
// Phase is the current state of the PodVolumeRestore.
Phase PodVolumeRestorePhase `json:"phase"`
// +optional
Phase PodVolumeRestorePhase `json:"phase,omitempty"`
// Message is a message about the pod volume restore's status.
Message string `json:"message"`
// +optional
Message string `json:"message,omitempty"`
// StartTimestamp records the time a restore was started.
// The server's time is used for StartTimestamps
StartTimestamp metav1.Time `json:"startTimestamp"`
// +optional
// +nullable
StartTimestamp metav1.Time `json:"startTimestamp,omitempty"`
// CompletionTimestamp records the time a restore was completed.
// Completion time is recorded even on failed restores.
// The server's time is used for CompletionTimestamps
CompletionTimestamp metav1.Time `json:"completionTimestamp"`
// +optional
// +nullable
CompletionTimestamp metav1.Time `json:"completionTimestamp,omitempty"`
// Progress holds the total number of bytes of the snapshot and the current
// number of restored bytes. This can be used to display progress information
// about the restore operation.
Progress PodVolumeOperationProgress `json:"progress"`
// +optional
Progress PodVolumeOperationProgress `json:"progress,omitempty"`
}
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type PodVolumeRestore struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata"`
metav1.TypeMeta `json:",inline"`
Spec PodVolumeRestoreSpec `json:"spec"`
// +optional
metav1.ObjectMeta `json:"metadata,omitempty"`
// +optional
Spec PodVolumeRestoreSpec `json:"spec,omitempty"`
// +optional
Status PodVolumeRestoreStatus `json:"status,omitempty"`
}
@@ -89,6 +102,9 @@ type PodVolumeRestore struct {
// PodVolumeRestoreList is a list of PodVolumeRestores.
type PodVolumeRestoreList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []PodVolumeRestore `json:"items"`
// +optional
metav1.ListMeta `json:"metadata,omitempty"`
Items []PodVolumeRestore `json:"items"`
}

View File

@@ -39,6 +39,7 @@ type ResticRepositorySpec struct {
}
// ResticRepositoryPhase represents the lifecycle phase of a ResticRepository.
// +kubebuilder:validation:Enum=New;Ready;NotReady
type ResticRepositoryPhase string
const (
@@ -50,23 +51,32 @@ const (
// ResticRepositoryStatus is the current status of a ResticRepository.
type ResticRepositoryStatus struct {
// Phase is the current state of the ResticRepository.
Phase ResticRepositoryPhase `json:"phase"`
// +optional
Phase ResticRepositoryPhase `json:"phase,omitempty"`
// Message is a message about the current status of the ResticRepository.
Message string `json:"message"`
// +optional
Message string `json:"message,omitempty"`
// LastMaintenanceTime is the last time maintenance was run.
LastMaintenanceTime metav1.Time `json:"lastMaintenanceTime"`
// +optional
// +nullable
LastMaintenanceTime metav1.Time `json:"lastMaintenanceTime,omitempty"`
}
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type ResticRepository struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata"`
metav1.TypeMeta `json:",inline"`
Spec ResticRepositorySpec `json:"spec"`
// +optional
metav1.ObjectMeta `json:"metadata,omitempty"`
// +optional
Spec ResticRepositorySpec `json:"spec,omitempty"`
// +optional
Status ResticRepositoryStatus `json:"status,omitempty"`
}
@@ -75,6 +85,9 @@ type ResticRepository struct {
// ResticRepositoryList is a list of ResticRepositories.
type ResticRepositoryList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []ResticRepository `json:"items"`
// +optional
metav1.ListMeta `json:"metadata,omitempty"`
Items []ResticRepository `json:"items"`
}

View File

@@ -27,47 +27,64 @@ type RestoreSpec struct {
// ScheduleName is the unique name of the Velero schedule to restore
// from. If specified, and BackupName is empty, Velero will restore
// from the most recent successful backup created from this schedule.
// +optional
ScheduleName string `json:"scheduleName,omitempty"`
// IncludedNamespaces is a slice of namespace names to include objects
// from. If empty, all namespaces are included.
IncludedNamespaces []string `json:"includedNamespaces"`
// +optional
// +nullable
IncludedNamespaces []string `json:"includedNamespaces,omitempty"`
// ExcludedNamespaces contains a list of namespaces that are not
// included in the restore.
ExcludedNamespaces []string `json:"excludedNamespaces"`
// +optional
// +nullable
ExcludedNamespaces []string `json:"excludedNamespaces,omitempty"`
// IncludedResources is a slice of resource names to include
// in the restore. If empty, all resources in the backup are included.
IncludedResources []string `json:"includedResources"`
// +optional
// +nullable
IncludedResources []string `json:"includedResources,omitempty"`
// ExcludedResources is a slice of resource names that are not
// included in the restore.
ExcludedResources []string `json:"excludedResources"`
// +optional
// +nullable
ExcludedResources []string `json:"excludedResources,omitempty"`
// NamespaceMapping is a map of source namespace names
// to target namespace names to restore into. Any source
// namespaces not included in the map will be restored into
// namespaces of the same name.
NamespaceMapping map[string]string `json:"namespaceMapping"`
// +optional
NamespaceMapping map[string]string `json:"namespaceMapping,omitempty"`
// LabelSelector is a metav1.LabelSelector to filter with
// when restoring individual objects from the backup. If empty
// or nil, all objects are included. Optional.
// +optional
// +nullable
LabelSelector *metav1.LabelSelector `json:"labelSelector,omitempty"`
// RestorePVs specifies whether to restore all included
// PVs from snapshot (via the cloudprovider).
// +optional
// +nullable
RestorePVs *bool `json:"restorePVs,omitempty"`
// IncludeClusterResources specifies whether cluster-scoped resources
// should be included for consideration in the restore. If null, defaults
// to true.
// +optional
// +nullable
IncludeClusterResources *bool `json:"includeClusterResources,omitempty"`
}
// RestorePhase is a string representation of the lifecycle phase
// of a Velero restore
// +kubebuilder:validation:Enum=New;FailedValidation;InProgress;Completed;PartiallyFailed;Failed
type RestorePhase string
const (
@@ -98,22 +115,28 @@ const (
// RestoreStatus captures the current status of a Velero restore
type RestoreStatus struct {
// Phase is the current state of the Restore
Phase RestorePhase `json:"phase"`
// +optional
Phase RestorePhase `json:"phase,omitempty"`
// ValidationErrors is a slice of all validation errors (if
// applicable)
ValidationErrors []string `json:"validationErrors"`
// +optional
// +nullable
ValidationErrors []string `json:"validationErrors,omitempty"`
// Warnings is a count of all warning messages that were generated during
// execution of the restore. The actual warnings are stored in object storage.
Warnings int `json:"warnings"`
// +optional
Warnings int `json:"warnings,omitempty"`
// Errors is a count of all error messages that were generated during
// execution of the restore. The actual errors are stored in object storage.
Errors int `json:"errors"`
// +optional
Errors int `json:"errors,omitempty"`
// FailureReason is an error that caused the entire restore to fail.
FailureReason string `json:"failureReason"`
// +optional
FailureReason string `json:"failureReason,omitempty"`
}
// +genclient
@@ -122,10 +145,15 @@ type RestoreStatus struct {
// Restore is a Velero resource that represents the application of
// resources from a Velero backup to a target Kubernetes cluster.
type Restore struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata"`
metav1.TypeMeta `json:",inline"`
Spec RestoreSpec `json:"spec"`
// +optional
metav1.ObjectMeta `json:"metadata,omitempty"`
// +optional
Spec RestoreSpec `json:"spec,omitempty"`
// +optional
Status RestoreStatus `json:"status,omitempty"`
}
@@ -134,6 +162,9 @@ type Restore struct {
// RestoreList is a list of Restores.
type RestoreList struct {
metav1.TypeMeta `json:",inline"`
// +optional
metav1.ListMeta `json:"metadata"`
Items []Restore `json:"items"`
Items []Restore `json:"items"`
}

View File

@@ -31,6 +31,7 @@ type ScheduleSpec struct {
// SchedulePhase is a string representation of the lifecycle phase
// of a Velero schedule
// +kubebuilder:validation:Enum=New;Enabled;FailedValidation
type SchedulePhase string
const (
@@ -50,15 +51,19 @@ const (
// ScheduleStatus captures the current state of a Velero schedule
type ScheduleStatus struct {
// Phase is the current phase of the Schedule
Phase SchedulePhase `json:"phase"`
// +optional
Phase SchedulePhase `json:"phase,omitempty"`
// LastBackup is the last time a Backup was run for this
// Schedule schedule
LastBackup metav1.Time `json:"lastBackup"`
// +optional
// +nullable
LastBackup metav1.Time `json:"lastBackup,omitempty"`
// ValidationErrors is a slice of all validation errors (if
// applicable)
ValidationErrors []string `json:"validationErrors"`
// +optional
ValidationErrors []string `json:"validationErrors,omitempty"`
}
// +genclient
@@ -67,10 +72,15 @@ type ScheduleStatus struct {
// Schedule is a Velero resource that represents a pre-scheduled or
// periodic Backup that should be run.
type Schedule struct {
metav1.TypeMeta `json:",inline"`
metav1.TypeMeta `json:",inline"`
// +optional
metav1.ObjectMeta `json:"metadata"`
Spec ScheduleSpec `json:"spec"`
// +optional
Spec ScheduleSpec `json:"spec,omitempty"`
// +optional
Status ScheduleStatus `json:"status,omitempty"`
}
@@ -79,6 +89,9 @@ type Schedule struct {
// ScheduleList is a list of Schedules.
type ScheduleList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []Schedule `json:"items"`
// +optional
metav1.ListMeta `json:"metadata,omitempty"`
Items []Schedule `json:"items"`
}

View File

@@ -26,10 +26,15 @@ import (
// ServerStatusRequest is a request to access current status information about
// the Velero server.
type ServerStatusRequest struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata"`
metav1.TypeMeta `json:",inline"`
Spec ServerStatusRequestSpec `json:"spec"`
// +optional
metav1.ObjectMeta `json:"metadata,omitempty"`
// +optional
Spec ServerStatusRequestSpec `json:"spec,omitempty"`
// +optional
Status ServerStatusRequestStatus `json:"status,omitempty"`
}
@@ -38,6 +43,7 @@ type ServerStatusRequestSpec struct {
}
// ServerStatusRequestPhase represents the lifecycle phase of a ServerStatusRequest.
// +kubebuilder:validation:Enum=New;Processed
type ServerStatusRequestPhase string
const (
@@ -56,16 +62,22 @@ type PluginInfo struct {
// ServerStatusRequestStatus is the current status of a ServerStatusRequest.
type ServerStatusRequestStatus struct {
// Phase is the current lifecycle phase of the ServerStatusRequest.
// +optional
Phase ServerStatusRequestPhase `json:"phase"`
// ProcessedTimestamp is when the ServerStatusRequest was processed
// by the ServerStatusRequestController.
// +optional
// +nullable
ProcessedTimestamp metav1.Time `json:"processedTimestamp"`
// ServerVersion is the Velero server version.
// +optional
ServerVersion string `json:"serverVersion"`
// Plugins list information about the plugins running on the Velero server
// +optional
// +nullable
Plugins []PluginInfo `json:"plugins"`
}
@@ -74,6 +86,9 @@ type ServerStatusRequestStatus struct {
// ServerStatusRequestList is a list of ServerStatusRequests.
type ServerStatusRequestList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []ServerStatusRequest `json:"items"`
// +optional
metav1.ListMeta `json:"metadata,omitempty"`
Items []ServerStatusRequest `json:"items"`
}

View File

@@ -23,11 +23,16 @@ import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
// VolumeSnapshotLocation is a location where Velero stores volume snapshots.
type VolumeSnapshotLocation struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata"`
metav1.TypeMeta `json:",inline"`
Spec VolumeSnapshotLocationSpec `json:"spec"`
Status VolumeSnapshotLocationStatus `json:"status"`
// +optional
metav1.ObjectMeta `json:"metadata,omitempty"`
// +optional
Spec VolumeSnapshotLocationSpec `json:"spec,omitempty"`
// +optional
Status VolumeSnapshotLocationStatus `json:"status,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
@@ -35,8 +40,11 @@ type VolumeSnapshotLocation struct {
// VolumeSnapshotLocationList is a list of VolumeSnapshotLocations.
type VolumeSnapshotLocationList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []VolumeSnapshotLocation `json:"items"`
// +optional
metav1.ListMeta `json:"metadata,omitempty"`
Items []VolumeSnapshotLocation `json:"items"`
}
// VolumeSnapshotLocationSpec defines the specification for a Velero VolumeSnapshotLocation.
@@ -45,10 +53,12 @@ type VolumeSnapshotLocationSpec struct {
Provider string `json:"provider"`
// Config is for provider-specific configuration fields.
Config map[string]string `json:"config"`
// +optional
Config map[string]string `json:"config,omitempty"`
}
// VolumeSnapshotLocationPhase is the lifecyle phase of a Velero VolumeSnapshotLocation.
// +kubebuilder:validation:Enum=Available;Unavailable
type VolumeSnapshotLocationPhase string
const (
@@ -61,5 +71,6 @@ const (
// VolumeSnapshotLocationStatus describes the current status of a Velero VolumeSnapshotLocation.
type VolumeSnapshotLocationStatus struct {
// +optional
Phase VolumeSnapshotLocationPhase `json:"phase,omitempty"`
}

File diff suppressed because one or more lines are too long

View File

@@ -38,12 +38,14 @@ spec:
not included in the backup.
items:
type: string
nullable: true
type: array
excludedResources:
description: ExcludedResources is a slice of resource names that are
not included in the backup.
items:
type: string
nullable: true
type: array
hooks:
description: Hooks represent custom behaviors that should be executed
@@ -62,12 +64,14 @@ spec:
which this hook spec does not apply.
items:
type: string
nullable: true
type: array
excludedResources:
description: ExcludedResources specifies the resources to
which this hook spec does not apply.
items:
type: string
nullable: true
type: array
includedNamespaces:
description: IncludedNamespaces specifies the namespaces to
@@ -75,6 +79,7 @@ spec:
namespaces.
items:
type: string
nullable: true
type: array
includedResources:
description: IncludedResources specifies the resources to
@@ -82,10 +87,12 @@ spec:
resources.
items:
type: string
nullable: true
type: array
labelSelector:
description: LabelSelector, if specified, filters the resources
to which this hook spec applies.
nullable: true
properties:
matchExpressions:
description: matchExpressions is a list of label selector
@@ -148,6 +155,7 @@ spec:
to execute.
items:
type: string
minItems: 1
type: array
container:
description: Container is the container in the pod
@@ -158,6 +166,9 @@ spec:
description: OnError specifies how Velero should
behave if it encounters an error executing this
hook.
enum:
- Continue
- Fail
type: string
timeout:
description: Timeout defines the maximum amount
@@ -166,9 +177,6 @@ spec:
type: string
required:
- command
- container
- onError
- timeout
type: object
required:
- exec
@@ -190,6 +198,7 @@ spec:
to execute.
items:
type: string
minItems: 1
type: array
container:
description: Container is the container in the pod
@@ -200,6 +209,9 @@ spec:
description: OnError specifies how Velero should
behave if it encounters an error executing this
hook.
enum:
- Continue
- Fail
type: string
timeout:
description: Timeout defines the maximum amount
@@ -208,45 +220,41 @@ spec:
type: string
required:
- command
- container
- onError
- timeout
type: object
required:
- exec
type: object
type: array
required:
- excludedNamespaces
- excludedResources
- includedNamespaces
- includedResources
- name
type: object
nullable: true
type: array
required:
- resources
type: object
includeClusterResources:
description: IncludeClusterResources specifies whether cluster-scoped
resources should be included for consideration in the backup.
nullable: true
type: boolean
includedNamespaces:
description: IncludedNamespaces is a slice of namespace names to include
objects from. If empty, all namespaces are included.
items:
type: string
nullable: true
type: array
includedResources:
description: IncludedResources is a slice of resource names to include
in the backup. If empty, all resources are included.
items:
type: string
nullable: true
type: array
labelSelector:
description: LabelSelector is a metav1.LabelSelector to filter with
when adding individual objects to the backup. If empty or nil, all
objects are included. Optional.
nullable: true
properties:
matchExpressions:
description: matchExpressions is a list of label selector requirements.
@@ -291,6 +299,7 @@ spec:
snapshotVolumes:
description: SnapshotVolumes specifies whether to take cloud snapshots
of any PV's referenced in the set of objects included in the Backup.
nullable: true
type: boolean
storageLocation:
description: StorageLocation is a string containing the name of a BackupStorageLocation
@@ -306,17 +315,6 @@ spec:
items:
type: string
type: array
required:
- excludedNamespaces
- excludedResources
- hooks
- includeClusterResources
- includedNamespaces
- includedResources
- labelSelector
- storageLocation
- ttl
- volumeSnapshotLocations
type: object
status:
description: BackupStatus captures the current status of a Velero backup.
@@ -327,6 +325,7 @@ spec:
is recorded before uploading the backup object. The server's time
is used for CompletionTimestamps
format: date-time
nullable: true
type: string
errors:
description: Errors is a count of all error messages that were generated
@@ -336,21 +335,32 @@ spec:
expiration:
description: Expiration is when this Backup is eligible for garbage-collection.
format: date-time
nullable: true
type: string
phase:
description: Phase is the current state of the Backup.
enum:
- New
- FailedValidation
- InProgress
- Completed
- PartiallyFailed
- Failed
- Deleting
type: string
startTimestamp:
description: StartTimestamp records the time a backup was started. Separate
from CreationTimestamp, since that value changes on restores. The
server's time is used for StartTimestamps
format: date-time
nullable: true
type: string
validationErrors:
description: ValidationErrors is a slice of all validation errors (if
applicable).
items:
type: string
nullable: true
type: array
version:
description: Version is the backup format version.
@@ -368,21 +378,7 @@ spec:
during execution of the backup. The actual warnings are in the backup's
log file in object storage.
type: integer
required:
- completionTimestamp
- errors
- expiration
- phase
- startTimestamp
- validationErrors
- version
- volumeSnapshotsAttempted
- volumeSnapshotsCompleted
- warnings
type: object
required:
- metadata
- spec
type: object
version: v1
versions:

View File

@@ -37,6 +37,9 @@ spec:
accessMode:
description: AccessMode defines the permissions for the backup storage
location.
enum:
- ReadOnly
- ReadWrite
type: string
config:
additionalProperties:
@@ -56,13 +59,12 @@ spec:
type: string
required:
- bucket
- prefix
type: object
provider:
description: Provider is the provider of the backup storage.
type: string
required:
- config
- objectStorage
- provider
type: object
status:
@@ -73,6 +75,9 @@ spec:
description: "AccessMode is an unused field. \n Deprecated: there is
now an AccessMode field on the Spec and this field will be removed
entirely as of v2.0."
enum:
- ReadOnly
- ReadWrite
type: string
lastSyncedRevision:
description: UID is a type that holds unique ID values, including UUIDs. Because
@@ -82,16 +87,16 @@ spec:
type: string
lastSyncedTime:
format: date-time
nullable: true
type: string
phase:
description: BackupStorageLocationPhase is the lifecyle phase of a Velero
BackupStorageLocation.
enum:
- Available
- Unavailable
type: string
type: object
required:
- metadata
- spec
- status
type: object
version: v1
versions:

View File

@@ -46,17 +46,16 @@ spec:
the deletion process.
items:
type: string
nullable: true
type: array
phase:
description: Phase is the current state of the DeleteBackupRequest.
enum:
- New
- InProgress
- Processed
type: string
required:
- errors
- phase
type: object
required:
- metadata
- spec
type: object
version: v1
versions:

View File

@@ -38,6 +38,13 @@ spec:
properties:
kind:
description: Kind is the type of file to download.
enum:
- BackupLog
- BackupContents
- BackupVolumeSnapshot
- BackupResourceList
- RestoreLog
- RestoreResults
type: string
name:
description: Name is the name of the kubernetes resource with which
@@ -61,18 +68,15 @@ spec:
description: Expiration is when this DownloadRequest expires and can
be deleted by the system.
format: date-time
nullable: true
type: string
phase:
description: Phase is the current state of the DownloadRequest.
enum:
- New
- Processed
type: string
required:
- downloadURL
- expiration
- phase
type: object
required:
- metadata
- spec
type: object
version: v1
versions:

View File

@@ -93,7 +93,6 @@ spec:
- node
- pod
- repoIdentifier
- tags
- volume
type: object
status:
@@ -105,6 +104,7 @@ spec:
is recorded before uploading the backup object. The server's time
is used for CompletionTimestamps
format: date-time
nullable: true
type: string
message:
description: Message is a message about the pod volume backup's status.
@@ -115,6 +115,11 @@ spec:
type: string
phase:
description: Phase is the current state of the PodVolumeBackup.
enum:
- New
- InProgress
- Completed
- Failed
type: string
progress:
description: Progress holds the total number of bytes of the volume
@@ -127,9 +132,6 @@ spec:
totalBytes:
format: int64
type: integer
required:
- bytesDone
- totalBytes
type: object
snapshotID:
description: SnapshotID is the identifier for the snapshot of the pod
@@ -140,19 +142,9 @@ spec:
from CreationTimestamp, since that value changes on restores. The
server's time is used for StartTimestamps
format: date-time
nullable: true
type: string
required:
- completionTimestamp
- message
- path
- phase
- progress
- snapshotID
- startTimestamp
type: object
required:
- metadata
- spec
type: object
version: v1
versions:

View File

@@ -96,27 +96,38 @@ spec:
Completion time is recorded even on failed restores. The server's
time is used for CompletionTimestamps
format: date-time
nullable: true
type: string
message:
description: Message is a message about the pod volume restore's status.
type: string
phase:
description: Phase is the current state of the PodVolumeRestore.
enum:
- New
- InProgress
- Completed
- Failed
type: string
progress:
description: Progress holds the total number of bytes of the snapshot
and the current number of restored bytes. This can be used to display
progress information about the restore operation.
properties:
bytesDone:
format: int64
type: integer
totalBytes:
format: int64
type: integer
type: object
startTimestamp:
description: StartTimestamp records the time a restore was started.
The server's time is used for StartTimestamps
format: date-time
nullable: true
type: string
required:
- completionTimestamp
- message
- phase
- startTimestamp
type: object
required:
- metadata
- spec
type: object
version: v1
versions:

View File

@@ -59,21 +59,19 @@ spec:
lastMaintenanceTime:
description: LastMaintenanceTime is the last time maintenance was run.
format: date-time
nullable: true
type: string
message:
description: Message is a message about the current status of the ResticRepository.
type: string
phase:
description: Phase is the current state of the ResticRepository.
enum:
- New
- Ready
- NotReady
type: string
required:
- lastMaintenanceTime
- message
- phase
type: object
required:
- metadata
- spec
type: object
version: v1
versions:

View File

@@ -42,34 +42,40 @@ spec:
not included in the restore.
items:
type: string
nullable: true
type: array
excludedResources:
description: ExcludedResources is a slice of resource names that are
not included in the restore.
items:
type: string
nullable: true
type: array
includeClusterResources:
description: IncludeClusterResources specifies whether cluster-scoped
resources should be included for consideration in the restore. If
null, defaults to true.
nullable: true
type: boolean
includedNamespaces:
description: IncludedNamespaces is a slice of namespace names to include
objects from. If empty, all namespaces are included.
items:
type: string
nullable: true
type: array
includedResources:
description: IncludedResources is a slice of resource names to include
in the restore. If empty, all resources in the backup are included.
items:
type: string
nullable: true
type: array
labelSelector:
description: LabelSelector is a metav1.LabelSelector to filter with
when restoring individual objects from the backup. If empty or nil,
all objects are included. Optional.
nullable: true
properties:
matchExpressions:
description: matchExpressions is a list of label selector requirements.
@@ -121,6 +127,7 @@ spec:
restorePVs:
description: RestorePVs specifies whether to restore all included PVs
from snapshot (via the cloudprovider).
nullable: true
type: boolean
scheduleName:
description: ScheduleName is the unique name of the Velero schedule
@@ -129,11 +136,6 @@ spec:
type: string
required:
- backupName
- excludedNamespaces
- excludedResources
- includedNamespaces
- includedResources
- namespaceMapping
type: object
status:
description: RestoreStatus captures the current status of a Velero restore
@@ -149,28 +151,27 @@ spec:
type: string
phase:
description: Phase is the current state of the Restore
enum:
- New
- FailedValidation
- InProgress
- Completed
- PartiallyFailed
- Failed
type: string
validationErrors:
description: ValidationErrors is a slice of all validation errors (if
applicable)
items:
type: string
nullable: true
type: array
warnings:
description: Warnings is a count of all warning messages that were generated
during execution of the restore. The actual warnings are stored in
object storage.
type: integer
required:
- errors
- failureReason
- phase
- validationErrors
- warnings
type: object
required:
- metadata
- spec
type: object
version: v1
versions:

View File

@@ -46,12 +46,14 @@ spec:
are not included in the backup.
items:
type: string
nullable: true
type: array
excludedResources:
description: ExcludedResources is a slice of resource names that
are not included in the backup.
items:
type: string
nullable: true
type: array
hooks:
description: Hooks represent custom behaviors that should be executed
@@ -70,12 +72,14 @@ spec:
to which this hook spec does not apply.
items:
type: string
nullable: true
type: array
excludedResources:
description: ExcludedResources specifies the resources
to which this hook spec does not apply.
items:
type: string
nullable: true
type: array
includedNamespaces:
description: IncludedNamespaces specifies the namespaces
@@ -83,6 +87,7 @@ spec:
to all namespaces.
items:
type: string
nullable: true
type: array
includedResources:
description: IncludedResources specifies the resources
@@ -90,10 +95,12 @@ spec:
to all resources.
items:
type: string
nullable: true
type: array
labelSelector:
description: LabelSelector, if specified, filters the
resources to which this hook spec applies.
nullable: true
properties:
matchExpressions:
description: matchExpressions is a list of label selector
@@ -157,6 +164,7 @@ spec:
to execute.
items:
type: string
minItems: 1
type: array
container:
description: Container is the container in the
@@ -168,6 +176,9 @@ spec:
description: OnError specifies how Velero should
behave if it encounters an error executing
this hook.
enum:
- Continue
- Fail
type: string
timeout:
description: Timeout defines the maximum amount
@@ -177,9 +188,6 @@ spec:
type: string
required:
- command
- container
- onError
- timeout
type: object
required:
- exec
@@ -202,6 +210,7 @@ spec:
to execute.
items:
type: string
minItems: 1
type: array
container:
description: Container is the container in the
@@ -213,6 +222,9 @@ spec:
description: OnError specifies how Velero should
behave if it encounters an error executing
this hook.
enum:
- Continue
- Fail
type: string
timeout:
description: Timeout defines the maximum amount
@@ -222,45 +234,41 @@ spec:
type: string
required:
- command
- container
- onError
- timeout
type: object
required:
- exec
type: object
type: array
required:
- excludedNamespaces
- excludedResources
- includedNamespaces
- includedResources
- name
type: object
nullable: true
type: array
required:
- resources
type: object
includeClusterResources:
description: IncludeClusterResources specifies whether cluster-scoped
resources should be included for consideration in the backup.
nullable: true
type: boolean
includedNamespaces:
description: IncludedNamespaces is a slice of namespace names to
include objects from. If empty, all namespaces are included.
items:
type: string
nullable: true
type: array
includedResources:
description: IncludedResources is a slice of resource names to include
in the backup. If empty, all resources are included.
items:
type: string
nullable: true
type: array
labelSelector:
description: LabelSelector is a metav1.LabelSelector to filter with
when adding individual objects to the backup. If empty or nil,
all objects are included. Optional.
nullable: true
properties:
matchExpressions:
description: matchExpressions is a list of label selector requirements.
@@ -306,6 +314,7 @@ spec:
snapshotVolumes:
description: SnapshotVolumes specifies whether to take cloud snapshots
of any PV's referenced in the set of objects included in the Backup.
nullable: true
type: boolean
storageLocation:
description: StorageLocation is a string containing the name of
@@ -321,17 +330,6 @@ spec:
items:
type: string
type: array
required:
- excludedNamespaces
- excludedResources
- hooks
- includeClusterResources
- includedNamespaces
- includedResources
- labelSelector
- storageLocation
- ttl
- volumeSnapshotLocations
type: object
required:
- schedule
@@ -344,9 +342,14 @@ spec:
description: LastBackup is the last time a Backup was run for this Schedule
schedule
format: date-time
nullable: true
type: string
phase:
description: Phase is the current phase of the Schedule
enum:
- New
- Enabled
- FailedValidation
type: string
validationErrors:
description: ValidationErrors is a slice of all validation errors (if
@@ -354,14 +357,7 @@ spec:
items:
type: string
type: array
required:
- lastBackup
- phase
- validationErrors
type: object
required:
- metadata
- spec
type: object
version: v1
versions:

View File

@@ -38,6 +38,9 @@ spec:
properties:
phase:
description: Phase is the current lifecycle phase of the ServerStatusRequest.
enum:
- New
- Processed
type: string
plugins:
description: Plugins list information about the plugins running on the
@@ -53,24 +56,18 @@ spec:
- kind
- name
type: object
nullable: true
type: array
processedTimestamp:
description: ProcessedTimestamp is when the ServerStatusRequest was
processed by the ServerStatusRequestController.
format: date-time
nullable: true
type: string
serverVersion:
description: ServerVersion is the Velero server version.
type: string
required:
- phase
- plugins
- processedTimestamp
- serverVersion
type: object
required:
- metadata
- spec
type: object
version: v1
versions:

View File

@@ -43,7 +43,6 @@ spec:
description: Provider is the provider of the volume storage.
type: string
required:
- config
- provider
type: object
status:
@@ -53,12 +52,11 @@ spec:
phase:
description: VolumeSnapshotLocationPhase is the lifecyle phase of a
Velero VolumeSnapshotLocation.
enum:
- Available
- Unavailable
type: string
type: object
required:
- metadata
- spec
- status
type: object
version: v1
versions:

View File

@@ -1,59 +0,0 @@
/*
Copyright 2018, 2019 the Velero contributors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package install
import (
"fmt"
apiextv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
velerov1api "github.com/heptio/velero/pkg/apis/velero/v1"
)
// CRDs returns a list of the CRD types for all of the required Velero CRDs
func CRDs() []*apiextv1beta1.CustomResourceDefinition {
var crds []*apiextv1beta1.CustomResourceDefinition
for kind, typeInfo := range velerov1api.CustomResources() {
crds = append(crds, crd(kind, typeInfo.PluralName))
}
return crds
}
func crd(kind, plural string) *apiextv1beta1.CustomResourceDefinition {
return &apiextv1beta1.CustomResourceDefinition{
ObjectMeta: metav1.ObjectMeta{
Name: fmt.Sprintf("%s.%s", plural, velerov1api.GroupName),
Labels: labels(),
},
TypeMeta: metav1.TypeMeta{
Kind: "CustomResourceDefinition",
APIVersion: apiextv1beta1.SchemeGroupVersion.String(),
},
Spec: apiextv1beta1.CustomResourceDefinitionSpec{
Group: velerov1api.GroupName,
Version: velerov1api.SchemeGroupVersion.Version,
Scope: apiextv1beta1.NamespaceScoped,
Names: apiextv1beta1.CustomResourceDefinitionNames{
Plural: plural,
Kind: kind,
},
},
}
}

View File

@@ -28,6 +28,7 @@ import (
v1 "github.com/heptio/velero/pkg/apis/velero/v1"
"github.com/heptio/velero/pkg/buildinfo"
"github.com/heptio/velero/pkg/generated/crds"
)
// Use "latest" if the build process didn't supply a version
@@ -219,7 +220,8 @@ func AllResources(o *VeleroOptions) (*unstructured.UnstructuredList, error) {
// Set the GVK so that the serialization framework outputs the list properly
resources.SetGroupVersionKind(schema.GroupVersionKind{Group: "", Version: "v1", Kind: "List"})
for _, crd := range CRDs() {
for _, crd := range crds.CRDs {
crd.SetLabels(labels())
appendUnstructured(resources, crd)
}