Skip to content

Commit

Permalink
Merge pull request #695 from k8up-io/fix-nil-archive
Browse files Browse the repository at this point in the history
Fix nil pointer panic in Archive spec
  • Loading branch information
ccremer authored Jun 22, 2022
2 parents 000e689 + 4ff5aa8 commit a70cb60
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions controllers/archive_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ func (r *ArchiveReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ct
if archive.Spec.Backend != nil {
repository = archive.Spec.Backend.String()
}
if archive.Spec.RestoreSpec == nil {
archive.Spec.RestoreSpec = &k8upv1.RestoreSpec{}
}
config := job.NewConfig(ctx, r.Client, log, archive, r.Scheme, repository)

archiveHandler := handler.NewHandler(config)
Expand Down
3 changes: 3 additions & 0 deletions controllers/schedule_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ func (r *ScheduleReconciler) Reconcile(ctx context.Context, req ctrl.Request) (c
if schedule.Spec.Backend != nil {
repository = schedule.Spec.Backend.String()
}
if schedule.Spec.Archive != nil && schedule.Spec.Archive.RestoreSpec == nil {
schedule.Spec.Archive.RestoreSpec = &k8upv1.RestoreSpec{}
}
config := job.NewConfig(ctx, r.Client, log, schedule, r.Scheme, repository)

return ctrl.Result{}, handler.NewScheduleHandler(config, schedule, effectiveSchedules).Handle()
Expand Down

0 comments on commit a70cb60

Please sign in to comment.