Skip to content

Commit 2c2d3e9

Browse files
committed
Remove Restic code path from PodVolumeRestore.
Signed-off-by: Xun Jiang <xun.jiang@broadcom.com>
1 parent fc6361b commit 2c2d3e9

14 files changed

Lines changed: 9 additions & 539 deletions

cmd/velero-restore-helper/velero-restore-helper.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func main() {
3535
for {
3636
<-ticker.C
3737
if done() {
38-
fmt.Println("All restic restores are done")
38+
fmt.Println("All FS restores are done")
3939
err := removeFolder()
4040
if err != nil {
4141
fmt.Println(err)

config/crd/v1/bases/velero.io_backuprepositories.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ spec:
6565
description: RepositoryType indicates the type of the backend repository
6666
enum:
6767
- kopia
68-
- restic
69-
- ""
7068
type: string
7169
resticIdentifier:
7270
description: Deprecated

config/crd/v1/bases/velero.io_podvolumebackups.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,6 @@ spec:
161161
data transfer.
162162
enum:
163163
- kopia
164-
- restic
165-
- ""
166164
type: string
167165
volume:
168166
description: |-

config/crd/v1/bases/velero.io_podvolumerestores.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,6 @@ spec:
154154
data transfer.
155155
enum:
156156
- kopia
157-
- restic
158-
- ""
159157
type: string
160158
volume:
161159
description: Volume is the name of the volume within the Pod to be

config/crd/v1/crds/crds.go

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/resourcepolicies/resource_policies.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const (
3838
ConfigmapRefType string = "configmap"
3939
// skip action implies the volume would be skipped from the backup operation
4040
Skip VolumeActionType = "skip"
41-
// fs-backup action implies that the volume would be backed up via file system copy method using the uploader(kopia/restic) configured by the user
41+
// fs-backup action implies that the volume would be backed up via file system copy method using the uploader(kopia) configured by the user
4242
FSBackup VolumeActionType = "fs-backup"
4343
// snapshot action can have 3 different meaning based on velero configuration and backup spec - cloud provider based snapshots, local csi snapshots and datamover snapshots
4444
Snapshot VolumeActionType = "snapshot"

pkg/apis/velero/v1/backup_repository_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ type BackupRepositorySpec struct {
3131
BackupStorageLocation string `json:"backupStorageLocation"`
3232

3333
// RepositoryType indicates the type of the backend repository
34-
// +kubebuilder:validation:Enum=kopia;restic;""
34+
// +kubebuilder:validation:Enum=kopia
3535
// +optional
3636
RepositoryType string `json:"repositoryType"`
3737

pkg/apis/velero/v1/pod_volume_backup_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ type PodVolumeBackupSpec struct {
4343
RepoIdentifier string `json:"repoIdentifier"`
4444

4545
// UploaderType is the type of the uploader to handle the data transfer.
46-
// +kubebuilder:validation:Enum=kopia;restic;""
46+
// +kubebuilder:validation:Enum=kopia
4747
// +optional
4848
UploaderType string `json:"uploaderType"`
4949

pkg/apis/velero/v1/pod_volume_restore_type.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ type PodVolumeRestoreSpec struct {
3939
RepoIdentifier string `json:"repoIdentifier"`
4040

4141
// UploaderType is the type of the uploader to handle the data transfer.
42-
// +kubebuilder:validation:Enum=kopia;restic;""
42+
// +kubebuilder:validation:Enum=kopia
4343
// +optional
4444
UploaderType string `json:"uploaderType"`
4545

pkg/cmd/cli/nodeagent/server.go

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ import (
3737
"k8s.io/apimachinery/pkg/fields"
3838
"k8s.io/apimachinery/pkg/labels"
3939
"k8s.io/apimachinery/pkg/runtime"
40-
"k8s.io/apimachinery/pkg/types"
4140
"k8s.io/apimachinery/pkg/util/sets"
4241
"k8s.io/client-go/kubernetes"
4342
cacheutil "k8s.io/client-go/tools/cache"
@@ -430,10 +429,6 @@ func (s *nodeAgentServer) run() {
430429
s.logger.WithError(err).Fatal("Unable to create the pod volume restore controller")
431430
}
432431

433-
if err := controller.InitLegacyPodVolumeRestoreReconciler(s.mgr.GetClient(), s.mgr, s.kubeClient, s.dataPathMgr, s.namespace, s.config.resourceTimeout, s.logger); err != nil {
434-
s.logger.WithError(err).Fatal("Unable to create the legacy pod volume restore controller")
435-
}
436-
437432
dataUploadReconciler := controller.NewDataUploadReconciler(
438433
s.mgr.GetClient(),
439434
s.mgr,
@@ -509,8 +504,6 @@ func (s *nodeAgentServer) run() {
509504
if err := pvrReconciler.AttemptPVRResume(s.ctx, s.logger.WithField("node", s.nodeName), s.namespace); err != nil {
510505
s.logger.WithError(errors.WithStack(err)).Error("Failed to attempt PVR resume")
511506
}
512-
513-
s.markLegacyPVRsFailed(s.mgr.GetClient())
514507
}()
515508

516509
s.logger.Info("Controllers starting...")
@@ -604,47 +597,6 @@ func (s *nodeAgentServer) validatePodVolumesHostPath(client kubernetes.Interface
604597
return nil
605598
}
606599

607-
func (s *nodeAgentServer) markLegacyPVRsFailed(client ctrlclient.Client) {
608-
pvrs := &velerov1api.PodVolumeRestoreList{}
609-
if err := client.List(s.ctx, pvrs, &ctrlclient.ListOptions{Namespace: s.namespace}); err != nil {
610-
s.logger.WithError(errors.WithStack(err)).Error("failed to list podvolumerestores")
611-
return
612-
}
613-
614-
for i, pvr := range pvrs.Items {
615-
if !controller.IsLegacyPVR(&pvr) {
616-
continue
617-
}
618-
619-
if pvr.Status.Phase != velerov1api.PodVolumeRestorePhaseInProgress {
620-
s.logger.Debugf("the status of podvolumerestore %q is %q, skip", pvr.GetName(), pvr.Status.Phase)
621-
continue
622-
}
623-
624-
pod := &corev1api.Pod{}
625-
if err := client.Get(s.ctx, types.NamespacedName{
626-
Namespace: pvr.Spec.Pod.Namespace,
627-
Name: pvr.Spec.Pod.Name,
628-
}, pod); err != nil {
629-
s.logger.WithError(errors.WithStack(err)).Errorf("failed to get pod \"%s/%s\" of podvolumerestore %q",
630-
pvr.Spec.Pod.Namespace, pvr.Spec.Pod.Name, pvr.GetName())
631-
continue
632-
}
633-
if pod.Spec.NodeName != s.nodeName {
634-
s.logger.Debugf("the node of pod referenced by podvolumerestore %q is %q, not %q, skip", pvr.GetName(), pod.Spec.NodeName, s.nodeName)
635-
continue
636-
}
637-
638-
if err := controller.UpdatePVRStatusToFailed(s.ctx, client, &pvrs.Items[i], errors.New("cannot survive from node-agent restart"),
639-
fmt.Sprintf("get a legacy podvolumerestore with status %q during the server starting, mark it as %q", velerov1api.PodVolumeRestorePhaseInProgress, velerov1api.PodVolumeRestorePhaseFailed),
640-
time.Now(), s.logger); err != nil {
641-
s.logger.WithError(errors.WithStack(err)).Errorf("failed to patch podvolumerestore %q", pvr.GetName())
642-
continue
643-
}
644-
s.logger.WithField("podvolumerestore", pvr.GetName()).Warn(pvr.Status.Message)
645-
}
646-
}
647-
648600
var getConfigsFunc = nodeagent.GetConfigs
649601

650602
func (s *nodeAgentServer) getDataPathConfigs() error {

0 commit comments

Comments
 (0)