From 08c93b4145fe9a22390aa0a723f8d4ddb46384e5 Mon Sep 17 00:00:00 2001 From: Xun Jiang Date: Fri, 29 Mar 2024 12:58:54 +0800 Subject: [PATCH] Add actions directory for backup and restore. Signed-off-by: Xun Jiang --- pkg/backup/{ => actions}/backup_pv_action.go | 2 +- .../{ => actions}/backup_pv_action_test.go | 2 +- pkg/backup/{ => actions}/pod_action.go | 2 +- pkg/backup/{ => actions}/pod_action_test.go | 2 +- pkg/backup/{ => actions}/rbac.go | 2 +- .../{ => actions}/remap_crd_version_action.go | 2 +- .../remap_crd_version_action_test.go | 2 +- .../{ => actions}/service_account_action.go | 2 +- .../service_account_action_test.go | 2 +- .../alertmanagers.monitoring.coreos.com.json | 0 ...searches.elasticsearch.k8s.elastic.co.json | 0 .../gcpsamples.gcp.stacks.crossplane.io.json | 0 .../v1/kibanas.kibana.k8s.elastic.co.json | 0 .../pprometheuses.monitoring.coreos.com.json | 0 .../prometheuses.monitoring.coreos.com.json | 0 .../alertmanagers.monitoring.coreos.com.json | 0 ...searches.elasticsearch.k8s.elastic.co.json | 0 .../gcpsamples.gcp.stacks.crossplane.io.json | 0 .../kibanas.kibana.k8s.elastic.co.json | 0 .../prometheuses.monitoring.coreos.com.json | 0 pkg/backup/pv_skip_tracker.go | 16 ++++++ pkg/backup/pv_skip_tracker_test.go | 16 ++++++ pkg/backup/pvc_snaphost_tracker_test.go | 16 ++++++ pkg/cmd/server/plugin/plugin.go | 50 +++++++++---------- .../{ => actions}/add_pv_from_pvc_action.go | 4 +- .../add_pv_from_pvc_action_test.go | 4 +- .../{ => actions}/add_pvc_from_pod_action.go | 0 .../add_pvc_from_pod_action_test.go | 4 +- .../admissionwebhook_config_action.go | 0 .../admissionwebhook_config_action_test.go | 16 ++++++ .../{ => actions}/apiservice_action.go | 0 .../{ => actions}/apiservice_action_test.go | 0 .../{ => actions}/change_image_name_action.go | 0 .../change_image_name_action_test.go | 0 .../{ => actions}/change_pvc_node_selector.go | 0 .../change_pvc_node_selector_test.go | 0 .../change_storageclass_action.go | 0 .../change_storageclass_action_test.go | 0 .../clusterrolebinding_action.go | 0 .../clusterrolebinding_action_test.go | 0 .../crd_v1_preserve_unknown_fields_action.go | 4 +- ..._v1_preserve_unknown_fields_action_test.go | 4 +- .../dataupload_retrieve_action.go | 4 +- .../dataupload_retrieve_action_test.go | 4 +- .../init_restorehook_pod_action.go | 0 .../init_restorehook_pod_action_test.go | 0 pkg/restore/{ => actions}/job_action.go | 0 pkg/restore/{ => actions}/job_action_test.go | 0 pkg/restore/{ => actions}/pod_action.go | 0 pkg/restore/{ => actions}/pod_action_test.go | 0 .../pod_volume_restore_action.go | 0 .../pod_volume_restore_action_test.go | 0 .../{ => actions}/rolebinding_action.go | 0 .../{ => actions}/rolebinding_action_test.go | 0 pkg/restore/{ => actions}/secret_action.go | 0 .../{ => actions}/secret_action_test.go | 0 .../{ => actions}/service_account_action.go | 0 .../service_account_action_test.go | 0 pkg/restore/{ => actions}/service_action.go | 0 .../{ => actions}/service_action_test.go | 0 60 files changed, 112 insertions(+), 48 deletions(-) rename pkg/backup/{ => actions}/backup_pv_action.go (99%) rename pkg/backup/{ => actions}/backup_pv_action_test.go (99%) rename pkg/backup/{ => actions}/pod_action.go (99%) rename pkg/backup/{ => actions}/pod_action_test.go (99%) rename pkg/backup/{ => actions}/rbac.go (99%) rename pkg/backup/{ => actions}/remap_crd_version_action.go (99%) rename pkg/backup/{ => actions}/remap_crd_version_action_test.go (99%) rename pkg/backup/{ => actions}/service_account_action.go (99%) rename pkg/backup/{ => actions}/service_account_action_test.go (99%) rename pkg/backup/{ => actions}/testdata/v1/alertmanagers.monitoring.coreos.com.json (100%) rename pkg/backup/{ => actions}/testdata/v1/elasticsearches.elasticsearch.k8s.elastic.co.json (100%) rename pkg/backup/{ => actions}/testdata/v1/gcpsamples.gcp.stacks.crossplane.io.json (100%) rename pkg/backup/{ => actions}/testdata/v1/kibanas.kibana.k8s.elastic.co.json (100%) rename pkg/backup/{ => actions}/testdata/v1/pprometheuses.monitoring.coreos.com.json (100%) rename pkg/backup/{ => actions}/testdata/v1/prometheuses.monitoring.coreos.com.json (100%) rename pkg/backup/{ => actions}/testdata/v1beta1/alertmanagers.monitoring.coreos.com.json (100%) rename pkg/backup/{ => actions}/testdata/v1beta1/elasticsearches.elasticsearch.k8s.elastic.co.json (100%) rename pkg/backup/{ => actions}/testdata/v1beta1/gcpsamples.gcp.stacks.crossplane.io.json (100%) rename pkg/backup/{ => actions}/testdata/v1beta1/kibanas.kibana.k8s.elastic.co.json (100%) rename pkg/backup/{ => actions}/testdata/v1beta1/prometheuses.monitoring.coreos.com.json (100%) rename pkg/restore/{ => actions}/add_pv_from_pvc_action.go (94%) rename pkg/restore/{ => actions}/add_pv_from_pvc_action_test.go (95%) rename pkg/restore/{ => actions}/add_pvc_from_pod_action.go (100%) rename pkg/restore/{ => actions}/add_pvc_from_pod_action_test.go (95%) rename pkg/restore/{ => actions}/admissionwebhook_config_action.go (100%) rename pkg/restore/{ => actions}/admissionwebhook_config_action_test.go (89%) rename pkg/restore/{ => actions}/apiservice_action.go (100%) rename pkg/restore/{ => actions}/apiservice_action_test.go (100%) rename pkg/restore/{ => actions}/change_image_name_action.go (100%) rename pkg/restore/{ => actions}/change_image_name_action_test.go (100%) rename pkg/restore/{ => actions}/change_pvc_node_selector.go (100%) rename pkg/restore/{ => actions}/change_pvc_node_selector_test.go (100%) rename pkg/restore/{ => actions}/change_storageclass_action.go (100%) rename pkg/restore/{ => actions}/change_storageclass_action_test.go (100%) rename pkg/restore/{ => actions}/clusterrolebinding_action.go (100%) rename pkg/restore/{ => actions}/clusterrolebinding_action_test.go (100%) rename pkg/restore/{ => actions}/crd_v1_preserve_unknown_fields_action.go (97%) rename pkg/restore/{ => actions}/crd_v1_preserve_unknown_fields_action_test.go (92%) rename pkg/restore/{ => actions}/dataupload_retrieve_action.go (96%) rename pkg/restore/{ => actions}/dataupload_retrieve_action_test.go (97%) rename pkg/restore/{ => actions}/init_restorehook_pod_action.go (100%) rename pkg/restore/{ => actions}/init_restorehook_pod_action_test.go (100%) rename pkg/restore/{ => actions}/job_action.go (100%) rename pkg/restore/{ => actions}/job_action_test.go (100%) rename pkg/restore/{ => actions}/pod_action.go (100%) rename pkg/restore/{ => actions}/pod_action_test.go (100%) rename pkg/restore/{ => actions}/pod_volume_restore_action.go (100%) rename pkg/restore/{ => actions}/pod_volume_restore_action_test.go (100%) rename pkg/restore/{ => actions}/rolebinding_action.go (100%) rename pkg/restore/{ => actions}/rolebinding_action_test.go (100%) rename pkg/restore/{ => actions}/secret_action.go (100%) rename pkg/restore/{ => actions}/secret_action_test.go (100%) rename pkg/restore/{ => actions}/service_account_action.go (100%) rename pkg/restore/{ => actions}/service_account_action_test.go (100%) rename pkg/restore/{ => actions}/service_action.go (100%) rename pkg/restore/{ => actions}/service_action_test.go (100%) diff --git a/pkg/backup/backup_pv_action.go b/pkg/backup/actions/backup_pv_action.go similarity index 99% rename from pkg/backup/backup_pv_action.go rename to pkg/backup/actions/backup_pv_action.go index a636f83d8..f5a65555c 100644 --- a/pkg/backup/backup_pv_action.go +++ b/pkg/backup/actions/backup_pv_action.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package backup +package actions import ( "strings" diff --git a/pkg/backup/backup_pv_action_test.go b/pkg/backup/actions/backup_pv_action_test.go similarity index 99% rename from pkg/backup/backup_pv_action_test.go rename to pkg/backup/actions/backup_pv_action_test.go index d9d2b52cf..b66021132 100644 --- a/pkg/backup/backup_pv_action_test.go +++ b/pkg/backup/actions/backup_pv_action_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package backup +package actions import ( "testing" diff --git a/pkg/backup/pod_action.go b/pkg/backup/actions/pod_action.go similarity index 99% rename from pkg/backup/pod_action.go rename to pkg/backup/actions/pod_action.go index d0e834fbb..ce6b1ade8 100644 --- a/pkg/backup/pod_action.go +++ b/pkg/backup/actions/pod_action.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package backup +package actions import ( "github.com/pkg/errors" diff --git a/pkg/backup/pod_action_test.go b/pkg/backup/actions/pod_action_test.go similarity index 99% rename from pkg/backup/pod_action_test.go rename to pkg/backup/actions/pod_action_test.go index 1618b3089..d0d30b653 100644 --- a/pkg/backup/pod_action_test.go +++ b/pkg/backup/actions/pod_action_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package backup +package actions import ( "testing" diff --git a/pkg/backup/rbac.go b/pkg/backup/actions/rbac.go similarity index 99% rename from pkg/backup/rbac.go rename to pkg/backup/actions/rbac.go index 456ae3864..5da936ef7 100644 --- a/pkg/backup/rbac.go +++ b/pkg/backup/actions/rbac.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package backup +package actions import ( "context" diff --git a/pkg/backup/remap_crd_version_action.go b/pkg/backup/actions/remap_crd_version_action.go similarity index 99% rename from pkg/backup/remap_crd_version_action.go rename to pkg/backup/actions/remap_crd_version_action.go index e1e6583eb..3f8c2f79d 100644 --- a/pkg/backup/remap_crd_version_action.go +++ b/pkg/backup/actions/remap_crd_version_action.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package backup +package actions import ( "context" diff --git a/pkg/backup/remap_crd_version_action_test.go b/pkg/backup/actions/remap_crd_version_action_test.go similarity index 99% rename from pkg/backup/remap_crd_version_action_test.go rename to pkg/backup/actions/remap_crd_version_action_test.go index b50f82de4..f5bf5542d 100644 --- a/pkg/backup/remap_crd_version_action_test.go +++ b/pkg/backup/actions/remap_crd_version_action_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package backup +package actions import ( "context" diff --git a/pkg/backup/service_account_action.go b/pkg/backup/actions/service_account_action.go similarity index 99% rename from pkg/backup/service_account_action.go rename to pkg/backup/actions/service_account_action.go index 46555c8b0..c7a3649c4 100644 --- a/pkg/backup/service_account_action.go +++ b/pkg/backup/actions/service_account_action.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package backup +package actions import ( "github.com/pkg/errors" diff --git a/pkg/backup/service_account_action_test.go b/pkg/backup/actions/service_account_action_test.go similarity index 99% rename from pkg/backup/service_account_action_test.go rename to pkg/backup/actions/service_account_action_test.go index 9bb813d6d..0d74e14c3 100644 --- a/pkg/backup/service_account_action_test.go +++ b/pkg/backup/actions/service_account_action_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package backup +package actions import ( "fmt" diff --git a/pkg/backup/testdata/v1/alertmanagers.monitoring.coreos.com.json b/pkg/backup/actions/testdata/v1/alertmanagers.monitoring.coreos.com.json similarity index 100% rename from pkg/backup/testdata/v1/alertmanagers.monitoring.coreos.com.json rename to pkg/backup/actions/testdata/v1/alertmanagers.monitoring.coreos.com.json diff --git a/pkg/backup/testdata/v1/elasticsearches.elasticsearch.k8s.elastic.co.json b/pkg/backup/actions/testdata/v1/elasticsearches.elasticsearch.k8s.elastic.co.json similarity index 100% rename from pkg/backup/testdata/v1/elasticsearches.elasticsearch.k8s.elastic.co.json rename to pkg/backup/actions/testdata/v1/elasticsearches.elasticsearch.k8s.elastic.co.json diff --git a/pkg/backup/testdata/v1/gcpsamples.gcp.stacks.crossplane.io.json b/pkg/backup/actions/testdata/v1/gcpsamples.gcp.stacks.crossplane.io.json similarity index 100% rename from pkg/backup/testdata/v1/gcpsamples.gcp.stacks.crossplane.io.json rename to pkg/backup/actions/testdata/v1/gcpsamples.gcp.stacks.crossplane.io.json diff --git a/pkg/backup/testdata/v1/kibanas.kibana.k8s.elastic.co.json b/pkg/backup/actions/testdata/v1/kibanas.kibana.k8s.elastic.co.json similarity index 100% rename from pkg/backup/testdata/v1/kibanas.kibana.k8s.elastic.co.json rename to pkg/backup/actions/testdata/v1/kibanas.kibana.k8s.elastic.co.json diff --git a/pkg/backup/testdata/v1/pprometheuses.monitoring.coreos.com.json b/pkg/backup/actions/testdata/v1/pprometheuses.monitoring.coreos.com.json similarity index 100% rename from pkg/backup/testdata/v1/pprometheuses.monitoring.coreos.com.json rename to pkg/backup/actions/testdata/v1/pprometheuses.monitoring.coreos.com.json diff --git a/pkg/backup/testdata/v1/prometheuses.monitoring.coreos.com.json b/pkg/backup/actions/testdata/v1/prometheuses.monitoring.coreos.com.json similarity index 100% rename from pkg/backup/testdata/v1/prometheuses.monitoring.coreos.com.json rename to pkg/backup/actions/testdata/v1/prometheuses.monitoring.coreos.com.json diff --git a/pkg/backup/testdata/v1beta1/alertmanagers.monitoring.coreos.com.json b/pkg/backup/actions/testdata/v1beta1/alertmanagers.monitoring.coreos.com.json similarity index 100% rename from pkg/backup/testdata/v1beta1/alertmanagers.monitoring.coreos.com.json rename to pkg/backup/actions/testdata/v1beta1/alertmanagers.monitoring.coreos.com.json diff --git a/pkg/backup/testdata/v1beta1/elasticsearches.elasticsearch.k8s.elastic.co.json b/pkg/backup/actions/testdata/v1beta1/elasticsearches.elasticsearch.k8s.elastic.co.json similarity index 100% rename from pkg/backup/testdata/v1beta1/elasticsearches.elasticsearch.k8s.elastic.co.json rename to pkg/backup/actions/testdata/v1beta1/elasticsearches.elasticsearch.k8s.elastic.co.json diff --git a/pkg/backup/testdata/v1beta1/gcpsamples.gcp.stacks.crossplane.io.json b/pkg/backup/actions/testdata/v1beta1/gcpsamples.gcp.stacks.crossplane.io.json similarity index 100% rename from pkg/backup/testdata/v1beta1/gcpsamples.gcp.stacks.crossplane.io.json rename to pkg/backup/actions/testdata/v1beta1/gcpsamples.gcp.stacks.crossplane.io.json diff --git a/pkg/backup/testdata/v1beta1/kibanas.kibana.k8s.elastic.co.json b/pkg/backup/actions/testdata/v1beta1/kibanas.kibana.k8s.elastic.co.json similarity index 100% rename from pkg/backup/testdata/v1beta1/kibanas.kibana.k8s.elastic.co.json rename to pkg/backup/actions/testdata/v1beta1/kibanas.kibana.k8s.elastic.co.json diff --git a/pkg/backup/testdata/v1beta1/prometheuses.monitoring.coreos.com.json b/pkg/backup/actions/testdata/v1beta1/prometheuses.monitoring.coreos.com.json similarity index 100% rename from pkg/backup/testdata/v1beta1/prometheuses.monitoring.coreos.com.json rename to pkg/backup/actions/testdata/v1beta1/prometheuses.monitoring.coreos.com.json diff --git a/pkg/backup/pv_skip_tracker.go b/pkg/backup/pv_skip_tracker.go index 03f1a719d..3bb00ea31 100644 --- a/pkg/backup/pv_skip_tracker.go +++ b/pkg/backup/pv_skip_tracker.go @@ -1,3 +1,19 @@ +/* +Copyright 2018 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 backup import ( diff --git a/pkg/backup/pv_skip_tracker_test.go b/pkg/backup/pv_skip_tracker_test.go index bd258dd85..5f835dfde 100644 --- a/pkg/backup/pv_skip_tracker_test.go +++ b/pkg/backup/pv_skip_tracker_test.go @@ -1,3 +1,19 @@ +/* +Copyright 2018 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 backup import ( diff --git a/pkg/backup/pvc_snaphost_tracker_test.go b/pkg/backup/pvc_snaphost_tracker_test.go index 9952bfc01..6fcf61182 100644 --- a/pkg/backup/pvc_snaphost_tracker_test.go +++ b/pkg/backup/pvc_snaphost_tracker_test.go @@ -1,3 +1,19 @@ +/* +Copyright 2018 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 backup import ( diff --git a/pkg/cmd/server/plugin/plugin.go b/pkg/cmd/server/plugin/plugin.go index df1cf9f2d..c375c5437 100644 --- a/pkg/cmd/server/plugin/plugin.go +++ b/pkg/cmd/server/plugin/plugin.go @@ -24,13 +24,13 @@ import ( "github.com/vmware-tanzu/velero/pkg/datamover" velerov1api "github.com/vmware-tanzu/velero/pkg/apis/velero/v1" - "github.com/vmware-tanzu/velero/pkg/backup" + bia "github.com/vmware-tanzu/velero/pkg/backup/actions" "github.com/vmware-tanzu/velero/pkg/client" velerodiscovery "github.com/vmware-tanzu/velero/pkg/discovery" "github.com/vmware-tanzu/velero/pkg/features" veleroplugin "github.com/vmware-tanzu/velero/pkg/plugin/framework" plugincommon "github.com/vmware-tanzu/velero/pkg/plugin/framework/common" - "github.com/vmware-tanzu/velero/pkg/restore" + ria "github.com/vmware-tanzu/velero/pkg/restore/actions" ) func NewCommand(f client.Factory) *cobra.Command { @@ -76,11 +76,11 @@ func NewCommand(f client.Factory) *cobra.Command { } func newPVBackupItemAction(logger logrus.FieldLogger) (interface{}, error) { - return backup.NewPVCAction(logger), nil + return bia.NewPVCAction(logger), nil } func newPodBackupItemAction(logger logrus.FieldLogger) (interface{}, error) { - return backup.NewPodAction(logger), nil + return bia.NewPodAction(logger), nil } func newServiceAccountBackupItemAction(f client.Factory) plugincommon.HandlerInitializer { @@ -96,9 +96,9 @@ func newServiceAccountBackupItemAction(f client.Factory) plugincommon.HandlerIni return nil, err } - action, err := backup.NewServiceAccountAction( + action, err := bia.NewServiceAccountAction( logger, - backup.NewClusterRoleBindingListerMap(clientset), + bia.NewClusterRoleBindingListerMap(clientset), discoveryHelper) if err != nil { return nil, err @@ -129,20 +129,20 @@ func newRemapCRDVersionAction(f client.Factory) plugincommon.HandlerInitializer return nil, err } - return backup.NewRemapCRDVersionAction(logger, client.ApiextensionsV1beta1().CustomResourceDefinitions(), discoveryHelper), nil + return bia.NewRemapCRDVersionAction(logger, client.ApiextensionsV1beta1().CustomResourceDefinitions(), discoveryHelper), nil } } func newJobRestoreItemAction(logger logrus.FieldLogger) (interface{}, error) { - return restore.NewJobAction(logger), nil + return ria.NewJobAction(logger), nil } func newPodRestoreItemAction(logger logrus.FieldLogger) (interface{}, error) { - return restore.NewPodAction(logger), nil + return ria.NewPodAction(logger), nil } func newInitRestoreHookPodAction(logger logrus.FieldLogger) (interface{}, error) { - return restore.NewInitRestoreHookPodAction(logger), nil + return ria.NewInitRestoreHookPodAction(logger), nil } func newPodVolumeRestoreItemAction(f client.Factory) plugincommon.HandlerInitializer { @@ -157,28 +157,28 @@ func newPodVolumeRestoreItemAction(f client.Factory) plugincommon.HandlerInitial return nil, err } - return restore.NewPodVolumeRestoreAction(logger, client.CoreV1().ConfigMaps(f.Namespace()), crClient), nil + return ria.NewPodVolumeRestoreAction(logger, client.CoreV1().ConfigMaps(f.Namespace()), crClient), nil } } func newServiceRestoreItemAction(logger logrus.FieldLogger) (interface{}, error) { - return restore.NewServiceAction(logger), nil + return ria.NewServiceAction(logger), nil } func newServiceAccountRestoreItemAction(logger logrus.FieldLogger) (interface{}, error) { - return restore.NewServiceAccountAction(logger), nil + return ria.NewServiceAccountAction(logger), nil } func newAddPVCFromPodRestoreItemAction(logger logrus.FieldLogger) (interface{}, error) { - return restore.NewAddPVCFromPodAction(logger), nil + return ria.NewAddPVCFromPodAction(logger), nil } func newAddPVFromPVCRestoreItemAction(logger logrus.FieldLogger) (interface{}, error) { - return restore.NewAddPVFromPVCAction(logger), nil + return ria.NewAddPVFromPVCAction(logger), nil } func newCRDV1PreserveUnknownFieldsItemAction(logger logrus.FieldLogger) (interface{}, error) { - return restore.NewCRDV1PreserveUnknownFieldsAction(logger), nil + return ria.NewCRDV1PreserveUnknownFieldsAction(logger), nil } func newChangeStorageClassRestoreItemAction(f client.Factory) plugincommon.HandlerInitializer { @@ -188,7 +188,7 @@ func newChangeStorageClassRestoreItemAction(f client.Factory) plugincommon.Handl return nil, err } - return restore.NewChangeStorageClassAction( + return ria.NewChangeStorageClassAction( logger, client.CoreV1().ConfigMaps(f.Namespace()), client.StorageV1().StorageClasses(), @@ -203,18 +203,18 @@ func newChangeImageNameRestoreItemAction(f client.Factory) plugincommon.HandlerI return nil, err } - return restore.NewChangeImageNameAction( + return ria.NewChangeImageNameAction( logger, client.CoreV1().ConfigMaps(f.Namespace()), ), nil } } func newRoleBindingItemAction(logger logrus.FieldLogger) (interface{}, error) { - return restore.NewRoleBindingAction(logger), nil + return ria.NewRoleBindingAction(logger), nil } func newClusterRoleBindingItemAction(logger logrus.FieldLogger) (interface{}, error) { - return restore.NewClusterRoleBindingAction(logger), nil + return ria.NewClusterRoleBindingAction(logger), nil } func newChangePVCNodeSelectorItemAction(f client.Factory) plugincommon.HandlerInitializer { @@ -224,7 +224,7 @@ func newChangePVCNodeSelectorItemAction(f client.Factory) plugincommon.HandlerIn return nil, err } - return restore.NewChangePVCNodeSelectorAction( + return ria.NewChangePVCNodeSelectorAction( logger, client.CoreV1().ConfigMaps(f.Namespace()), client.CoreV1().Nodes(), @@ -233,11 +233,11 @@ func newChangePVCNodeSelectorItemAction(f client.Factory) plugincommon.HandlerIn } func newAPIServiceRestoreItemAction(logger logrus.FieldLogger) (interface{}, error) { - return restore.NewAPIServiceAction(logger), nil + return ria.NewAPIServiceAction(logger), nil } func newAdmissionWebhookConfigurationAction(logger logrus.FieldLogger) (interface{}, error) { - return restore.NewAdmissionWebhookConfigurationAction(logger), nil + return ria.NewAdmissionWebhookConfigurationAction(logger), nil } func newSecretRestoreItemAction(f client.Factory) plugincommon.HandlerInitializer { @@ -246,7 +246,7 @@ func newSecretRestoreItemAction(f client.Factory) plugincommon.HandlerInitialize if err != nil { return nil, err } - return restore.NewSecretAction(logger, client), nil + return ria.NewSecretAction(logger, client), nil } } @@ -257,7 +257,7 @@ func newDataUploadRetrieveAction(f client.Factory) plugincommon.HandlerInitializ return nil, err } - return restore.NewDataUploadRetrieveAction(logger, client), nil + return ria.NewDataUploadRetrieveAction(logger, client), nil } } diff --git a/pkg/restore/add_pv_from_pvc_action.go b/pkg/restore/actions/add_pv_from_pvc_action.go similarity index 94% rename from pkg/restore/add_pv_from_pvc_action.go rename to pkg/restore/actions/add_pv_from_pvc_action.go index 04c992357..e9e882d07 100644 --- a/pkg/restore/add_pv_from_pvc_action.go +++ b/pkg/restore/actions/add_pv_from_pvc_action.go @@ -1,13 +1,13 @@ /* Copyright 2019 the Velero contributors. - Licensed under the Apache License, Version 2.0 (the "License"); +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 +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 diff --git a/pkg/restore/add_pv_from_pvc_action_test.go b/pkg/restore/actions/add_pv_from_pvc_action_test.go similarity index 95% rename from pkg/restore/add_pv_from_pvc_action_test.go rename to pkg/restore/actions/add_pv_from_pvc_action_test.go index b4ceb90a4..4124fb2d8 100644 --- a/pkg/restore/add_pv_from_pvc_action_test.go +++ b/pkg/restore/actions/add_pv_from_pvc_action_test.go @@ -1,13 +1,13 @@ /* Copyright 2019 the Velero contributors. - Licensed under the Apache License, Version 2.0 (the "License"); +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 +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 diff --git a/pkg/restore/add_pvc_from_pod_action.go b/pkg/restore/actions/add_pvc_from_pod_action.go similarity index 100% rename from pkg/restore/add_pvc_from_pod_action.go rename to pkg/restore/actions/add_pvc_from_pod_action.go diff --git a/pkg/restore/add_pvc_from_pod_action_test.go b/pkg/restore/actions/add_pvc_from_pod_action_test.go similarity index 95% rename from pkg/restore/add_pvc_from_pod_action_test.go rename to pkg/restore/actions/add_pvc_from_pod_action_test.go index b409e5d6e..5e99006ad 100644 --- a/pkg/restore/add_pvc_from_pod_action_test.go +++ b/pkg/restore/actions/add_pvc_from_pod_action_test.go @@ -1,13 +1,13 @@ /* Copyright 2019 the Velero contributors. - Licensed under the Apache License, Version 2.0 (the "License"); +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 +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 diff --git a/pkg/restore/admissionwebhook_config_action.go b/pkg/restore/actions/admissionwebhook_config_action.go similarity index 100% rename from pkg/restore/admissionwebhook_config_action.go rename to pkg/restore/actions/admissionwebhook_config_action.go diff --git a/pkg/restore/admissionwebhook_config_action_test.go b/pkg/restore/actions/admissionwebhook_config_action_test.go similarity index 89% rename from pkg/restore/admissionwebhook_config_action_test.go rename to pkg/restore/actions/admissionwebhook_config_action_test.go index c6c31d221..cbc019ff0 100644 --- a/pkg/restore/admissionwebhook_config_action_test.go +++ b/pkg/restore/actions/admissionwebhook_config_action_test.go @@ -1,3 +1,19 @@ +/* +Copyright 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 restore import ( diff --git a/pkg/restore/apiservice_action.go b/pkg/restore/actions/apiservice_action.go similarity index 100% rename from pkg/restore/apiservice_action.go rename to pkg/restore/actions/apiservice_action.go diff --git a/pkg/restore/apiservice_action_test.go b/pkg/restore/actions/apiservice_action_test.go similarity index 100% rename from pkg/restore/apiservice_action_test.go rename to pkg/restore/actions/apiservice_action_test.go diff --git a/pkg/restore/change_image_name_action.go b/pkg/restore/actions/change_image_name_action.go similarity index 100% rename from pkg/restore/change_image_name_action.go rename to pkg/restore/actions/change_image_name_action.go diff --git a/pkg/restore/change_image_name_action_test.go b/pkg/restore/actions/change_image_name_action_test.go similarity index 100% rename from pkg/restore/change_image_name_action_test.go rename to pkg/restore/actions/change_image_name_action_test.go diff --git a/pkg/restore/change_pvc_node_selector.go b/pkg/restore/actions/change_pvc_node_selector.go similarity index 100% rename from pkg/restore/change_pvc_node_selector.go rename to pkg/restore/actions/change_pvc_node_selector.go diff --git a/pkg/restore/change_pvc_node_selector_test.go b/pkg/restore/actions/change_pvc_node_selector_test.go similarity index 100% rename from pkg/restore/change_pvc_node_selector_test.go rename to pkg/restore/actions/change_pvc_node_selector_test.go diff --git a/pkg/restore/change_storageclass_action.go b/pkg/restore/actions/change_storageclass_action.go similarity index 100% rename from pkg/restore/change_storageclass_action.go rename to pkg/restore/actions/change_storageclass_action.go diff --git a/pkg/restore/change_storageclass_action_test.go b/pkg/restore/actions/change_storageclass_action_test.go similarity index 100% rename from pkg/restore/change_storageclass_action_test.go rename to pkg/restore/actions/change_storageclass_action_test.go diff --git a/pkg/restore/clusterrolebinding_action.go b/pkg/restore/actions/clusterrolebinding_action.go similarity index 100% rename from pkg/restore/clusterrolebinding_action.go rename to pkg/restore/actions/clusterrolebinding_action.go diff --git a/pkg/restore/clusterrolebinding_action_test.go b/pkg/restore/actions/clusterrolebinding_action_test.go similarity index 100% rename from pkg/restore/clusterrolebinding_action_test.go rename to pkg/restore/actions/clusterrolebinding_action_test.go diff --git a/pkg/restore/crd_v1_preserve_unknown_fields_action.go b/pkg/restore/actions/crd_v1_preserve_unknown_fields_action.go similarity index 97% rename from pkg/restore/crd_v1_preserve_unknown_fields_action.go rename to pkg/restore/actions/crd_v1_preserve_unknown_fields_action.go index f67d47910..3f7b78241 100644 --- a/pkg/restore/crd_v1_preserve_unknown_fields_action.go +++ b/pkg/restore/actions/crd_v1_preserve_unknown_fields_action.go @@ -1,13 +1,13 @@ /* Copyright 2020 the Velero contributors. - Licensed under the Apache License, Version 2.0 (the "License"); +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 +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 diff --git a/pkg/restore/crd_v1_preserve_unknown_fields_action_test.go b/pkg/restore/actions/crd_v1_preserve_unknown_fields_action_test.go similarity index 92% rename from pkg/restore/crd_v1_preserve_unknown_fields_action_test.go rename to pkg/restore/actions/crd_v1_preserve_unknown_fields_action_test.go index 77045b596..63e2cea94 100644 --- a/pkg/restore/crd_v1_preserve_unknown_fields_action_test.go +++ b/pkg/restore/actions/crd_v1_preserve_unknown_fields_action_test.go @@ -1,13 +1,13 @@ /* Copyright 2020 the Velero contributors. - Licensed under the Apache License, Version 2.0 (the "License"); +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 +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 diff --git a/pkg/restore/dataupload_retrieve_action.go b/pkg/restore/actions/dataupload_retrieve_action.go similarity index 96% rename from pkg/restore/dataupload_retrieve_action.go rename to pkg/restore/actions/dataupload_retrieve_action.go index 79193411e..8194b6892 100644 --- a/pkg/restore/dataupload_retrieve_action.go +++ b/pkg/restore/actions/dataupload_retrieve_action.go @@ -1,13 +1,13 @@ /* Copyright 2020 the Velero contributors. - Licensed under the Apache License, Version 2.0 (the "License"); +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 +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 diff --git a/pkg/restore/dataupload_retrieve_action_test.go b/pkg/restore/actions/dataupload_retrieve_action_test.go similarity index 97% rename from pkg/restore/dataupload_retrieve_action_test.go rename to pkg/restore/actions/dataupload_retrieve_action_test.go index 2624f0886..1d14cf4c8 100644 --- a/pkg/restore/dataupload_retrieve_action_test.go +++ b/pkg/restore/actions/dataupload_retrieve_action_test.go @@ -1,13 +1,13 @@ /* Copyright 2020 the Velero contributors. - Licensed under the Apache License, Version 2.0 (the "License"); +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 +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 diff --git a/pkg/restore/init_restorehook_pod_action.go b/pkg/restore/actions/init_restorehook_pod_action.go similarity index 100% rename from pkg/restore/init_restorehook_pod_action.go rename to pkg/restore/actions/init_restorehook_pod_action.go diff --git a/pkg/restore/init_restorehook_pod_action_test.go b/pkg/restore/actions/init_restorehook_pod_action_test.go similarity index 100% rename from pkg/restore/init_restorehook_pod_action_test.go rename to pkg/restore/actions/init_restorehook_pod_action_test.go diff --git a/pkg/restore/job_action.go b/pkg/restore/actions/job_action.go similarity index 100% rename from pkg/restore/job_action.go rename to pkg/restore/actions/job_action.go diff --git a/pkg/restore/job_action_test.go b/pkg/restore/actions/job_action_test.go similarity index 100% rename from pkg/restore/job_action_test.go rename to pkg/restore/actions/job_action_test.go diff --git a/pkg/restore/pod_action.go b/pkg/restore/actions/pod_action.go similarity index 100% rename from pkg/restore/pod_action.go rename to pkg/restore/actions/pod_action.go diff --git a/pkg/restore/pod_action_test.go b/pkg/restore/actions/pod_action_test.go similarity index 100% rename from pkg/restore/pod_action_test.go rename to pkg/restore/actions/pod_action_test.go diff --git a/pkg/restore/pod_volume_restore_action.go b/pkg/restore/actions/pod_volume_restore_action.go similarity index 100% rename from pkg/restore/pod_volume_restore_action.go rename to pkg/restore/actions/pod_volume_restore_action.go diff --git a/pkg/restore/pod_volume_restore_action_test.go b/pkg/restore/actions/pod_volume_restore_action_test.go similarity index 100% rename from pkg/restore/pod_volume_restore_action_test.go rename to pkg/restore/actions/pod_volume_restore_action_test.go diff --git a/pkg/restore/rolebinding_action.go b/pkg/restore/actions/rolebinding_action.go similarity index 100% rename from pkg/restore/rolebinding_action.go rename to pkg/restore/actions/rolebinding_action.go diff --git a/pkg/restore/rolebinding_action_test.go b/pkg/restore/actions/rolebinding_action_test.go similarity index 100% rename from pkg/restore/rolebinding_action_test.go rename to pkg/restore/actions/rolebinding_action_test.go diff --git a/pkg/restore/secret_action.go b/pkg/restore/actions/secret_action.go similarity index 100% rename from pkg/restore/secret_action.go rename to pkg/restore/actions/secret_action.go diff --git a/pkg/restore/secret_action_test.go b/pkg/restore/actions/secret_action_test.go similarity index 100% rename from pkg/restore/secret_action_test.go rename to pkg/restore/actions/secret_action_test.go diff --git a/pkg/restore/service_account_action.go b/pkg/restore/actions/service_account_action.go similarity index 100% rename from pkg/restore/service_account_action.go rename to pkg/restore/actions/service_account_action.go diff --git a/pkg/restore/service_account_action_test.go b/pkg/restore/actions/service_account_action_test.go similarity index 100% rename from pkg/restore/service_account_action_test.go rename to pkg/restore/actions/service_account_action_test.go diff --git a/pkg/restore/service_action.go b/pkg/restore/actions/service_action.go similarity index 100% rename from pkg/restore/service_action.go rename to pkg/restore/actions/service_action.go diff --git a/pkg/restore/service_action_test.go b/pkg/restore/actions/service_action_test.go similarity index 100% rename from pkg/restore/service_action_test.go rename to pkg/restore/actions/service_action_test.go