-
Notifications
You must be signed in to change notification settings - Fork 932
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
Storage: Per project image and backup storage options #14582
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Mark Bolton <[email protected]>
Signed-off-by: Mark Bolton <[email protected]>
Signed-off-by: Mark Bolton <[email protected]>
Signed-off-by: Mark Bolton <[email protected]>
Signed-off-by: Mark Bolton <[email protected]>
Signed-off-by: Mark Bolton <[email protected]>
// Create images and backups directories, and symlink to the daemon path by default. | ||
imageDaemonPath := shared.VarPath("images", "daemon", fmt.Sprintf("project_%s", project.Name)) | ||
imageSymPath := shared.VarPath("images", fmt.Sprintf("project_%s", project.Name)) | ||
err = os.MkdirAll(imageDaemonPath, 0700) |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression High
user-provided value
if err != nil { | ||
return response.InternalError(fmt.Errorf("Failed to create directory %q: %w", imageDaemonPath, err)) | ||
} | ||
err = os.Symlink(imageDaemonPath, imageSymPath) |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression High
user-provided value
if err != nil { | ||
return response.InternalError(fmt.Errorf("Failed to create directory %q: %w", imageDaemonPath, err)) | ||
} | ||
err = os.Symlink(imageDaemonPath, imageSymPath) |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression High
user-provided value
backupsSymPath := shared.VarPath("backups", fmt.Sprintf("project_%s", project.Name)) | ||
backupsCustomPath := filepath.Join(backupsSymPath, "custom") | ||
backupsInstancesPath := filepath.Join(backupsSymPath, "instances") | ||
err = os.MkdirAll(backupsDaemonPath, 0700) |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression High
user-provided value
if err != nil { | ||
return response.InternalError(fmt.Errorf("Failed to create directory %q: %w", backupsDaemonPath, err)) | ||
} | ||
err = os.Symlink(backupsDaemonPath, backupsSymPath) |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression High
user-provided value
if err != nil { | ||
return response.InternalError(fmt.Errorf("Failed to create directory %q: %w", backupsCustomPath, err)) | ||
} | ||
err = os.MkdirAll(backupsInstancesPath, 0700) |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression High
user-provided value
if err != nil { | ||
return fmt.Errorf("Failed to create the new symlink at %q: %w", shared.VarPath(storageType), err) | ||
// Create the new symlink. | ||
err = os.Symlink(destPath, shared.VarPath(storageType, "daemon")) |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression High
user-provided value
This path depends on a
user-provided value
} | ||
|
||
// Create the new symlink. | ||
err = os.Symlink(destPath, shared.VarPath(storageType, fmt.Sprintf("project_%s", projectName))) |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression High
user-provided value
This path depends on a
user-provided value
if err != nil { | ||
return fmt.Errorf("Failed to create the new symlink at %q: %w", shared.VarPath(storageType), err) | ||
// Create the new symlink. | ||
err = os.Symlink(destPath, shared.VarPath(storageType, "daemon")) |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression High
user-provided value
This path depends on a
user-provided value
} | ||
|
||
// Create the new symlink. | ||
err = os.Symlink(destPath, shared.VarPath(storageType, fmt.Sprintf("project_%s", projectName))) |
Check failure
Code scanning / CodeQL
Uncontrolled data used in path expression High
user-provided value
This path depends on a
This PR adds support for per-project image and backup storage options. We maintain the option to select storage options at the server level, and add a more fine-grained option to select this at the project level.
TODO: Add overview of implementation