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

Update integrated Restic version and add insecureSkipTLSVerify for Re… #4821

Conversation

blackpiglet
Copy link
Contributor

@blackpiglet blackpiglet commented Apr 11, 2022

…stic CLI

Fix: #4820

Signed-off-by: Xun Jiang jxun@vmware.com

Thank you for contributing to Velero!

Please add a summary of your change

Does your change fix a particular issue?

Fixes #4820

Please indicate you've done the following:

  • Accepted the DCO. Commits without the DCO will delay acceptance.
  • Created a changelog file or added /kind changelog-not-required as a comment on this pull request.
  • Updated the corresponding documentation in site/content/docs/main.

@blackpiglet blackpiglet self-assigned this Apr 11, 2022
…stic CLI

Fix: vmware-tanzu#4820

Signed-off-by: Xun Jiang <jxun@vmware.com>
@blackpiglet blackpiglet force-pushed the 4820-add-skip-tls-verify-for-restic branch from 9f9c741 to 10651e6 Compare April 11, 2022 13:21
pkg/restic/common.go Outdated Show resolved Hide resolved
Signed-off-by: Xun Jiang <jxun@vmware.com>
@blackpiglet blackpiglet force-pushed the 4820-add-skip-tls-verify-for-restic branch from 7a6a482 to 9849ab1 Compare April 12, 2022 03:30
@codecov-commenter
Copy link

codecov-commenter commented Apr 12, 2022

Codecov Report

Merging #4821 (e4881b7) into main (65db258) will increase coverage by 0.03%.
The diff coverage is 37.70%.

@@            Coverage Diff             @@
##             main    #4821      +/-   ##
==========================================
+ Coverage   41.41%   41.45%   +0.03%     
==========================================
  Files         204      204              
  Lines       17948    18002      +54     
==========================================
+ Hits         7434     7463      +29     
- Misses       9970     9993      +23     
- Partials      544      546       +2     
Impacted Files Coverage Δ
pkg/controller/pod_volume_restore_controller.go 23.34% <0.00%> (-0.53%) ⬇️
pkg/restic/exec_commands.go 15.38% <0.00%> (-0.81%) ⬇️
pkg/controller/pod_volume_backup_controller.go 44.68% <47.05%> (-0.07%) ⬇️
pkg/restic/repository_manager.go 8.12% <56.52%> (+8.12%) ⬆️
pkg/restic/command_factory.go 93.50% <100.00%> (+0.08%) ⬆️
pkg/restore/restore.go 66.63% <0.00%> (+0.64%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 65db258...e4881b7. Read the comment docs.

@blackpiglet blackpiglet force-pushed the 4820-add-skip-tls-verify-for-restic branch 5 times, most recently from 6612366 to 8a9c004 Compare April 13, 2022 07:47
1. Add --insecure-tls in PodVolumeBackup and PodVolumeRestore controller.
2. Change --last flag in Restic command to --latest=1 due to Restic version update.

Signed-off-by: Xun Jiang <jxun@vmware.com>
@blackpiglet blackpiglet force-pushed the 4820-add-skip-tls-verify-for-restic branch from 8a9c004 to e52f042 Compare April 13, 2022 13:00
@blackpiglet blackpiglet marked this pull request as ready for review April 13, 2022 13:11
…eck code.

Signed-off-by: Xun Jiang <jxun@vmware.com>
@blackpiglet
Copy link
Contributor Author

blackpiglet commented Apr 14, 2022

Test done for this modification:

Setup MinIO with TLS:

1. Install certgen, then add certgen into PATH: 
go install[ github.com/minio/certgen](http://github.com/minio/certgen)
2. Generate key and cert: 
certgen -ca -host "127.0.0.1,minio.velero.svc,minio.minio.svc"
3. Create TLS needed secret from generated key and cert: 
kubectl create ns minio; kubectl -n minio create secret generic tls-ssl-minio --from-file=./private.key --from-file=./public.crt
4. Install MinIO with TLS enabled by helm chart: 
helm repo add minio https://charts.min.io/; helm install minio -n minio --set tls.enabled=true,tls.certSecret=tls-ssl-minio,replicas=1,persistence.enabled=true,resources.requests.memory=1Gi,mode=standalone,rootUser=minio,rootPassword=minio123 minio/minio
5. Setup up MinIO host and add bucket:
kubectl apply -f https://github.com/raw/blackpiglet/public_files/main/minio-setup.yaml

Install Velero with the MinIO and not provide CA to Velero and Restic.

velero install \
  --provider aws \
  --plugins velero/velero-plugin-for-aws:main \
  --image=gcr.io/velero-gcp/velero:test \
  --bucket=velero \
  --use-volume-snapshots=false \
  --backup-location-config region=minio,s3ForcePathStyle="true",s3Url=https://minio.minio.svc:9000,insecureSkipTLSVerify=true \
  --use-restic \
  --secret-file=../../credentials-velero-minio \
  --default-volumes-to-restic

Tests:

  • Create a deployment on K8S cluster with PV
  • Create backup with no error: velero backup create 4821-2 --selector app=redis
  • Check the ResticRepository is created and Status.Phase is ready.
  • Modify ResticRepository's Spec.MaintenanceFrequency to 1m0s, and check the periodically Restic prune command running without error.
  • Create restore with no error: velero restore create --from-backup=4821-2
  • Delete backup with no error: velero backup delete 4821-2

Xun Jiang added 3 commits April 15, 2022 17:46
…n RunRestore

1. remove insecureTLS parameter in function RunRestore
2. add a const for insecureTLS flag
3. add comments on --last replaced with --latest=1

Signed-off-by: Xun Jiang <jxun@vmware.com>
Signed-off-by: Xun Jiang <jxun@vmware.com>
@blackpiglet blackpiglet force-pushed the 4820-add-skip-tls-verify-for-restic branch from a37c7a1 to 3ed0874 Compare April 15, 2022 16:37
@blackpiglet
Copy link
Contributor Author

Met error described here after merge PR #4436 to resolve conflict
#4436 (comment)

After investigation, found this error is triggered by misconfiguration. In my environment, Velero image is updated after merging code, but the PVB's CRD is not updated. I think the 404 error is raised because Velero image's PVB CRD mismatch with PVB CRD in cluster API.
The error is gone when cluster applied the updated PVB.

This reverts commit 3ed0874.

Met PVB not found issue after merging main to resolve conflict. After investigation, that error is triggered by mis-configure, so revert the code.

Signed-off-by: Xun Jiang <jxun@vmware.com>
@blackpiglet blackpiglet force-pushed the 4820-add-skip-tls-verify-for-restic branch from 13d3dcb to e4881b7 Compare April 18, 2022 08:20
@blackpiglet
Copy link
Contributor Author

Mess this branch after git rebase -i. Close this one. Will open another.

@blackpiglet blackpiglet deleted the 4820-add-skip-tls-verify-for-restic branch October 15, 2022 04:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update integrated Restic version and add insecureSkipTLSVerify for Restic CLI
4 participants