mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-09-29 03:05:54 +00:00
add restore item action to change PVC/PV storage class name (#1621)
* add restore item action to change PVC/PV storage class name Signed-off-by: Steve Kriss <krisss@vmware.com> * code review Signed-off-by: Steve Kriss <krisss@vmware.com> * change existing plugin names to lowercase/hyphenated Signed-off-by: Steve Kriss <krisss@vmware.com> * add validation for new storage class name Signed-off-by: Steve Kriss <krisss@vmware.com> * add test cases Signed-off-by: Steve Kriss <krisss@vmware.com> * changelog Signed-off-by: Steve Kriss <krisss@vmware.com> * fix imports Signed-off-by: Steve Kriss <krisss@vmware.com> * update plugin names to be more consistent Signed-off-by: Steve Kriss <krisss@vmware.com> * update unit tests to use pkg/test object constructors Signed-off-by: Steve Kriss <krisss@vmware.com>
This commit is contained in:
committed by
Adnan Abdulhussein
parent
63964fc6f9
commit
1bb167ef90
@@ -46,14 +46,15 @@ func NewCommand(f client.Factory) *cobra.Command {
|
||||
RegisterVolumeSnapshotter("velero.io/gcp", newGcpVolumeSnapshotter).
|
||||
RegisterBackupItemAction("velero.io/pv", newPVBackupItemAction).
|
||||
RegisterBackupItemAction("velero.io/pod", newPodBackupItemAction).
|
||||
RegisterBackupItemAction("velero.io/serviceaccount", newServiceAccountBackupItemAction(f)).
|
||||
RegisterBackupItemAction("velero.io/service-account", newServiceAccountBackupItemAction(f)).
|
||||
RegisterRestoreItemAction("velero.io/job", newJobRestoreItemAction).
|
||||
RegisterRestoreItemAction("velero.io/pod", newPodRestoreItemAction).
|
||||
RegisterRestoreItemAction("velero.io/restic", newResticRestoreItemAction(f)).
|
||||
RegisterRestoreItemAction("velero.io/service", newServiceRestoreItemAction).
|
||||
RegisterRestoreItemAction("velero.io/serviceaccount", newServiceAccountRestoreItemAction).
|
||||
RegisterRestoreItemAction("velero.io/addPVCFromPod", newAddPVCFromPodRestoreItemAction).
|
||||
RegisterRestoreItemAction("velero.io/addPVFromPVC", newAddPVFromPVCRestoreItemAction).
|
||||
RegisterRestoreItemAction("velero.io/service-account", newServiceAccountRestoreItemAction).
|
||||
RegisterRestoreItemAction("velero.io/add-pvc-from-pod", newAddPVCFromPodRestoreItemAction).
|
||||
RegisterRestoreItemAction("velero.io/add-pv-from-pvc", newAddPVFromPVCRestoreItemAction).
|
||||
RegisterRestoreItemAction("velero.io/change-storage-class", newChangeStorageClassRestoreItemAction(f)).
|
||||
Serve()
|
||||
},
|
||||
}
|
||||
@@ -154,3 +155,18 @@ func newAddPVCFromPodRestoreItemAction(logger logrus.FieldLogger) (interface{},
|
||||
func newAddPVFromPVCRestoreItemAction(logger logrus.FieldLogger) (interface{}, error) {
|
||||
return restore.NewAddPVFromPVCAction(logger), nil
|
||||
}
|
||||
|
||||
func newChangeStorageClassRestoreItemAction(f client.Factory) veleroplugin.HandlerInitializer {
|
||||
return func(logger logrus.FieldLogger) (interface{}, error) {
|
||||
client, err := f.KubeClient()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return restore.NewChangeStorageClassAction(
|
||||
logger,
|
||||
client.CoreV1().ConfigMaps(f.Namespace()),
|
||||
client.StorageV1().StorageClasses(),
|
||||
), nil
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user