Commit Graph

1336 Commits (1ba7b3de4fe4b301e8d503a25e21664717b07c04)

Author SHA1 Message Date
Xun Jiang 8064421e83 Update integrated Restic version and add insecureSkipTLSVerify for Restic CLI
1. Add --insecure-tls for ResticManager's commands.
2. Add --insecure-tls in PodVolumeBackup and PodVolumeRestore controller.
3. Upgrade integrated Restic version to v0.13.1
4. Change --last flag in Restic command to --latest=1 due to Restic version update.

Signed-off-by: Xun Jiang <jxun@vmware.com>
2022-04-18 21:29:33 +08:00
Wenkai Yin(尹文开) 28bc8b7eef Use controller-gen to generate the deep copy methods for objects
As we are refactoring controllers with kubebuilder, use the controller-gen rather than code-generator to generate the deep copy methods for objects

Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
2022-04-18 21:18:00 +08:00
qiuming 65db2585fb
Merge pull request #4822 from yuvalman/patch-1
fix: use the right kind in getRestartableProcess logger
2022-04-15 16:58:46 +08:00
qiuming 9373c8a383
Merge pull request #4818 from blackpiglet/2499-add-metric-for-csi-snapshot
Add CSI VolumeSnapshot related metrics.
2022-04-15 16:55:37 +08:00
Xun Jiang 9aa4e9e860 Update according to comments. Remove csiVolumeSnapshotsStorageTotal related code.
Signed-off-by: Xun Jiang <jxun@vmware.com>
2022-04-15 08:05:56 +00:00
Xun Jiang/Bruce Jiang 22189e8e19
Merge pull request #4436 from codegold79/3454-convert-pod-volume-backup-controller-to-kubebuilder-v3-framework
Convert Pod Volume Backup resource/controller to the Kubebuilder V3 framework
2022-04-15 15:07:09 +08:00
Xun Jiang/Bruce Jiang dcc7b939a4
Merge pull request #4817 from yuvalman/deleteEmptyBackup
fix: delete empty backups
2022-04-15 14:32:44 +08:00
Wenkai Yin(尹文开) 8ddbe5120e
Merge pull request #4831 from qiuming-best/fix-ttl
Fix default-backup-ttl not work
2022-04-15 14:30:37 +08:00
Xun Jiang/Bruce Jiang c115a37b27
Merge pull request #4797 from blackpiglet/4758-avoid-duplicate-snapshot-for-csi
Avoid duplicated snapshotting, when CSI is enabled
2022-04-14 19:49:34 +08:00
Ming c17172f4ef Fix default-backup-ttl not work
Signed-off-by: Ming <mqiu@vmware.com>
2022-04-14 15:11:44 +08:00
I538157 74db20993b fix: delete empty backups
Signed-off-by: Yuval Manor <yuvalman958@gmail.com>
2022-04-12 13:13:56 +03:00
yuvalman 4d0005640d fix: use the right kind in getRestartableProcess logger
Signed-off-by: Yuval Manor <yuvalman958@gmail.com>
2022-04-11 16:46:18 +03:00
Xun Jiang 4daeec7ab9 Update CRD and GRPC.
Signed-off-by: Xun Jiang <jxun@vmware.com>
2022-04-09 12:35:09 +00:00
Xun Jiang 368a1ddf3c Add CSI VolumeSnapshot related metrics.
Signed-off-by: Xun Jiang <jxun@vmware.com>
2022-04-09 00:57:28 +08:00
Xun Jiang 5c74aa22e6 Avoid duplicated snapshotting, when CSI is enabled
Fix #4758

Do not take snapshot for PV to avoid duplicated snapshotting, when CSI feature is enabled.

Signed-off-by: Xun Jiang <jxun@vmware.com>
2022-04-07 23:32:48 +08:00
Wenkai Yin(尹文开) 016ac129c6 Refactor schedule controller with kubebuilder
Refactor schedule controller with kubebuilder

fixes #4671

Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
2022-04-07 17:32:52 +08:00
Daniel Jiang 7c40949992
Merge pull request #4800 from reasonerjt/bump-up-csi-to-v1
Bump up to v1 API for CSI snapshot
2022-04-01 13:46:00 +08:00
Daniel Jiang 04f59ce003 Bump up to v1 API for CSI snapshot
Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2022-03-31 22:55:03 +08:00
half-life666 e24c8845c4 Skip podvolumerestore creation when restore excludes pv/pvc
Signed-off-by: half-life666 <half-life@jibudata.com>
2022-03-31 09:27:33 +08:00
Wenkai Yin(尹文开) 0b8f19e4d4
Merge pull request #4779 from reasonerjt/fix-restore-hook
Ensure the restore hook applied to new namespace based on the mapping
2022-03-29 14:07:08 +08:00
Daniel Jiang 2939914113 Ensure the restore hook applied to new namespace based on the mapping
fixes #4720

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2022-03-28 10:24:47 +08:00
Scott Seago 8e4f88db68
Merge pull request #4295 from mercedes-benz/tobiasgiese/items-metrics
Add metrics backup_items_total and backup_items_errors
2022-03-25 16:40:43 -04:00
Tiger Kaovilai d1fdaecc94
Add labels to expired backups failing garbage collection. (#4757)
* Add bsl related TTL gc errors to labelSelectors
* if backup label map is nil, make map
* clear label if not BSL error

Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com>
2022-03-25 17:01:55 +08:00
Tobias Giese 1b8da68fc2 metrics: add items gauges
Signed-off-by: Tobias Giese <tobias.giese@daimler.com>
2022-03-22 18:36:55 +01:00
rick bd17d32885
Fix the golang lint error: Variable 'session' collides with imported package name
Signed-off-by: rick <1450685+LinuxSuRen@users.noreply.github.com>
2022-03-22 21:44:43 +08:00
Xun Jiang/Bruce Jiang 9df0394359
Merge pull request #4740 from phuongatemc/add-priorityclass-to-podaction-plugin
Add priorityclass to podaction plugin
2022-03-22 19:43:04 +08:00
Hoang, Phuong 0171a91366 Correct copyright comment and string compare
Signed-off-by: Hoang, Phuong <phuong.n.hoang@dell.com>
2022-03-21 12:01:26 -04:00
Scott Seago 09ec3ba994
Insert all restore errors and warnings into restore log (#4743)
This allows a user inspecting the restore logs to see any
errors or warnings generated by the restore so that they
will be seen even without having to use the describe cli.

Signed-off-by: Scott Seago <sseago@redhat.com>
2022-03-21 14:29:03 +08:00
Hoang, Phuong b8b5427388 Fix format.
Signed-off-by: Hoang, Phuong <phuong.n.hoang@dell.com>
2022-03-15 19:54:24 -04:00
Hoang, Phuong e9d5f7121c Add unit tests, change copyright years and revert unrelated changes.
Signed-off-by: Hoang, Phuong <phuong.n.hoang@dell.com>
2022-03-15 19:51:53 -04:00
Hoang, Phuong 0741360050 Adding PriorityClass to backup podAction and restore podAction.
Signed-off-by: Hoang, Phuong <phuong.n.hoang@dell.com>
2022-03-15 19:05:13 -04:00
Wenkai Yin(尹文开) 208d250ddc
Merge pull request #4719 from ywk253100/220225_bsl
Update BSL CR as long as there is any error
2022-03-08 16:40:24 +08:00
Wenkai Yin(尹文开) bcc9aa8d69 Update BSL CR as long as there is any error
1. Mark the BSL as "Unavailable" when gets any error
2. Add a new field "Message" to the BSL status to record the error message

Fixes #4485
Fixes #4405

Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
2022-03-07 10:25:18 +08:00
qiuming b0cd90253b
Merge pull request #4661 from blackpiglet/4499-hook-podexec-container
[fix] Avoid overwritten hook's exec.container parameter when running …
2022-03-01 15:39:54 +08:00
Xun Jiang 0503b2675f Modify according to comments.
Change hook.Container's value in test case to ""

Signed-off-by: Xun Jiang <jxun@vmware.com>
2022-02-28 19:28:17 +08:00
Wenkai Yin(尹文开) 4a50306a0e
Merge pull request #4697 from j4m3s-s/fix-labels
Fix labels removed in ObjectMeta
2022-02-28 14:05:02 +08:00
Wenkai Yin(尹文开) 8aaeed4411
Merge pull request #4686 from reasonerjt/fix-4080
Bypass the remap CRD version plugin when v1beta1 CRD is not supported
2022-02-28 10:57:52 +08:00
Daniel Jiang 1cf61dd1aa
Merge pull request #4084 from MatthieuFin/main
Add full support for setting securityContext for restic restore
2022-02-24 20:18:09 +08:00
MatthieuFin a57298254f Fix typo on tests fields name and add another test with gesture of errors wanted on equals
Signed-off-by: MatthieuFin <matthieu2717@gmail.com>
2022-02-24 12:09:04 +01:00
James Landrein cb11bf1924 Fix labels removed in ObjectMeta
Signed-off-by: James Landrein <github@j4m3s.eu>
2022-02-24 10:25:49 +01:00
James Landrein 77be862b9c
Add support for --pod-labels (#4694)
* Add support for --pod-labels
* Add changelog

Signed-off-by: James Landrein <github@j4m3s.eu>
2022-02-24 17:00:14 +08:00
Daniel Jiang ea38f84c53
Merge pull request #4660 from blackpiglet/update-onwer-references-in-backup-descrip
Update --use-owner-references-in-backup description in velero command…
2022-02-24 15:47:34 +08:00
qiuming 17043cd5cd
Merge pull request #4518 from ywk253100/220112_restic_prune
Fix bug to make the restic prune frequency configurable
2022-02-24 14:20:34 +08:00
MatthieuFin f6bdfd09c5 Merge remote-tracking branch 'upstream/main'
Signed-off-by: MatthieuFin <matthieu2717@gmail.com>
2022-02-23 15:03:15 +01:00
Daniel Jiang 0070138c62 Bypass the remap CRD version plugin when v1beta1 CRD is not supported
When velero is running on clusters that don't support v1beta1 CRD, the
plugin will not try to backup v1beta1 CRD.
The plugin should be kept for backward compatibility.  It will be
removed when velero drop the support for k8s v1.21

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2022-02-22 18:59:47 +08:00
Xun Jiang 4c8d1c2693 Modify according to comments
1. rename zoneSeparator to gkeZoneSeparator
2. add example of regional PV's node affinity. modify test case description.

Signed-off-by: Xun Jiang <jxun@vmware.com>
2022-02-22 16:23:10 +08:00
Xun Jiang 8c2a07b906 Update --use-owner-references-in-backup description in velero command line
Specify the risk of this parameter set to true. Add the issue first reported about this topic which includeds the google document illustrates about it.

Signed-off-by: Xun Jiang <jxun@vmware.com>
2022-02-21 22:37:48 +08:00
Xun Jiang 7be12a9220 [fix] Add regional PV support for GKE
fix #4663.
For GKE pv, when create backup, return all zones retrived from node affinity.

Signed-off-by: Xun Jiang <jxun@vmware.com>
2022-02-21 22:04:21 +08:00
Xun Jiang 6d9004dc62 [fix] Avoid overwritten hook's exec.container parameter when running pod command executor
Fix #4499
When hook influnce multiple pods, current logic's first pod's container will overwrite the hook's exec.container parameter. That will cause the other pod fail on the hook executing.

Signed-off-by: Xun Jiang <jxun@vmware.com>
2022-02-17 15:24:56 +08:00
bynare 768a30618f
restic backupper: ignore volumes of non-running pods (#4584) 2022-02-16 05:34:58 +08:00
F. Gold 491942cf2d
Simplify by assuming nil is false and use boolptr util function
Signed-off-by: F. Gold <fgold@vmware.com>
2022-02-09 16:58:07 -08:00
F. Gold 95c43d5b65
Minor change to trigger GitHub actions
Signed-off-by: F. Gold <fgold@vmware.com>
2022-02-02 17:02:22 -08:00
F. Gold 131c6de407
Check for nil before logging DefaultVolumestToRestic value
Signed-off-by: F. Gold <fgold@vmware.com>
2022-02-02 10:53:03 -08:00
Dominic Brekau 5fa7d08fa1
Use OrderedResources in schedules (#4550)
* Use OrderedResources in schedules
Make ParseOrderedResources public for use in schedules
Add changelog

Signed-off-by: Dominic <dominic@xdnx.org>

* Rename function in comment section

Signed-off-by: Dominic <dominic@xdnx.org>
2022-01-29 15:47:55 +08:00
F. Gold a610194aa1
Replace r.Client.Update with patch helper
Signed-off-by: F. Gold <fgold@vmware.com>
2022-01-28 15:31:05 -08:00
F. Gold 2dd85c9c42
Convert PodVolumeBackup to Kubebuilder framework
Signed-off-by: F. Gold <fgold@vmware.com>
2022-01-26 20:09:24 -08:00
Daniel Jiang 2cbb881285
Merge pull request #4497 from dkeven/filterunmountedvol
Fix: skip not mounted volumes when backing up
2022-01-24 14:40:18 +08:00
dkeven 1e44edce67 Fix: skip not mounted volumes when backing up
Signed-off-by: dkeven <keven@kubesphere.io>
2022-01-18 17:53:01 +08:00
Wenkai Yin(尹文开) fcad46ccdf Check whether the volume is provisioned by CSI driver or not by the annotation as well
Check whether the volume is provisioned by CSI driver or not by the annotation as well

Fixes #4496

Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
2022-01-12 19:05:33 +08:00
Xun Jiang/Bruce Jiang 947f85790f
Merge pull request #4514 from ywk253100/2220110_nodeport
Check the existence of the expected service when ignoring the NodePort already allocated error
2022-01-12 15:25:42 +08:00
Wenkai Yin(尹文开) fb2722ffe5 Fix bug to make the restic prune frequency configurable
We introduces the installation option "--default-restic-prune-frequency" to make restic prune frequency configuration in the previous release, but there is a bug that make the option don't take effect. This commit fixes the bug by removing the evaluation part. The restic repository controller will take care the prune frequency for the repository

Fixes #3062

Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
2022-01-12 15:18:24 +08:00
Wenkai Yin(尹文开) 62779bbcc6 Check the existence of the expected service when ignoring the NodePort already allocated error
Check the existence of the expected service when ignoring the NodePort already allocated error

Fixes 2308

Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
2022-01-12 15:06:42 +08:00
Wenkai Yin(尹文开) 6c1f16a735 Initialize the labels field of `velero backup-location create` option
Initialize the labels field of `velero backup-location create` option to avoid #4484

Fixes #4484

Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
2022-01-06 10:35:39 +08:00
Daniel Jiang 7c2dc143d5
Merge pull request #4391 from ywk253100/211123_anno
Keep the annotation "pv.kubernetes.io/provisioned-by" when restoring PVs
2021-12-21 11:08:25 +08:00
Wenkai Yin(尹文开) 648f3ac228 Keep the annotation "pv.kubernetes.io/provisioned-by" when restoring PVs
More details please refer to https://github.com/vmware-tanzu/velero/issues/3470#issuecomment-976279606

Fixes #3470

Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
2021-12-21 09:52:56 +08:00
Wenkai Yin(尹文开) c7cd95a374
Ignore the provided port is already allocated error when restoring the LoadBalancer service (#4462)
Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
2021-12-21 05:42:27 +08:00
Daniel Jiang d7aa82d8ed
Return the error when getting backup store in backup deletion controller (#4465)
Per discussion in
https://github.com/vmware-tanzu/velero/issues/4260#issuecomment-947721686
https://github.com/vmware-tanzu/velero/issues/4260#issuecomment-951347384

return the error to avoid a panic when downloading the backup tarball

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2021-12-21 05:38:13 +08:00
Xun Jiang 7ab4bfc632 Revert "Migrate backup sync controller from code-generator to kubebuilder (#4423)"
This reverts commit 5aaeb3ebbe.
2021-12-17 09:40:24 +08:00
Box-Cube 69f6c8d0cd
Fix statefulsets volumeClaimTemplates storageClassName after use Changing PV/PVC Storage Classes (#4375)
* fix statefulsets volumeClaimTemplates storageClassName after use Changing PV/PVC Storage Classes

Signed-off-by: Box-Cube <64300761+Box-Cube@users.noreply.github.com>

* Fix (vmware-tanzu#4373)

Signed-off-by: Box-Cube <64300761+Box-Cube@users.noreply.github.com>

* Fix StatefulSet volumeClaimTemplates storageClassName(vmware-tanzu#4373)

Signed-off-by: Box-Cube <64300761+Box-Cube@users.noreply.github.com>

* Fix StatefulSet volumeClaimTemplates storageClassName(vmware-tanzu#4373)

Signed-off-by: Box-Cube <64300761+Box-Cube@users.noreply.github.com>

* Fix StatefulSet volumeClaimTemplates storageClassName(vmware-tanzu#4373)

Signed-off-by: Box-Cube <64300761+Box-Cube@users.noreply.github.com>

* Change the isStorageClassExist logic

Signed-off-by: Box-Cube <64300761+Box-Cube@users.noreply.github.com>

* Fix StatefulSet volumeClaimTemplates storageClassName(vmware-tanzu#4373)

Signed-off-by: Box-Cube <64300761+Box-Cube@users.noreply.github.com>
2021-12-16 14:50:56 +08:00
Xun Jiang/Bruce Jiang 5aaeb3ebbe
Migrate backup sync controller from code-generator to kubebuilder (#4423)
* Migrate backup sync controller from code-generator to kubebuilder

1. use kubebuilder's reconcile logic to replace controller's old logic.
2. use ginkgo and gomega to replace testing.

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

* Fix: modify code according to comments

1. Remove DefaultBackupLocation
2. Remove unneccessary comment line
3. Add syncPeriod default value setting logic
4. Modify ListBackupStorageLocations function's context parameter
5. Add RequeueAfter parameter in Reconcile function return value

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

* Reconcile function use context passed from parameter

1. Use context passed from parameter, instead of using Reconciler struct's context.
2. Delete Reconciler struct's context member.
3. Modify test case accordingly.

Signed-off-by: Xun Jiang <jxun@vmware.com>
2021-12-14 20:07:20 -05:00
Frangipani Gold d3c7ef09cb
Remove backups and restic repos associated with deleted BSL(s) (#4377)
* Remove backups and restic repos associated with deleted BSL(s)

Signed-off-by: F. Gold <fgold@vmware.com>

* add changelog

Signed-off-by: F. Gold <fgold@vmware.com>

* Add PR number to changelog

Signed-off-by: F. Gold <fgold@vmware.com>

* Fix typo

Signed-off-by: F. Gold <fgold@vmware.com>

* Only delete backups and restic repos and report success when without errors

Signed-off-by: F. Gold <fgold@vmware.com>
2021-12-13 16:09:24 -08:00
David L. Smith-Uchida a1b48ceac5
Adds <backup-name>-itemsnapshots.gz file to backup (when provided). (#4429)
* Adds <backup-name>-itemsnapshots.gz file to backup (when provided).  Also
adds DownloadTargetKindBackupItemSnapshots type to allow downloading.
Updated object store unit test

Fixes #3758

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* Removed redundant checks

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>
2021-12-13 14:47:50 -05:00
Xun Jiang 706d142096 fix: remove --crds-version in velero install command
Due to only v1 CRD is supported in velero version 1.8, remove CRDs version choosing option.

Signed-off-by: Xun Jiang <jxun@vmware.com>
2021-12-13 21:02:56 +08:00
David L. Smith-Uchida 5677e04bb1
Consolidated code for resolving actions and plugins into ActionResolver (#4410)
* Consolidated code for resolving actions and plugins into ActionResolver.  Added BackupWithResolvers and
RestoreWithResolvers.  Introduces ItemSnapshooterResolver to bring ItemSnapshotter plugins into backup and
restore.  ItemSnapshotters are not used yet.

Added action_resolver_test

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>

* Addressed review comments

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>
2021-12-10 12:53:47 -05:00
Wenkai Yin(尹文开) 769af3f7b8
Merge pull request #4416 from dsu-igeek/dsu-upload-progress-feature-flag-12-01-2021
Added UploadProgressFeature flag to enable UploadProgressMonitoring
2021-12-08 09:33:36 +08:00
Dave Smith-Uchida d0e660f435 Added UploadProgressFeature flag to enable UploadProgressMonitoring and ItemSnapshotters
Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>
2021-12-07 00:06:36 -08:00
Scott Seago d9f8abcd27
Merge pull request #4431 from reasonerjt/bump-up-go-1.17
Bump up Go to 1.17
2021-12-06 11:48:16 -05:00
Daniel Jiang a3d196ee85 Bump up Go to 1.17
Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2021-12-06 20:16:24 +08:00
David L. Smith-Uchida 91ea996aaa
Added ItemSnapshotter to the plugin server framework. (#4417)
Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>
2021-12-02 14:01:40 -05:00
Daniel Jiang 2a7d4cec6e Add restoreactionitem plugin to handle admission webhook configurations
This commit adds a restore action item plugin to reset invalid value
of "sideEffects" in resource of mutatingwebhookconfiguration and
validating webhookconfiguration.

To fix the problem the "sideEffects" is illegal for resource migrated
from v1beta1.

fixes #3516

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2021-12-01 00:48:06 +08:00
Daniel Jiang 02013ef335
Merge pull request #4382 from blackpiglet/4369-bsl-from-kubebuilder-v2-to-v3
feat: migrate velero controller from kubebuilder v2 to v3
2021-11-24 09:35:39 +08:00
Xun Jiang 303d3dcad3 feat: migrate kubebuilder from v2 to v3
1. remove config/crd/v1beta1
2. remove PROJECT file
3. update controller-gen and kubebuilder version
4. generate client and CRD file
5. add changelog and remove v1beta1 CRD generated code.
6. add kubebuilder test bundle setup command.
7. due to apiextensions.k8s.io/v1beta1 is not supported, only k8s after v1.16 is supported, so remove v1.15 check.
8. add CRD and k8s suppored version update in changelog.

Signed-off-by: Xun Jiang <jxun@vmware.com>
2021-11-23 19:32:19 +08:00
Daniel Jiang 48d185985a
Update issue template to reference velero debug (#4384)
Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2021-11-22 12:01:24 -05:00
Daniel Jiang 748cf86aa7 Add the key for GKE zone for AZ collection
Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2021-11-20 15:58:31 +08:00
Wenkai Yin(尹文开) 11abff4e8d
Merge pull request #4341 from blackpiglet/3737-add-logger-for-crd-manager
Fix: add init log option for velero controller-runtime manager.
2021-11-18 13:56:14 +08:00
Xun Jiang/Bruce Jiang fc29294552
fix: modify generated from schedule's backup name timestamp to UTC ti… (#4353)
* fix: modify generated from schedule's backup name timestamp to UTC timezone

fix #4279
When backup is created from schedule, and the backup name is not specified, a containing-timestamp generated name will be used. Due to velero client not set timezone to UTC, a local timezone will be used for the generated name.

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

* fix: modify generated from schedule's backup name timestamp to UTC timezone

fix #4279
When backup is created from schedule, and the backup name is not specified, a containing-timestamp generated name will be used. Due to velero client not set timezone to UTC, a local timezone will be used for the generated name.

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

* fix: modify generated from schedule's backup name timestamp to UTC timezone

fix #4279
When backup is created from schedule, and the backup name is not specified, a containing-timestamp generated name will be used. Due to velero client not set timezone to UTC, a local timezone will be used for the generated name.

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

* modify changelog description

Reword the changelog description according to comments.

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

Co-authored-by: jxun <jxun@jxun-a01.vmware.com>
Co-authored-by: Xun Jiang <jxun@vmware.com>
2021-11-17 09:26:49 -05:00
Xun Jiang 2c240c2830 Use logrusr instead of zap.
logrusr is a open source convertor, which can convert logrus logger into logr.
By using logrusr, velero can use exsiting formatted logrus logger, other than introducing zap as a new logger.

Signed-off-by: Xun Jiang <jxun@vmware.com>
2021-11-17 18:10:37 +08:00
David L. Smith-Uchida 5150ce4891
ItemSnapshotter plugin APIs. Addresses #3753 (#4077)
Added ItemSnapshotter.proto
Added item_snapshotter Go interface
Added framework components for item_snapshotter
Updated plugins doc with ItemSnapshotter info
Added SnapshotPhase to item_snapshotter.go
ProgressOutputOutput now includes a phase as well as an error string for problems that occured

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>
2021-11-16 16:13:31 -05:00
Scott Seago 3aa204a30d
Merge pull request #4350 from reasonerjt/read-pv-az-new
Read Availability zone from nodeAffinity requirements
2021-11-16 08:43:27 -05:00
Daniel Jiang 5878a52843 Read Availability zone from nodeAffinity requirements
Velero to read the AZ info from `NodeAffinity` of a PV when it's taking
the snapshot.

Fixes #4332

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2021-11-16 09:44:12 +08:00
Bruce 71d482360f
Use factory.Namespace() to replace hardcoded velero namespace (#4346)
* Use factory.Namespace() to replace hardcoded velero namespace

Signed-off-by: half-life666 <half-life@jibudata.com>

* Add change log for pr 4346

Signed-off-by: half-life666 <half-life@jibudata.com>
2021-11-15 20:36:29 -05:00
Wenkai Yin(尹文开) 7c4e03e9f9
Ignore the `provided port is already allocated` error when restoring the `NodePort` service (#4336)
Fixes #2308

Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
2021-11-15 20:25:04 +08:00
Daniel Jiang 130602d723
Return the error if velero failed to detect S3 region for restic repo (#4343)
The error should be returned explicitly, because when the default URL is
used S3 will return a 301 and the response can't be handled by restic.

Fixes #4178

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2021-11-15 20:20:27 +08:00
jxun 4a1943f6c9 Fix: add init log option for velero controller-runtime manager.
fix for issue #3737
add log option for velero controller-runtime manager to log return error in reconcile loop.

Signed-off-by: Xun Jiang jxun@vmware.com
Signed-off-by: jxun <jxun@jxun-a01.vmware.com>
2021-11-15 14:07:27 +08:00
Scott Seago 983489073f
PV remapClaimRefNS was being skipped when there was no snapshot (#3708)
Signed-off-by: Scott Seago <sseago@redhat.com>
2021-11-09 20:30:16 -05:00
Bridget McErlean e4019f26c1
Only set BSL credential field if provided (#4322)
Previously, the BSL credential field would always be set when using the
`create` command, even if no credential details were provided. This
would result in an empty `SecretKeySelector` in the BSL which would
cause operations using this BSL to fail as Velero would attempt to fetch
a `Secret` with an empty name from the K8s API server.

With this change, the `Credential` field is only set if credential
details have been specified. This change also includes some refactoring
to allow the change to be tested.

Signed-off-by: Bridget McErlean <bmcerlean@vmware.com>
2021-11-09 17:04:58 -08:00
Wenkai Yin(尹文开) 6801ddc9ac
Merge pull request #4306 from alaypatel07/fix-paging
fix buggy pager func
2021-11-10 07:53:58 +08:00
Alay Patel b2fe7fe304 - fix buggy pager func
fix paging items in to use list options passed by the paging function

The client-go pager sets the Limit options for the list call
to paginate the request[1]. This PR fixes the paging function
to use the options passed by the pager instead of shadowed options
This is required for the pagination to work correctly.

- simplify the pager list implementation by using pager.List()
The List() function already implements a lot of the logic that was
needed for paging here, using it simplifies the code.

1. 3f40906dd8/staging/src/k8s.io/client-go/tools/pager/pager.go (L219)

Signed-off-by: Alay Patel <alay1431@gmail.com>
2021-11-09 10:34:26 -05:00
Daniel Jiang 9f54451e58
Merge pull request #4250 from codegold79/4235-regression-unable-to-use-wildcards-in-exclude-namespaces
Namespace validation now allows asterisks used in namespace includes/excludes
2021-11-04 11:54:48 +08:00
Scott Seago 550efddd88
Verify group before treating resource as cohabitating (#4126)
Signed-off-by: Scott Seago <sseago@redhat.com>
2021-11-03 18:11:32 -04:00
Wenkai Yin(尹文开) 9f0ea22c60
Fix CVE-2020-29652 and CVE-2020-26160 (#4274)
Bump up restic to v0.12.1 to fix CVE-2020-26160.
Bump up module "github.com/vmware-tanzu/crash-diagnostics" to v0.3.7 to fix CVE-2020-29652.
The "github.com/vmware-tanzu/crash-diagnostics" updates client-go to v0.22.2 which introduces several break changes, this commit updates the related codes as well

Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
2021-11-03 13:30:26 -07:00
F. Gold 51307130a2
Validation allows empty string namespace
Signed-off-by: F. Gold <fgold@vmware.com>
2021-10-28 15:37:00 -07:00
Wenkai Yin(尹文开) 163e96b62d
Don't create a backup immediately after creating a schedule (#4281)
Don't create a backup immediately after creating a schedule
Fixes #1980

Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
2021-10-26 16:31:58 -07:00
F. Gold 9f06a1b451
Limit kubebuilder controllers to work only for objects in own namespaces
Signed-off-by: F. Gold <fgold@vmware.com>
2021-10-18 17:31:28 -07:00
F. Gold 54fa63939a
Namespace validation now allows asterisks
Signed-off-by: F. Gold <fgold@vmware.com>
2021-10-18 16:45:23 -07:00
Daniel Jiang 9b7f2da192
run backup/restore describe in debug subcommand (#4161)
The errors of restore/backup may be stored in object storage
The well formatted output of describe is also helpful for debugging.
This commit add the command to the crashd script so the output of
"velero backup/restore describe xxx" can be collected

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2021-09-21 08:16:31 -04:00
codegold79 fbd6bcf504
Validate namespace in velero backup create command (#4057)
* Add namespace validation in the client

Signed-off-by: F. Gold <fgold@vmware.com>

* Add namespace validation in the backup controller

Signed-off-by: F. Gold <fgold@vmware.com>

* Add changelog for PR 4057

Signed-off-by: F. Gold <fgold@vmware.com>

* Update Copyright notice

Signed-off-by: F. Gold <fgold@vmware.com>

* Update include_excludes_test.go to follow Go standards and be easier to read

Signed-off-by: F. Gold <fgold@vmware.com>

* Add unit tests for namespace validation functions

Signed-off-by: F. Gold <fgold@vmware.com>

* Make changes per review comments

- use one set of namespace validation logic instead of writing two
- remove duplicate namespace validation functions and tests
- add namespace validation tests in includes_excludes_test.go

Signed-off-by: F. Gold <fgold@vmware.com>

* Return all ns validation err msgs as error list

Signed-off-by: F. Gold <fgold@vmware.com>

* Make error message more clear

Signed-off-by: F. Gold <fgold@vmware.com>
2021-09-03 11:03:35 -04:00
Wenkai Yin(尹文开) 305dfa0d3c
Empty the "ClusterIPs" along with "ClusterIP" when "ClusterIP" isn't "None" (#4101)
More details please refer to #4098

Fixes #4098

Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
2021-09-03 10:33:50 -04:00
Daniel Jiang 240b4e666f
Merge pull request #4026 from sseago/service-action-unnamed-nodeport
Distinguish between different unnamed node ports when preserving
2021-09-03 20:36:58 +08:00
Daniel Jiang 9d76ea835c pass velero cli executable to crashd
This commit fixes the issue when velero CLI is not in `PATH` or compiled
to other file names.

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2021-09-02 20:02:33 +08:00
Bridget McErlean edeec848d3
Skip restic backup/restore of DownwardAPI volumes (#4076)
Velero was including DownwardAPI volumes when backing up with restic.
When restoring these volumes, it triggered a known issue with restic (as
seen in #3863). Like projected volumes, these volumes should be skipped
as their contents are populated by the Kubernetes API server.

With this change, we are now skipping the restic backup of volumes with
a DownwardAPI source. We are also skipping the restore of any volume
that had a DownwardAPI source as there will exist backups that were
taken prior to this fix being introduced. This will allow these backups
to be restored succesfully.

Signed-off-by: Bridget McErlean <bmcerlean@vmware.com>
2021-09-01 13:51:44 +08:00
Daniel Jiang 746cd616fd
remove IsUnstructuredCRDReady (#4085)
This commit removes `IsUnstructuredCRDReady` since
kubernetes/kubernetes#87675 is fixed.
Is uses `Is1CRDReady` to check the readiness of CRD.

After v1.7 we may consider merge the funcx `IsV1Beta1CRDReady` and
`IsV1CRDReady`

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2021-09-01 13:38:17 +08:00
Wenkai Yin(尹文开) 8d57215ded
Several fixes to improve the stability of E2E testing (#4056)
1. Support to customize the restic restore helper image
2. Use a seperated context when doing the clean up works
3. Wait a while before doing the the restore for aws to avoid #1799

Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
2021-08-31 12:50:38 -04:00
MatthieuFin 08e4138c16 Fix lint issue and test failed
Signed-off-by: MatthieuFin <matthieu2717@gmail.com>
2021-08-31 17:43:09 +02:00
MatthieuFin effa09a42f Add full support for setting securityContext for restic restore container
Signed-off-by: MatthieuFin <matthieu2717@gmail.com>
2021-08-31 17:03:25 +02:00
Daniel Jiang 7c75cd6cf8
Implement `velero debug` (#4022)
This PR added a subcommand `velero debug`, which leverages `crashd` to
collect logs and specs of velero server components and bundle them in a
tarball.

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2021-08-30 18:37:18 -07:00
Dharma Bellamkonda dc1f17944e
Page list requests by default (#3823)
Signed-off-by: Dharma Bellamkonda <bellamko@adobe.com>
2021-08-17 18:49:41 -07:00
Wenkai Yin(尹文开) 31a8e5080c
Wait the namespace deletion completed before removing the CRDs (#4007)
Wait the namespace deletion completed before removing the CRDs when uninstalling the velero

Fixes #3974

Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
2021-08-17 08:55:22 -07:00
David L. Smith-Uchida 823bee7761
Changed format of download request name to use a random UUID rather than (#4034)
a timestamp.  If two requests were happening very close together for the
same backup, the second would fail randomly.

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>
2021-08-16 07:46:07 -04:00
Bridget McErlean 368098b727 Use LabelSelector in Action ResourceSelector
Instead of converting the unstructured item to check for the presence of
the `kube-aggregator.kubernetes.io/automanaged` label, use this label in
the `AppliesTo` to enable the restore logic to select the item. This
means that any item that matches the selector will have restore skipped.

Also add a new test case to the restore action test to check that label
selectors are applied correctly.

Signed-off-by: Bridget McErlean <bmcerlean@vmware.com>
2021-08-11 17:33:31 -04:00
Bridget McErlean 984176f156 Skip restore of APIServices managed by Kubernetes
It was discovered during Velero 1.6.3 upgrade testing that Velero was
restoring `APIService` objects for APIs that are no longer being served
by Kubernetes 1.22. If these items were restored, it would break the
behaviour of discovery within the cluster.

This change introduces a new RestoreItemAction plugin that skips the
restore of any `APIService` object which is managed by Kubernetes such
as those for built-in APIs or CRDs. The `APIService`s for these will be
created when the Kubernetes API server starts or when new CRDs are
registered. These objects are identified by looking for the
`kube-aggregator.kubernetes.io/automanaged` label.

Signed-off-by: Bridget McErlean <bmcerlean@vmware.com>
2021-08-10 18:22:00 -04:00
Scott Seago 8d714d38ea Distinguish between different unnamed node ports when preserving
Signed-off-by: Scott Seago <sseago@redhat.com>
2021-08-09 16:35:07 -04:00
Bridget McErlean d98c65f69e
Use appropriate CRD API during readiness check (#4015)
* Use appropriate CRD API during readiness check

The readiness check for the Velero CRDs was still using the v1beta1 API.
This would cause the readiness check to fail on 1.22 clusters as the
v1beta1 API is no longer available. Previously, this error would be
ignored and the installation would proceed, however with #4002, we are
no longer ignoring errors from this check.

This change modifies the CRD readiness check to check the CRDs using the
same API version that was used when submitting the CRDs to the cluster.
It also introduces a new CRD builder using the V1 API for testing.

This change also fixes a bug that was identified in the polling code
where if the CRDs were not ready on the first polling iteration, they
would be added again to the list of CRDs to check resulting in
duplicates. This would cause the length check to fail on all subsequent
polls and the timeout would always be reached.

Signed-off-by: Bridget McErlean <bmcerlean@vmware.com>

* Remove duplicate V1 CRD builder and update comment

Signed-off-by: Bridget McErlean <bmcerlean@vmware.com>
2021-08-05 15:17:14 -04:00
Scott Seago 8b47596844
Merge pull request #4002 from alrs/fix-install-err
pkg/install: fix dropped error
2021-08-04 09:17:42 -04:00
Marcel Haupt 7cb614789c
Restic Backup: Add check if Pod is successful or failed for emptyDir.… (#3993)
* Restic Backup: Add check if Pod is successful or failed for emptyDir. Fix #3812
* Add changelog

Signed-off-by: mahaupt <marcel.haupt@gepardec.com>
2021-08-04 12:53:06 +08:00
Lars Lehtonen 20b44db580
pkg/install: fix dropped error
Signed-off-by: Lars Lehtonen <lars.lehtonen@gmail.com>
2021-08-03 16:01:08 -07:00
Wenkai Yin(尹文开) d8141eabce
Select the velero deployment with both label and container name (#3996)
Select the velero deployment with both label and container name

Fixes #3961

Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
2021-07-29 12:01:48 -04:00
David L. Smith-Uchida 5438ff79e3
Updated uninstall to remove both v1beta1 and v1 CRDs if present (#3997) 2021-07-29 22:01:13 +08:00
JenTing Hsiao c3fd4923e8 Change CRDs default API version v1
Signed-off-by: JenTing Hsiao <jenting.hsiao@suse.com>
2021-07-27 17:55:34 -04:00
JenTing Hsiao fca2b5c417 Add new flag --crds-version of default CRD version to generated
If the Velero CLI can't discover the Kubernetes preferred CRD API
version, use the flag --crds-version to determine the CRDs version.

Signed-off-by: JenTing Hsiao <jenting.hsiao@suse.com>
2021-07-27 17:55:34 -04:00
Daniel Jiang bc2484e9ab
Merge pull request #3955 from alrs/fix-restore-err
pkg/restore: fix dropped error
2021-07-25 22:35:41 +08:00
Bridget McErlean 04345af17a Change restic image log messages to info level
Signed-off-by: Bridget McErlean <bmcerlean@vmware.com>
2021-07-15 15:29:49 -04:00
Lars Lehtonen 6eca2201d4
pkg/restore: fix dropped error
Signed-off-by: Lars Lehtonen <lars.lehtonen@gmail.com>
2021-07-14 18:22:02 -07:00
Bridget McErlean 198ea57407 Allow registry to be configured at build time
This adds a new `buildinfo` variable `ImageRegistry` that can set at
build time like the `Version` variable. This allows us to customise the
Velero binary to use different registries.

If the variable is set, this variable wille be used when creating the
URIs for both the main `velero` and `velero-restic-restore-helper`
images. If it is not set, default to using Dockerhub (`velero/velero`,
`velero/velero-restic-restore-helper`).

There are numerous ways in which the Velero binary can be built so all
of them have been updated to add the new link time flag to set the
variable:
* `make local` (used for local developer builds to build for the local
  OS and ARCH)
* `make build` (used by developers and also VMware internal builds to
  build a specific OS and ARCH)
* Goreleaser config (used when creating OSS release binaries)
* Dockerfile (used to build the Velero binary used within the image)

All of these workflows are currently triggered from our Makefile where
the variable `REGISTRY` is already available with the default value of
`velero` and used to build the image tag. Where the new `ImageRegistry`
build variable is needed, we pass through this Makefile variable to
those tasks so it can be used accordingly.

The GitHub action and the `./hack/docker-push.sh` script used to push
container images has not been modified. This will continue to use the
default registry specified in the Makefile and will not explicitly pass
it in.

Signed-off-by: Bridget McErlean <bmcerlean@vmware.com>
2021-07-14 15:42:53 -04:00
Scott Seago ff916b74e9
Merge pull request #3857 from zubron/use-region-in-bsl-for-restic-repo-identifier
Use region in BSL for restic repo identifier
2021-07-13 10:56:20 -04:00
JenTing Hsiao 0754f9a86e
Upgrade Velero ClusterRoleBinding to use v1 API
Signed-off-by: JenTing Hsiao <jenting.hsiao@suse.com>
2021-07-06 17:02:09 +08:00
Scott Seago 962a957f1b
regression introduced in 1.6 restore progress: fix CR restore (#3845)
Signed-off-by: Scott Seago <sseago@redhat.com>
2021-06-19 00:03:11 -07:00
Arush Salil ae6e1df9aa
Add Labels field to BackupSpec (#3641)
* Add metadata.Labels to schedule.Spec.Template and it's copy logic to Backup

Signed-off-by: Arush Salil <me@aru.sh>

* document metadata.labels

Signed-off-by: Klavs Klavsen <klavs@enableit.dk>

* adjust text per suggestion.

Signed-off-by: Klavs Klavsen <klavs@enableit.dk>

* Rewrite labels copy logic, add comments, and debug log messages

Signed-off-by: Arush Salil <me@aru.sh>

* Rephrase label copy debug log

Signed-off-by: Arush Salil <me@aru.sh>

* Add initialized logger to FromSchedule

Signed-off-by: Arush Salil <me@aru.sh>

* use info log level per request.

Signed-off-by: Klavs Klavsen <klavs@enableit.dk>

Co-authored-by: Klavs Klavsen <klavs@enableit.dk>
2021-06-17 11:18:37 -07:00
Bridget McErlean f727e070cb
Skip volume restores from projected sources (#3877)
In #3863, it was discovered that volumes from projected sources were
being backed up by restic when they should have been skipped. Restoring
these volumes triggers a known bug in restic.

In #3866, we started skipping volumes from a projected source, however
there will exist backups that were taken before this fix was introduced.
This change modifies the restore logic to skip the restore of any volume
that came from a projected source, allowing backups taken before #3866
to be restored successfully.

Signed-off-by: Bridget McErlean <bmcerlean@vmware.com>
2021-06-17 11:00:37 -07:00
Alay Patel 57a76b7a6b skip backuping projected volume
Signed-off-by: Alay Patel <alay1431@gmail.com>
2021-06-11 00:11:27 -04:00
Bridget McErlean a95b035bf3 Refactor GetRepoIdentifier tests and add new case
Also refactor the AWS `getRepoPrefix` logic to remove use of `switch`
statement.

Signed-off-by: Bridget McErlean <bmcerlean@vmware.com>
2021-06-09 16:40:45 -04:00
Carlisia Thompson 81f1f21871
Consolidate api clients for e2e tests (#3764)
* Consolidate api clients
* Adress Nolan reviews
* Adding back output warning for consistency
* Remove unnecessary documentation
* Address Bridget's reviews
* Update go.sum files

Signed-off-by: Carlisia <carlisia@grokkingtech.io>
Co-authored-by: Bridget McErlean <bmcerlean@vmware.com>
2021-06-09 22:07:56 +08:00
Kyle William 030104f179
Delete residual file caused by network interruption and so on. Fixes #3204 (#3241)
Signed-off-by: huangkai <huangkai76@huawei.com>
2021-06-02 16:41:50 -04:00
David L. Smith-Uchida 0aa3c263b4
Added BackupPhaseUploading and BackupPhaseUploadingPartialFailure backup (#3805)
phases as part of Upload Progress Monitoring, fixes #3755 Add backup phases
needed for Upload Progress Monitoring

Signed-off-by: Dave Smith-Uchida <dsmithuchida@vmware.com>
2021-06-02 14:25:19 +08:00
Scott Seago 20eb92f9dd
Add PVC UID label to PVR (as we already have for PVB) (#3792)
Signed-off-by: Scott Seago <sseago@redhat.com>
2021-05-20 09:16:06 +08:00
Eric Fried 7566962b95
Support pulling plugins by digest (#3803)
Previously `WithPlugins` only supported passing image URIs "by tag" --
e.g. `gcr.io/my-repo/my-image:v0.1.2`. With this commit, we add support
for pulling "by digest" -- e.g.
`gcr.io/my-repo/my-image@sha256:a75f9e8c3ced3943515f249597be389f8233e1258d289b11184796edceaa7dab`

Signed-off-by: Eric Fried <efried@redhat.com>
2021-05-18 13:27:49 +08:00
Alay Patel 31ced582a9
service_action: use unstructured to marshal selective fields (#3789)
* use unstructured to marshal selective fields

Signed-off-by: Alay Patel <alay1431@gmail.com>

* add a sample test for string port in applied config

Signed-off-by: Alay Patel <alay1431@gmail.com>

* update changelog

Signed-off-by: Alay Patel <alay1431@gmail.com>
2021-05-12 15:40:00 -04:00
Ashish Amarnath fc8569e9f0
⚠️ Remove CSI volumesnapshot artifact deletion (#3734)
This change is incompatible with velero-plugin-for-csi
releases <= v0.1.2

Remove special casing of CSI volumesnapshot artifacts
from backup deletion logic as this has been moved to
a DeleteItemAction plugin in the velero-plugin-for-csi repo

Signed-off-by: Ashish Amarnath <ashisham@vmware.com>
2021-05-04 13:58:41 -04:00
Carlisia Thompson ccac3d4130
A small refactor of the e2e tests (#3726)
* A small refactor of the e2e tests

Signed-off-by: Carlisia <carlisia@grokkingtech.io>

* Add copyright header

Signed-off-by: Carlisia <carlisia@grokkingtech.io>

* Fix CI

Signed-off-by: Carlisia <carlisia@grokkingtech.io>

* Revert unneeded changes

Signed-off-by: Carlisia <carlisia@grokkingtech.io>

* Remove file that doesnt belong here

Signed-off-by: Carlisia <carlisia@grokkingtech.io>
2021-04-28 09:54:17 -07:00
Ashish Amarnath 32c3820b8a
🐛 Fix plugin name derivation from image name (#3711)
* 🐛 Fix plugin name derivation from image name

Signed-off-by: Ashish Amarnath <ashisham@vmware.com>

* changelog

Signed-off-by: Ashish Amarnath <ashisham@vmware.com>
2021-04-21 20:57:00 -04:00