Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelogs/unreleased/9265-nweisenauer-sap
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixes Restore for Workerless Clusters
12 changes: 9 additions & 3 deletions pkg/restore/actions/pod_volume_restore_action.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const (
defaultMemRequestLimit = "128Mi"
defaultCommand = "/velero-restore-helper"
restoreHelperUID = 1000
veleroDeploymentName = "velero"
)

type PodVolumeRestoreAction struct {
Expand All @@ -61,10 +62,12 @@ type PodVolumeRestoreAction struct {

func NewPodVolumeRestoreAction(logger logrus.FieldLogger, client corev1client.ConfigMapInterface, crClient ctrlclient.Client, namespace string) (*PodVolumeRestoreAction, error) {
deployment := &appsv1api.Deployment{}
if err := crClient.Get(context.TODO(), types.NamespacedName{Name: "velero", Namespace: namespace}, deployment); err != nil {
return nil, err
image := ""
if err := crClient.Get(context.TODO(), types.NamespacedName{Name: veleroDeploymentName, Namespace: namespace}, deployment); err != nil {
logger.WithError(err).Warnf("Could not find deployment %q in namespace %q", veleroDeploymentName, namespace)
} else {
image = veleroutil.GetVeleroServerImage(deployment)
Comment on lines +66 to +69
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So based on feedback saw earlier, my tip for getting this in would be to hide this behavior behind a server feature flag or something.

Like velero server --workerless-mode and you will then perhaps not have to use warn, but just info as it is an expected operating mode.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does that sound reasonable? @reasonerjt perhaps you want this implementation explained and detailed as a design for the epic #7843

}
image := veleroutil.GetVeleroServerImage(deployment)
return &PodVolumeRestoreAction{
logger: logger,
client: client,
Expand Down Expand Up @@ -146,6 +149,9 @@ func (a *PodVolumeRestoreAction) Execute(input *velero.RestoreItemActionExecuteI
}

image := getImage(log, config, a.veleroImage)
if image == "" {
return nil, errors.New("could not determine image for restore init container")
}
log.Infof("Using image %q", image)

cpuRequest, memRequest := getResourceRequests(log, config)
Expand Down