Use generated deep copy functions

Signed-off-by: Andy Goldstein <andy.goldstein@gmail.com>
This commit is contained in:
Andy Goldstein
2017-10-25 12:57:40 -04:00
parent 293674c40e
commit aa253bf016
5 changed files with 7 additions and 87 deletions

View File

@@ -36,7 +36,6 @@ import (
api "github.com/heptio/ark/pkg/apis/ark/v1"
"github.com/heptio/ark/pkg/cloudprovider"
"github.com/heptio/ark/pkg/generated/clientset/versioned/scheme"
arkv1client "github.com/heptio/ark/pkg/generated/clientset/versioned/typed/ark/v1"
informers "github.com/heptio/ark/pkg/generated/informers/externalversions/ark/v1"
listers "github.com/heptio/ark/pkg/generated/listers/ark/v1"
@@ -226,10 +225,7 @@ func (controller *restoreController) processRestore(key string) error {
logContext.Debug("Cloning Restore")
// don't modify items in the cache
restore, err = cloneRestore(restore)
if err != nil {
return err
}
restore = restore.DeepCopy()
excludedResources := sets.NewString(restore.Spec.ExcludedResources...)
for _, nonrestorable := range nonRestorableResources {
@@ -271,20 +267,6 @@ func (controller *restoreController) processRestore(key string) error {
return nil
}
func cloneRestore(in interface{}) (*api.Restore, error) {
clone, err := scheme.Scheme.DeepCopy(in)
if err != nil {
return nil, errors.Wrap(err, "error deep-copying Restore")
}
out, ok := clone.(*api.Restore)
if !ok {
return nil, errors.Errorf("unexpected type: %T", clone)
}
return out, nil
}
func (controller *restoreController) getValidationErrors(itm *api.Restore) []string {
var validationErrors []string