Skip to content

Commit

Permalink
Don't drop the backend configuration for archives
Browse files Browse the repository at this point in the history
The operator didn't add the backend (source) environment variables to
the resulting pod. This resulted in broken archive jobs where Restic was
not able to read the actual backup data.

This commit fixes this issue by actually adding the correct backend env
variables.

Signed-off-by: Simon Beck <[email protected]>
  • Loading branch information
Kidswiss committed Jun 14, 2023
1 parent f9d8c2e commit 19d65f5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions operator/archivecontroller/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ func (a *ArchiveExecutor) setupEnvVars(ctx context.Context, archive *k8upv1.Arch
}
}

if archive.Spec.Backend != nil {
for key, value := range archive.Spec.Backend.GetCredentialEnv() {
vars.SetEnvVarSource(key, value)
}
vars.SetString(cfg.ResticRepositoryEnvName, archive.Spec.Backend.String())
}

err := vars.Merge(executor.DefaultEnv(a.Obj.GetNamespace()))
if err != nil {
log.Error(err, "error while merging the environment variables", "name", a.Obj.GetName(), "namespace", a.Obj.GetNamespace())
Expand Down

0 comments on commit 19d65f5

Please sign in to comment.