-
Notifications
You must be signed in to change notification settings - Fork 6
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
pb-4872: Added change to support ignore file option for kdmp snapshot. #321
Conversation
OSS Scan Results:
Total issues: 326 |
License Evaluation Results:
Total License Issues: 19 |
storageClassList := strings.Split(excludeFileListValue, ",") | ||
var excludeFileList string | ||
for _, storageClass := range storageClassList { | ||
colonSplit := strings.Split(storageClass, ":") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"# " and : are standard charectors widely used in many scripting and declarative programming. I am just wondering using these charectors as delimiter may conflict while using in scripting code..
Mostly # which is widely used charector for comments.
it looks ok in configMap with :and "#" but --exclude-file-list dir1#dir2#file1 could change to more safer delimiter ","
I would prefer more of yaml style parsing in configMap too but not sure how complex that is
exclude-file:
storageClass: px-db
files:
- dir1
- dir2
- file1
storageClass: mysql-1
files:
- dir1
- dir2
- file1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good Suggestion. Even I was not convienced on the format. Let me check whether this option is possible in configmap value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like something like this is possible. I will give a try.
excludfile-list: |
sc1=dir1,file1,dir2
sc2=file1,dir2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this format:
[root@ip-10-13-176-197 ~]# kubectl get cm kdmp-config -n kube-system -o yaml
apiVersion: v1
data:
ENABLE_PX_GENERIC_BACKUP: "true"
EXCLUDE-FILE-LIST: |
px-db=dir1,file1
mysql=dir3,file2
KDMP_BACKUP_JOB_LIMIT: "5"
KDMP_DELETE_JOB_LIMIT: "5"
KDMP_EXCLUDE_FILE_LIST: px-db:dir1#dir2#file1,mysql-sc:dir1#file1#dir2
KDMP_KOPIAEXECUTOR_IMAGE: kopiaexecutor:1.2.8
KDMP_KOPIAEXECUTOR_IMAGE_SECRET: ""
KDMP_KOPIAEXECUTOR_LIMIT_CPU: "0.2"
KDMP_KOPIAEXECUTOR_LIMIT_MEMORY: 1Gi
KDMP_KOPIAEXECUTOR_REQUEST_CPU: "0.1"
KDMP_KOPIAEXECUTOR_REQUEST_MEMORY: 700Mi
KDMP_MAINTENANCE_JOB_LIMIT: "5"
KDMP_RESTORE_JOB_LIMIT: "5"
SNAPSHOT_TIMEOUT: ""
kind: ConfigMap
metadata:
creationTimestamp: "2023-11-17T07:08:17Z"
name: kdmp-config
namespace: kube-system
resourceVersion: "2782332"
uid: 0de957af-b66d-4105-a6b5-84851ed9e043
[root@ip-10-13-176-197 ~]#
While reading, it is coming like this:
time="2023-11-21T04:00:19Z" level=info msg="sivakumar --- ignorefile px-db=dir1,file1\nmysql=dir3,file2\n"
I will use "\n" as delimiter and get one of storageclass. I will modify the code to handle this.
import (
"fmt"
"strings"
)
func main() {
fmt.Println("Hello, 世界")
test := "px-db=dir1,file1\nmysql=dir3,file2\n"
temp1 := strings.Split(test, "\n")
fmt.Printf("temp1: %v", temp1)
}
Output:
temp1: [px-db=dir1,file1 mysql=dir3,file2 ]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
if we have to give path seperated files I hope this works like
px-db=dir1/file1,dir2/file1
In the above example two files are same but differ in their path. I am assuming dir1 in the example means ignore snapshot of entire dir, while file1 means ignore backup of file matching file1..
it is not clear from the example.
However kopia policy set says path.. so may be documentation should be clear with path as values.
OSS Scan Results:
Total issues: 326 |
License Evaluation Results:
Total License Issues: 19 |
b3bce5d
to
5f6d415
Compare
OSS Scan Results:
Total issues: 326 |
License Evaluation Results:
Total License Issues: 19 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM added nit comment
storageClassList := strings.Split(excludeFileListValue, ",") | ||
var excludeFileList string | ||
for _, storageClass := range storageClassList { | ||
colonSplit := strings.Split(storageClass, ":") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
if we have to give path seperated files I hope this works like
px-db=dir1/file1,dir2/file1
In the above example two files are same but differ in their path. I am assuming dir1 in the example means ignore snapshot of entire dir, while file1 means ignore backup of file matching file1..
it is not clear from the example.
However kopia policy set says path.. so may be documentation should be clear with path as values.
OSS Scan Results:
Total issues: 326 |
License Evaluation Results:
Total License Issues: 19 |
205593d
to
294e481
Compare
OSS Scan Results:
Total issues: 326 |
License Evaluation Results:
Total License Issues: 19 |
- Added KDMP_EXCLUDE_FILE_LIST configmap parameter to kdmp-config configmap for used to specify the ignore file list for kdmp snapshot. - Added set policy command execution in kopiabackup executor for setting ignore file list to kopia.
OSS Scan Results:
Total issues: 326 |
License Evaluation Results:
Total License Issues: 19 |
332a8f8
to
b451f8c
Compare
OSS Scan Results:
Total issues: 326 |
License Evaluation Results:
Total License Issues: 19 |
What this PR does / why we need it:
Which issue(s) this PR fixes (optional)
Closes # pb-4872
Special notes for your reviewer:
Testing:
For mysql namespace:
For mysql2 namespace:
Source PVC content with the temporary test directory ( dir1, dir2) and test file ( file1):
After that restore to "rmysql" namespace and "rmysql2" namespace and checked the pvc content. Verified the temporary test dir ( dir1, dir2) and test file (file1) was not restored.
Will be executing the funcitonal testcases from below link:
https://portworx.testrail.net/index.php?/runs/view/7775&group_by=cases:section_id&group_order=asc&group_id=9201