Skip to content
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

Add design for backup repository configurations #7963

Merged
merged 2 commits into from
Jul 26, 2024

Conversation

Lyndon-Li
Copy link
Contributor

Add design for backup repository configurations for issue #7620, #7301

@github-actions github-actions bot added the Area/Design Design Documents label Jul 2, 2024
Copy link

codecov bot commented Jul 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 58.82%. Comparing base (9c20b5c) to head (c01c679).
Report is 49 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7963      +/-   ##
==========================================
+ Coverage   58.79%   58.82%   +0.02%     
==========================================
  Files         345      346       +1     
  Lines       28766    28892     +126     
==========================================
+ Hits        16914    16995      +81     
- Misses      10423    10468      +45     
  Partials     1429     1429              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@mpryc mpryc left a comment

Choose a reason for hiding this comment

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

In general I do like the design.

design/backup-repo-config.md Show resolved Hide resolved
design/backup-repo-config.md Outdated Show resolved Hide resolved
design/backup-repo-config.md Outdated Show resolved Hide resolved
design/backup-repo-config.md Outdated Show resolved Hide resolved
The BackupRepository configMap is created by users. If the configMap is not there, nothing is specified to the backup repository CR, so the Unified Repo modules use the hard-coded values to configure the backup repository.
The BackupRepository configMap is backup repository type specific, that is, for each type of backup repository, there is one configMap. Therefore, a ```backup-repository-config``` label should be applied to the configMap with the value of the repository's type. During the backup repository creation, the configMap is searched by the label against the repository type, if no configMap is found, nothing is set to the backup repository CR.

### Configurations
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we also document the list of parameters that are configurable and the ones that are hard coded for kopia repo ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

cache-limit-mb and enable-compression are the supported parameters.
There are no other parameters that should be exposed to users, so they are not relevant to this design. But we can find all the parameters for kopia from the code at https://github.com/vmware-tanzu/velero/blob/main/pkg/repository/udmrepo/kopialib/backend/common.go

design/backup-repo-config.md Outdated Show resolved Hide resolved
@Lyndon-Li
Copy link
Contributor Author

@shubham-pampattiwar Made some slight changes, please review again. Thanks.

Copy link
Collaborator

@shubham-pampattiwar shubham-pampattiwar left a comment

Choose a reason for hiding this comment

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

/lgtm

repoConfig: |
{
"cacheLimitMB": 2048,
"enableCompression": true
Copy link
Contributor

Choose a reason for hiding this comment

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

I also think it's worth considering allowing other repo configuration options to be configurable via this design. Namely thinking of different kopia repo options e.g.:
https://github.com/wawa0210/velero/blob/89c10ddcc04e4dc7354f284434c2ddb8c121780c/pkg/repository/udmrepo/repo_options.go#L63-L65

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let's do this incrementally in future based on the requirements.
For now, the 3 options you mentioned are too advanced(especially for the hash algorithm and chunking algorithm, without a good knowledge of the deduplication and the status of their own data, users cannot decide a better value than the default ones) and not general enough in terms of unified repository concepts(many backup repositories/storages are using private chunking/hashing algorithms and don't allow users to change, because those have heavy impacts on the QOS of the repo).

blackpiglet
blackpiglet previously approved these changes Jul 19, 2024
@Lyndon-Li
Copy link
Contributor Author

Lyndon-Li commented Jul 22, 2024

@mpryc @shubham-pampattiwar @blackpiglet @reasonerjt
After some discussions, we made below changes to this design:

  1. Move configurations for all repo types into one configMap. Previously one configMap for one repo type
  2. Use name to find the configMap and require the name to be explicitly set to velero server parameters. Previously use label to find the configMap and don't require the label to be explicitly set to velero
  3. Add a installation flag to set the velero server parameter

Please have further review. Thanks.

blackpiglet
blackpiglet previously approved these changes Jul 22, 2024
@shubham-pampattiwar
Copy link
Collaborator

shubham-pampattiwar commented Jul 22, 2024

@Lyndon-Li I am fine with either of the approaches. Would like to know why the change in approach though ?

@Lyndon-Li
Copy link
Contributor Author

@Lyndon-Li I am fine with either of the approaches. Would like to why the change in approach though ?

After some discussion, we would like to unify the way to set configurations through configMap (including node-agent configs, backup repository configs and maintenance job configs) to velero:

  • The configMap should be always searched by name
  • The configMap name should be set to velero server/node-agent at start time, though users may be allowed to change the content of the configMap later. Otherwise, the configMap will be ignored

The would help the downstream users (which integrate velero) to better control velero's behavior in a consistent way. cc @reasonerjt

design/backup-repo-config.md Show resolved Hide resolved
To create the configMap, users need to save something like the above sample to a file and then run below commands:
```
kubectl create cm <config-name> -n velero --from-file=<json file name>
kubectl label cm <config-name> -n velero backup-repository-config=<repository type>
Copy link
Contributor

Choose a reason for hiding this comment

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

Is the step of adding label still needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, it is not required, I have removed it.

## Installation
In order to set the ```--backup-repository-config``` parameter to the velero server, a new installation parameter ```--backup-repository-config``` will be added. An example of the installation as below:
```
velero install --backup-repository-config <configmap-name>
Copy link
Contributor

Choose a reason for hiding this comment

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

This could be optional b/c we can hard code a configmap name and pass it to the velero server, and the user will only need to create the configmap with the hard-coded name.

If we took this approach ^ we may not need to update the installation flow, bearing in mind that when velero is installed it's very possible the namespace of velero is not created.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We will remove this installation flag and keep the velero server flag.
By default installation using velero CLI, the server flag is not set; users need to modify the deployment to set the flag and wait velero server to restart.


Below are the struct for the configMap:
``` golang
type RepoConfig struct {
Copy link
Contributor

@reasonerjt reasonerjt Jul 23, 2024

Choose a reason for hiding this comment

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

I wanna clarify, it's the RepoConfig will be populated to the CR right? If that's the case, should the field in the backup repo CR be singular (repositoryConfig) or plural (repositoryConfigs)? Singular may be slightly better?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed the field in the CRD to repositoryConfig

Comment on lines +82 to +84
The BackupRepository configMap is created by users in velero installation namespace. The configMap name must be specified in the velero server parameter ```--backup-repository-config```, otherwise, it won't effect.
If the configMap name is specified but the configMap doesn't exist by the time of a backup repository is created, the configMap name is ignored.
For any reason, if the configMap doesn't effect, nothing is specified to the backup repository CR, so the Unified Repo modules use the hard-coded values to configure the backup repository.
Copy link
Member

Choose a reason for hiding this comment

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

Will velero be watching for changes to CM? or will it only parse the value at startup? Or per backup?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think its at startup and per backup, @Lyndon-Li lets clarify that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When a backupRepository CR is created, this CM is visited. So Velero doesn't watch the changes to the CM, but users are allowed to change the content during runtime, the changes will effect for the next created backupRepository. See below statement in the design:
When the backup repository CR is created by the BackupRepository controller, the configurations in the configMap are copied to the ```repositoryConfig``` field.

@reasonerjt reasonerjt merged commit d9ca147 into vmware-tanzu:main Jul 26, 2024
66 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants