mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-01-06 13:26:26 +00:00
Account for possible missing schemas on v1 CRDs (#2264)
* Account for possible missing schemas on v1 CRDs If a v1beta1 CRD without a Schema was submitted to a Kubernets v1.16 cluster, then Kubernetes will server it back as a v1 CRD without a schema. However, when Velero tries to restore this document, the request will be rejected as a v1 CRD must have a schema. This commit has some defensive coding on the restore side, as well as potential fixes on the backup side for getting around this. Signed-off-by: Nolan Brubaker <brubakern@vmware.com> * Back up nonstructural CRDs as v1beta1 Signed-off-by: Nolan Brubaker <brubakern@vmware.com> * Add tests for remapping plugin Signed-off-by: Nolan Brubaker <brubakern@vmware.com> * Add builders for v1 CRDs Signed-off-by: Nolan Brubaker <brubakern@vmware.com> * Address review feedback Signed-off-by: Nolan Brubaker <brubakern@vmware.com> * Remove extraneous log message Signed-off-by: Nolan Brubaker <brubakern@vmware.com> * Add changelog Signed-off-by: Nolan Brubaker <brubakern@vmware.com>
This commit is contained in:
@@ -38,6 +38,7 @@ func NewCommand(f client.Factory) *cobra.Command {
|
||||
RegisterBackupItemAction("velero.io/pv", newPVBackupItemAction).
|
||||
RegisterBackupItemAction("velero.io/pod", newPodBackupItemAction).
|
||||
RegisterBackupItemAction("velero.io/service-account", newServiceAccountBackupItemAction(f)).
|
||||
RegisterBackupItemAction("velero.io/crd-remap-version", newRemapCRDVersionAction).
|
||||
RegisterRestoreItemAction("velero.io/job", newJobRestoreItemAction).
|
||||
RegisterRestoreItemAction("velero.io/pod", newPodRestoreItemAction).
|
||||
RegisterRestoreItemAction("velero.io/restic", newResticRestoreItemAction(f)).
|
||||
@@ -91,6 +92,10 @@ func newServiceAccountBackupItemAction(f client.Factory) veleroplugin.HandlerIni
|
||||
}
|
||||
}
|
||||
|
||||
func newRemapCRDVersionAction(logger logrus.FieldLogger) (interface{}, error) {
|
||||
return backup.NewRemapCRDVersionAction(logger), nil
|
||||
}
|
||||
|
||||
func newJobRestoreItemAction(logger logrus.FieldLogger) (interface{}, error) {
|
||||
return restore.NewJobAction(logger), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user