-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backups to B2 fail after the first backup #690
Comments
I'm also getting this error, but I'm using the Backup resource, instead of the Schedule resource. Same errors though, k8up calls restic to intialize the repo in the b2 bucket, and it creates the correct config, but then fails for some reason, and tries to run again, and fail loops:
Interestingly this doesn't even work the first time for me to actually back anything up. It only initializes the bucket and config remotely. If I check the bucket for any actual data, there is none. I did recently move this Backup resource to the same namespace as the stateful app I'm trying to backup. Previously my backup resource lived in the same namespace as the main k8up deployment, and it succeeded there, but couldn't find my other apps in other namespaces, so it never actually backed anything up, but successfully inited the repo and exited as completed. Since moving it to the namespace that the stateful app actually lives in, it fails consistently. Should k8up be helm installed in the same namespace as the stateful app it is monitoring? |
I don't think this has anything to do with the namespaces after some further testing, but I did find this: Line 49 in 538ec7e
according to this function, // Init initialises a repository, checks if the repositor exists and will
// initialise it if not. It's save to call this every time.
func (r *Restic) Init() error {
initLogger := r.logger.WithName("RepoInit")
resticLogger := initLogger.WithName("restic")
initErrorCatcher := &initStdErrWrapper{
exists: false,
Writer: logging.NewErrorWriter(resticLogger),
}
opts := CommandOptions{
Path: r.resticPath,
Args: r.globalFlags.ApplyToCommand("init"),
StdOut: logging.NewInfoWriter(resticLogger),
StdErr: initErrorCatcher,
}
cmd := NewCommand(r.ctx, initLogger, opts)
cmd.Run()
if !initErrorCatcher.exists {
return cmd.FatalError
}
return nil
} But if we look at that function for func (i *initStdErrWrapper) Write(p []byte) (n int, err error) {
scanner := bufio.NewScanner(bytes.NewReader(p))
for scanner.Scan() {
if strings.Contains(scanner.Text(), "already initialized") {
i.exists = true
return len(p), nil
}
} It looks like it's only looking for
So this will always fail. I am creating a PR to add an additional string of "config already exists" to check, because it looks like both error strings are still possible to hit as per the following:
Edit for more thoughts and formatting: spec:
backend:
repoInitialize: false
repoPasswordSecretRef:
name: k8up-restic-b2-repo-pw
key: password |
Hi. For the time being, we would like to avoid any API changes if possible. |
Not a problem at all! Happy to help, as I really like this project :) Also, that was in fact the root cause, that for backblaze specifically restic has a different text error, but in my original fix it didn't like where my I've reopened that pull request, because the area of the code I was modifying is, in fact, correct, and I don't want this to span over too many areas in case future people want to research this. :) I don't have permission to run the GHA pipeline, but it SHOULD be ok. EDIT: wrong issue number, updated to be correct issue number |
Released new bugfix: https://github.com/k8up-io/k8up/releases/tag/v2.3.3 |
Description
When creating a schedule with the B2 backend instead of the S3 backend the first backup runs fine and ends sucessfully. But every subsequent backup fails with the attached logs.
Additional Context
Backups via the S3 provider run fine all the time, but we would like to use the path parameter that is only offered by the B2 provider.
Logs
Expected Behavior
Subsequent Backups run correctly and succeed.
Steps To Reproduce
Version of K8up
v2.1.2
Version of Kubernetes
v1.23
Distribution of Kubernetes
KubeOne
The text was updated successfully, but these errors were encountered: