Commit Graph

1573 Commits (18c6cd04001251b5e60c9e45188ebc941c10d521)

Author SHA1 Message Date
Daniel Jiang 78b4914661
Merge pull request #5261 from Abirdcfly/main
chore: remove duplicate word in comments
2022-09-05 14:32:47 +08:00
lyndon 0282e65221
Kopia Pod Volume Backup/Restore (#5259)
* kopia pvbr

Signed-off-by: Lyndon-Li <lyonghui@vmware.com>
2022-09-05 10:29:30 +08:00
qiuming a5a3df193d
Merge pull request #5236 from sseago/no-namespaces-fix
Check for empty ns list before checking nslist[0]
2022-09-05 09:40:19 +08:00
lyndon 5f1bf9eb35
Merge pull request #5214 from qiuming-best/uploader-restic
Uploader Implementation: Restic backup and restore
2022-09-02 11:11:38 +08:00
Ming eb974687a7 merge upstream code
Signed-off-by: Ming <mqiu@vmware.com>
2022-09-02 01:45:12 +00:00
Daniel Jiang 218bab987d
Merge pull request #5239 from shubham-pampattiwar/fix-already-exists
Fix edge cases for already exists resources
2022-08-31 23:01:56 +08:00
Shubham Pampattiwar 94a9a7c795
Merge pull request #4943 from phuongatemc/refactor_plugin_biav1
Refactor BackupItemAction to backupitemaction/v1
2022-08-30 09:48:26 -04:00
Xun Jiang/Bruce Jiang 6fea973c57
Migrate backup sync controller from code-generator to kubebuilder (#5218)
* 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.
3. modify BSL reconciler registration method.

Signed-off-by: Xun Jiang <blackpiglet@gmail.com>

* Add Option for PeriodicalEnqueueSource.

Signed-off-by: Xun Jiang <blackpiglet@gmail.com>

Signed-off-by: Xun Jiang <blackpiglet@gmail.com>
Co-authored-by: Xun Jiang <blackpiglet@gmail.com>
2022-08-30 16:55:39 +08:00
Abirdcfly fab86caa2f
chore: remove duplicate word in comments
Signed-off-by: Abirdcfly <fp544037857@gmail.com>
2022-08-30 16:34:23 +08:00
Xun Jiang/Bruce Jiang 4bc3a3a784
Merge pull request #5248 from allenxu404/gc-freq
equip gc controller with configurable frequency
2022-08-30 11:12:12 +08:00
allenxu404 a8ba4875f0 equip gc controller with configurable frequency
Signed-off-by: allenxu404 <qix2@vmware.com>
2022-08-30 10:13:06 +08:00
qiuming c8818ec1c9
Merge pull request #5241 from blackpiglet/update_enabled_runtime_controllers
Controller refactor code modifications.
2022-08-30 09:30:35 +08:00
Shubham Pampattiwar 93a875873b fix edge cases for already exists resources
Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com>

add changelog file

Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com>

update changelog filename

Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com>

change log level and error type

Signed-off-by: Shubham Pampattiwar <spampatt@redhat.com>
2022-08-29 17:34:02 -04:00
Scott Seago 91ac570d81 some additional debug logs
Signed-off-by: Scott Seago <sseago@redhat.com>
2022-08-29 16:55:14 -04:00
Scott Seago 71648750cc
Merge pull request #5247 from divolgin/storage-class-panic
Don't panic when storageClassName is not set in stateful sets
2022-08-29 10:06:32 -04:00
Xun Jiang/Bruce Jiang eaf9fab711
Merge branch 'main' into update_enabled_runtime_controllers 2022-08-29 20:06:31 +08:00
Ming ed71e65486 Merge branch 'main' of https://github.com/qiuming-best/velero into uploader-restic 2022-08-29 11:33:59 +00:00
Ming f15757a3d8 Uploader Implementation: Restic backup and restore
Signed-off-by: Ming <mqiu@vmware.com>
2022-08-29 09:33:37 +00:00
Wenkai Yin(尹文开) 4a5647a891 Move the code in pkg/restic/common.go to the proper package
Move the code in pkg/restic/common.go to the proper package

Fixes #5243

Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
2022-08-29 10:04:58 +08:00
qiuming 3e30a3d388
Merge pull request #5233 from Lyndon-Li/udmrepo-dev-06
Kopia Integration:Kopia Lib - Implementation
2022-08-28 22:33:12 +08:00
cleverhu e77aaa32ca add CSISnapshotTimeout for describe backup
Signed-off-by: cleverhu <shouping.hu@daocloud.io>
2022-08-28 15:14:03 +08:00
Xun Jiang/Bruce Jiang 86762f442a
Merge pull request #5217 from lilongfeng0902/lilf-branch
check vsc null pointer
2022-08-27 10:45:13 +08:00
Lyndon-Li 3769cd218a kopia lib
Signed-off-by: Lyndon-Li <lyonghui@vmware.com>
2022-08-26 15:25:20 +08:00
Scott Seago 5a5a4c184e Updated plugin/framework server files to cope with protoc changes
Signed-off-by: Scott Seago <sseago@redhat.com>
2022-08-25 21:28:07 -04:00
Scott Seago 4f2c2d2679 updated to newer protoc/protoc-gen-go
Signed-off-by: Scott Seago <sseago@redhat.com>
2022-08-25 21:28:03 -04:00
Hoang, Phuong 2c037b7491 Add missing file
Signed-off-by: Hoang, Phuong <phuong.n.hoang@dell.com>
2022-08-25 17:10:14 -04:00
Hoang, Phuong b54424bdc6 Refactor BackupItemAction to backupitemaction/v1
Signed-off-by: Hoang, Phuong <phuong.n.hoang@dell.com>
2022-08-25 17:10:09 -04:00
divolgin ad4e733ef2 Don't panic when storageClassName is not set in stateful sets
Signed-off-by: divolgin <dmitriy@replicated.com>
2022-08-25 15:02:40 +00:00
Scott Seago 55bf2de15d Check for empty ns list before checking nslist[0]
In determining whether a backup includes all namespaces, item_collector
checks for an empty string in the first element of the ns list. If processing
includes+excludes results in an empty list, treat this as another case
of a not-all-namespaces backup rather than crashing velero.

Signed-off-by: Scott Seago <sseago@redhat.com>
2022-08-24 14:32:19 -04:00
Xun Jiang/Bruce Jiang e8494418d4
Merge pull request #5215 from allenxu404/issue5023
Refactor GC controller with kubebuilder
2022-08-23 15:59:03 +08:00
Xun Jiang 71e5027bfb Controller refactor code modifications.
1. Add some refactored controllers initiation code into enabledRuntimeControllers.
2. Add reconciler struct initiation function for DownloadRequest and ServerStatusRequest controllers.

Signed-off-by: Xun Jiang <blackpiglet@gmail.com>
2022-08-23 10:32:19 +08:00
Ming 2bf054ad0b update upstream codes
Signed-off-by: Ming <mqiu@vmware.com>
2022-08-22 09:20:47 +00:00
Tiger Kaovilai 0bee6dd9fd gh-issue-template: Comment out the subheading description
This stops subheading description from showing in posted issues by default.

Signed-off-by: Tiger Kaovilai <passawit.kaovilai@gmail.com>
Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com>
2022-08-22 02:59:35 -04:00
李龙峰 5cddaeae6c check vsc null pointer
Signed-off-by: 李龙峰 <lilongfeng@inspur.com>
2022-08-22 14:44:17 +08:00
allenxu404 0378020c8d refactor gc controller with kubebuilder
Signed-off-by: allenxu404 <qix2@vmware.com>
2022-08-22 12:16:56 +08:00
Ming 839c2ed98f Merge branch 'main' of https://github.com/qiuming-best/velero into uploader-kopia 2022-08-19 06:40:58 +00:00
Ming 262de19f52 Uploader Implementation: Kopia backup and restore
Signed-off-by: Ming <mqiu@vmware.com>
2022-08-19 06:39:28 +00:00
Lyndon-Li d58abb2477 repo init
Signed-off-by: Lyndon-Li <lyonghui@vmware.com>
2022-08-18 19:45:49 +08:00
lyndon 775943c858
code spell check (#5230)
Signed-off-by: Lyndon-Li <lyonghui@vmware.com>

Signed-off-by: Lyndon-Li <lyonghui@vmware.com>
2022-08-18 18:17:39 +08:00
Wenkai Yin(尹文开) 047c7531fa Refactor the restic repo related code for Kopia integration
Refactor the restic repo related code for Kopia integration

Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
2022-08-17 11:49:53 +08:00
Daniel Jiang 4e25f59dc1
Add parameter "uploader-type" to velero server (#5212)
This commit adds the parameter "uploader-type" to velero server, add exposes the
setting via "velero install" in CLI.

fixes #5062

Signed-off-by: Daniel Jiang <jiangd@vmware.com>

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2022-08-16 13:50:28 +08:00
qiuming 71e4430840
Merge pull request #5179 from Lyndon-Li/udmrepo-dev-02
Kopia Integration: Unified Repository Provider - Implementation
2022-08-16 09:39:40 +08:00
qiuming 36d8d176dd
Merge pull request #5163 from qiuming-best/uploader
kopia uploader integration on shim progress uploader module
2022-08-11 17:38:21 +08:00
Ming 49e151739f Kopia Uploader integration on shim progress uploader
Signed-off-by: Ming <mqiu@vmware.com>
2022-08-10 11:35:24 +00:00
danfengliu a71237cc64
Merge pull request #5124 from danfengliu/add-migration-e2e-test
Add migration E2E test
2022-08-10 13:38:32 +08:00
Lyndon-Li 649c3a77df unified repo provider impl
Signed-off-by: Lyndon-Li <lyonghui@vmware.com>
2022-08-09 20:48:31 +08:00
danfengl fb445b3c0d Add migration E2E test
Signed-off-by: danfengl <danfengl@vmware.com>
2022-08-09 08:31:39 +00:00
Xun Jiang/Bruce Jiang a5f4f8f9fc
Merge branch 'main' into 5048-CSI-snapshot-timeout-configurable 2022-08-08 17:18:44 +08:00
Xun Jiang f8d9cfdb84 Make CSI snapshot creation timeout configurable for backup and schedule.
Signed-off-by: Xun Jiang <jxun@vmware.com>
2022-08-08 17:07:26 +08:00
Xun Jiang/Bruce Jiang 201c43d683
Merge pull request #5178 from allenxu404/i2413
fix issue#2413: treat namespaces with exclude label as excludedNamespaces
2022-08-08 13:35:38 +08:00
allenxu404 e5d828a2a4 modify variables defination and expose err
Signed-off-by: allenxu404 <qix2@vmware.com>
2022-08-08 12:05:08 +08:00
Daniel Jiang ba50458ae2
Merge pull request #5181 from blackpiglet/restic-volume-path-change
Add annotation "pv.kubernetes.io/migrated-to" for CSI checking.
2022-08-08 12:03:47 +08:00
Xun Jiang 7af1e23614 Add annotation "pv.kubernetes.io/migrated-to" for CSI checking.
1. Also checking annotation "pv.kubernetes.io/migrated-to" to find out whether volume is provisioned by CSI.
2. Add UT cases.

Signed-off-by: Xun Jiang <jxun@vmware.com>
2022-08-08 10:59:41 +08:00
Xun Jiang/Bruce Jiang cea5e7f218
Merge pull request #5174 from blackpiglet/reduce-crd-size-new
Reduce CRD size.
2022-08-05 18:46:29 +08:00
Wenkai Yin(尹文开) 092fc01e8d
Splic pkg/restic package (#5143)
This commit splits the pkg/restic package into several packages to support Kopia integration works

Fixes #5055

Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
2022-08-05 17:15:38 +08:00
allenxu404 eb08bdeb62 fix issue#2413 by treating namespaces with exclude label as excludedNamespaces
Signed-off-by: allenxu404 <qix2@vmware.com>
2022-08-04 20:00:11 +08:00
lyndon 088eb9b83c
repo credentials (#5167)
Signed-off-by: Lyndon-Li <lyonghui@vmware.com>
2022-08-04 15:20:02 +08:00
qiuming 701256d296
Merge pull request #5172 from qiuming-best/multi-bsl-fix
Fix restic backups to multiple backup storage locations bug
2022-08-03 14:35:42 +08:00
Xun Jiang e8da5df57a Reduce CRD size.
1. Make the Restore hook.InitConatianer server side field pruing disable.
2. Remove restore patch in update-generate-crd-code.sh.
3. Modify related testcases.
4. Add Container fields validation in Restore Init hook.

Signed-off-by: Xun Jiang <jxun@vmware.com>
2022-08-02 19:45:01 +08:00
Ming 828e28aa43 Fix restic backups to multiple backup storage locations bug
Signed-off-by: Ming <mqiu@vmware.com>
2022-08-02 10:26:23 +00:00
Daniel Jiang 108c81d84c
Skip registering "crd-remap-version" plugin when feature flag (#5165)
"EnableAPIGroupVersions" is set

The crd-remap-version plugin will always backup v1b1 resource for some
CRD. It impacts the feature flag `EnableAPIGroupVersions` which means to
backup all versions, and make migration fail.

In this commit the featureSet was removed from plugin server struct b/c
it blocks the parm `--features` to be populated correctly.  This change
should not have negative impact b/c the attribute in server struct is never used.

Fixes #5146

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2022-08-02 15:47:57 +08:00
Daniel Jiang 2b0d0959da
Merge pull request #5148 from blackpiglet/vsl-refactor
VolumeSnapshotLocation refactor with kubebuilder.
2022-08-01 21:14:18 +08:00
lyndon 52fd18e9db
Kopia Integration Change - Storage Configuration (#5142)
* unified repo storge config

Signed-off-by: Lyndon-Li <lyonghui@vmware.com>

* add UT

Signed-off-by: Lyndon-Li <lyonghui@vmware.com>
2022-07-29 16:06:18 +08:00
qiuming f68ae92fd0
Merge pull request #5145 from blackpiglet/5140-fix-restic-backup-with-customize-CA
Delay CA file deletion in PVB controller
2022-07-26 10:32:59 +08:00
Xun Jiang 396e68b810 VolumeSnapshotLocation refactor with kubebuilder.
1. modify VSL CRD API file name. Add kubebuilder related marker.
2. Add Labels init code for VSL create command.

Signed-off-by: Xun Jiang <jxun@vmware.com>
2022-07-25 15:46:43 +08:00
Daniel Jiang b5583bc2d9
Merge pull request #5129 from kaovilai/initialize-typo
comment typo initialise -> initialize
2022-07-25 13:45:00 +08:00
Xun Jiang 82ac228a01 Delay CA file deletion in PVB controller
Fix #5140.

Signed-off-by: Xun Jiang <jxun@vmware.com>
2022-07-22 19:36:17 +08:00
Daniel Jiang f562a7ce2b Update the CRD for kopia integration
This commit adds additional fields to podvolumebackup
and podvolumerestore.  The resticrepository will be renamed to
backuprepository

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2022-07-22 00:10:24 +08:00
Tiger Kaovilai 9a5c3aceff typo initialise -> initialize
Signed-off-by: Tiger Kaovilai <tkaovila@redhat.com>
2022-07-18 12:05:10 -04:00
Scott Seago 64a8c44104 Modify BackupStoreGetter to avoid BSL spec changes
Pass in a new copy of the map of config values rather than
modifying the BSL Spec.Config and then pass in that field.

Signed-off-by: Scott Seago <sseago@redhat.com>
2022-07-18 10:31:35 -04:00
Xun Jiang/Bruce Jiang eaf97e7510
Merge pull request #5110 from reasonerjt/plugin-panic-trace
Dump stack trace when the plugin server handles panic
2022-07-11 22:47:17 +08:00
Daniel Jiang 9102f53131 Dump stack trace when the plugin server handles panic
Mitigate the issue mentioned in #4782
When there's a bug or misconfiguration that causes nil pointer there
will be more stack trace information to help us debug.

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2022-07-11 02:01:13 +08:00
Scott Seago 77c1549d4d
Merge pull request #5101 from ywk253100/220628_bsl
Fix bsl validation bug
2022-07-08 15:32:51 -04:00
Wenkai Yin(尹文开) f550f8e3cd Fix bsl validation bug
Fix bsl validation bug: the BSL is validated continually and doesn't respect the validation period configured

Fixes #5056

Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
2022-07-06 14:20:03 +08:00
niulechuan fb897471c0
Move 'velero.io/exclude-from-backup' label string to const (#5053)
* move 'velero.io/exclude-from-backup' label name to const

Signed-off-by: Niu Lechuan <lechuan.niu@daocloud.io>

* add changelog file (in changelogs/unreleased) of this PR

Signed-off-by: Niu Lechuan <lechuan.niu@daocloud.io>
2022-07-04 14:31:20 +08:00
Scott Seago 6378c266c3
Merge pull request #4980 from anshulahuja98/main
Add support to download CSI json from object store
2022-06-16 10:37:55 -04:00
Scott Seago 79be75e183 When spec.RestoreStatus is empty, don't restore status
Signed-off-by: Scott Seago <sseago@redhat.com>
2022-06-15 13:02:31 -04:00
Anshul Ahuja 7b51bfe03d
Merge branch 'main' into main 2022-06-15 14:16:38 +05:30
Anshul Ahuja a0ff46a3de Add kubebuilder annotation for autogen
Signed-off-by: GitHub <noreply@github.com>
2022-06-13 13:28:26 +00:00
Anshul Ahuja 735d506a7d Add support to download CSI json from object store
Signed-off-by: GitHub <noreply@github.com>
2022-06-13 13:28:26 +00:00
Xun Jiang 806234e043 Add more information for failing to get path or snapshot in restic backup and restore.
Signed-off-by: Xun Jiang <jxun@vmware.com>
2022-06-13 11:32:55 +08:00
Wenkai Yin(尹文开) d16bdf1f80 Bugs fixing: use patch to update status and set default GC period
1. Use patch rather status patch in backup sync controller as we have disable status as sub resource
2. Set the GC period with default value if it isn't set

Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
2022-06-10 17:15:19 +08:00
Wenkai Yin(尹文开) c3a32a116f
Merge pull request #4976 from reasonerjt/vsc-policy-reset-undo
Undo setting the VSC's deletion policy during backup
2022-06-10 09:12:46 +08:00
Daniel Jiang f5649bcc1f Undo setting the VSC's deletion policy during backup
It's not necessary to set the deletion policy as the delete item action
plugin in CSI plugin will set it to Delete when the backup is deleted.

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2022-06-09 16:26:05 +08:00
Wenkai Yin(尹文开) 34087fe5f4 Disable status as sub resource in CRDs
When enabling the status as sub resource in CRD, the status will be ignored when creating the CR with status, this will cause issues when syncing backups/pvbs

Fixes #4950

Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
2022-06-09 07:52:08 +08:00
Wenkai Yin(尹文开) 6fa4d7d606 Mark in-progress CRs as failed when starting the server
Mark in-progress CRs as failed when starting the server

Fixes #4953

Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
2022-06-07 17:02:17 +08:00
Scott Seago a79c1a5877
Merge pull request #4785 from RafaeLeal/restore-status
Add ability to restore status on selected resources
2022-05-24 09:41:18 -04:00
Rafael Leal e0e3016efa
Cleanup resetStatus
Signed-off-by: Rafael Leal <rafaelealdias@gmail.com>
2022-05-23 17:53:32 -03:00
Scott Seago 471e357952
Merge pull request #4914 from blackpiglet/4912-fix-completion-zsh
Make velero completion zsh command output can be used by `source` com…
2022-05-23 10:05:12 -04:00
Rafael Leal 131c8a920f
Remove break line
Signed-off-by: Rafael Leal <rafaelealdias@gmail.com>
2022-05-19 17:36:21 -03:00
Rafael Leal bcef5e1d5e
Refactor to simplify
Signed-off-by: Rafael Leal <rafaelealdias@gmail.com>
2022-05-17 10:39:14 -03:00
Wenkai Yin(尹文开) 44199db79d Enhance the map flag to support parsing input value contains entry delimiters
Enhance the map flag to support parsing input value contains entry delimiters

Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
2022-05-17 13:56:41 +08:00
Xun Jiang 3db40a58a4 Make velero completion zsh command output can be used by `source` command.
Signed-off-by: Xun Jiang <jxun@vmware.com>
2022-05-17 10:01:46 +08:00
Rafael Leal d85ed612cb
Cleanup
Signed-off-by: Rafael Leal <rafaelealdias@gmail.com>
2022-05-12 12:01:00 -03:00
Rafael Leal 206709b978
Cleanup
Signed-off-by: Rafael Leal <rafaelealdias@gmail.com>
2022-05-12 12:01:00 -03:00
Rafael Leal 8ecc11fad2
Add restore status to cli
Signed-off-by: Rafael Leal <rafaelealdias@gmail.com>
2022-05-12 12:00:34 -03:00
Rafael Leal 7f22974719
Update CRDs
Signed-off-by: Rafael Leal <rafaelealdias@gmail.com>
2022-05-12 11:59:49 -03:00
Rafael Leal 04aa7a849f
Fixes tests hopefully
Signed-off-by: Rafael Leal <rafaelealdias@gmail.com>
2022-05-12 11:59:05 -03:00
Rafael Leal 0b9d6ae73d
Add restore status mechanism
Signed-off-by: Rafael Leal <rafaelealdias@gmail.com>
2022-05-12 11:59:05 -03:00
Rafael Leal 7f1f881c28
Add resource status
Signed-off-by: Rafael Leal <rafaelealdias@gmail.com>
2022-05-12 11:58:47 -03:00
Rafael Leal e374eb9da4
Add StatusUpdater
Signed-off-by: Rafael Leal <rafaelealdias@gmail.com>
2022-05-12 11:57:41 -03:00
Rafael Leal 6a721403fb
Fix DeepEqual when status is updated
Signed-off-by: Rafael Leal <rafaelealdias@gmail.com>
2022-05-12 10:47:24 -03:00
Daniel Jiang 9b5257663a
Merge pull request #4650 from shubham-pampattiwar/add-label-selectors
Add multiple label selector support to Velero Backup and Restore APIs
2022-05-11 23:16:28 +08:00
Shubham Pampattiwar bfdb68a35a add multiple label selector support to backup API
Signed-off-by: Shubham Pampattiwar <shubhampampattiwar7@gmail.com>

remove backup CLI bits

Signed-off-by: Shubham Pampattiwar <shubhampampattiwar7@gmail.com>

labelselectors spec option for velero restore

Signed-off-by: Shubham Pampattiwar <shubhampampattiwar7@gmail.com>

add changelog file

Signed-off-by: Shubham Pampattiwar <shubhampampattiwar7@gmail.com>

update spec name to OrLabelSelectors

Signed-off-by: Shubham Pampattiwar <shubhampampattiwar7@gmail.com>

minor fixes

Signed-off-by: Shubham Pampattiwar <shubhampampattiwar7@gmail.com>

add validations for labelSelector and orLabelSelectors

Signed-off-by: Shubham Pampattiwar <shubhampampattiwar7@gmail.com>

update crds.gp after fixing conflicts

Signed-off-by: Shubham Pampattiwar <shubhampampattiwar7@gmail.com>

fix CI and add unit tests

Signed-off-by: Shubham Pampattiwar <shubhampampattiwar7@gmail.com>

updated OrLabelSelector spec description and added validation failure unit tests

Signed-off-by: Shubham Pampattiwar <shubhampampattiwar7@gmail.com>

add comments and change log level

Signed-off-by: Shubham Pampattiwar <shubhampampattiwar7@gmail.com>

update site docs

Signed-off-by: Shubham Pampattiwar <shubhampampattiwar7@gmail.com>

wrap pager client calls in a function

Signed-off-by: Shubham Pampattiwar <shubhampampattiwar7@gmail.com>

resolve confilcts and update crds.go

Signed-off-by: Shubham Pampattiwar <shubhampampattiwar7@gmail.com>

rebase and update crds.go

Signed-off-by: Shubham Pampattiwar <shubhampampattiwar7@gmail.com>

combine listing items for a given label

Signed-off-by: Shubham Pampattiwar <shubhampampattiwar7@gmail.com>
2022-05-11 09:57:47 -04:00
Wenkai Yin(尹文开) 879d03398b
Merge pull request #4894 from blackpiglet/bsl-refactor
Refactor BSL controller with periodical enqueue source
2022-05-11 19:23:51 +08:00
Xun Jiang 989a1e3ebb Refactor BSL controller with periodical enqueue source.
Add filter functions for PeriodicalEnqueueSource.
Move BSL's valication frequency check test case to PeriodicalEnqueueSource's test.

Signed-off-by: Xun Jiang <jxun@vmware.com>
2022-05-11 15:31:47 +08:00
qiuming d48e1d9db7
Merge pull request #4897 from ywk253100/220609_gc
Make garbage collection for expired backups configurable
2022-05-11 10:46:03 +08:00
Wenkai Yin(尹文开) 6a551e546e Make garbage collection for expired backups configurable
Make garbage collection for expired backups configurable

Fixes #4875

Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
2022-05-11 10:33:59 +08:00
Shubham Pampattiwar e3106f3e10 add existingResourcePolicy to Restore API
add updateall policy option

fix updating labels

dump updateAll policy option

remove updateAll policy refs

Signed-off-by: Shubham Pampattiwar <shubhampampattiwar7@gmail.com>

add changelog file

Signed-off-by: Shubham Pampattiwar <shubhampampattiwar7@gmail.com>

update docs

Signed-off-by: Shubham Pampattiwar <shubhampampattiwar7@gmail.com>

patch labels for sa if policy is update

Signed-off-by: Shubham Pampattiwar <shubhampampattiwar7@gmail.com>

fix existingResourcePolicy for serviceaccounts

modularize changes and add unit tests

Signed-off-by: Shubham Pampattiwar <shubhampampattiwar7@gmail.com>

fix conflicts and update crds.go

Signed-off-by: Shubham Pampattiwar <shubhampampattiwar7@gmail.com>

change log level from info to error

Signed-off-by: Shubham Pampattiwar <shubhampampattiwar7@gmail.com>

update crds.go

Signed-off-by: Shubham Pampattiwar <shubhampampattiwar7@gmail.com>
2022-05-09 13:36:24 -04:00
Xun Jiang/Bruce Jiang 40a36d2941
Merge pull request #4859 from qiuming-best/restic-repo-tmp
Convert Restic Repository resource/controller to the Kubebuilder framework
2022-05-09 17:57:01 +08:00
Wenkai Yin(尹文开) 1d8d2bdb4f
Merge pull request #4890 from sseago/restoreitemaction-label-fix
continue rather than return for non-matching restore action label
2022-05-09 14:34:03 +08:00
Ming ef7e5a8388 change func name and repository description
Signed-off-by: Ming <mqiu@vmware.com>
2022-05-09 13:57:02 +08:00
Xun Jiang/Bruce Jiang 62dde34f86
Merge pull request #4893 from ywk253100/220506_restart
Make in-progress PVB/PVR as failed when restic controller restarts to avoid hanging backup/restore
2022-05-07 17:32:40 +08:00
Wenkai Yin(尹文开) 034cda2571 Make in-progress PVB/PVR as failed when restic controller restarts to avoid hanging backup/restore
Make in-progress PVB/PVR as failed when restic controller restarts to avoid hanging backup/restore

Fixes #4772

Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
2022-05-07 16:51:06 +08:00
Ming 752b28166f Merge branch 'main' of https://github.com/qiuming-best/velero into restic-repo-tmp 2022-05-06 14:43:00 +08:00
Scott Seago da916846b1 continue rather than return for non-matching restore action label
When iterating over applicable restore actions, if a non-matching label
selector is found, velero should continue to the next action rather than
returning from the restoreItem func, which ends up preventing the item's
restore entirely.

Signed-off-by: Scott Seago <sseago@redhat.com>
2022-05-05 08:37:48 -04:00
Xun Jiang a69bd8b1f3 Remove VolumeSnapshot created during backup, when the VolumeSnapshotClass's DeletionPolicy is set to Delete.
1. Delete VolumeSnapshot directly when DeletionPolicy set to Retain.
2. Change VolumeSnapshotContent's DeletionPolicy to Retain, then delete VolumeSnapshot. After that delete VolumeSnapshotContent and change VSC DeletionPolicy to Delete back, then re-create the VolumeSnapshotContent.

Signed-off-by: Xun Jiang <jxun@vmware.com>
2022-05-05 18:30:59 +08:00
Xun Jiang 6421f8ad02 Make waiting VolumeSnapshot to ready process parallel.
Signed-off-by: Xun Jiang <jxun@vmware.com>
2022-05-05 14:32:55 +08:00
Wenkai Yin(尹文开) aa71427576
Merge pull request #4887 from reasonerjt/delete-orphan-vs
Delete orphan CSI snapshots in backup sync controller
2022-05-05 11:27:44 +08:00
Daniel Jiang 89e90d9be4 Delete orphan CSI snapshots in backup sync controller
This commit makes backup sync controller delete the volumesnapshot and
volumesnapshotcontent created by the backup which is cleaned up as orphan

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2022-05-05 10:54:34 +08:00
Daniel Jiang 628164668f
Merge pull request #4655 from ywk253100/220214_pod_volume_restore
Convert Pod Volume Restore resource/controller to the Kubebuilder framework
2022-05-05 10:33:41 +08:00
Ming 06d3d731ed Refactor restic repository
Signed-off-by: Ming <mqiu@vmware.com>
2022-04-29 10:26:00 +08:00
Daniel Jiang ad6c5a5ad6 Change the name of UT to be more consistent
Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2022-04-28 14:47:37 +08:00
Xun Jiang/Bruce Jiang 001229a8b3
Merge pull request #4855 from reasonerjt/bak-delete-refact
Refactor backup deletion controller based on kubebuilder
2022-04-28 10:48:11 +08:00
Wenkai Yin(尹文开) d42e353610
Merge pull request #4866 from reasonerjt/clusterclass-restore-order
Add ClusterClasses to the restore priority list
2022-04-28 09:04:41 +08:00
Scott Seago 58a8371ca2
Merge pull request #4833 from ywk253100/220413_restart
Make in-progress backup/restore as failed when doing the reconcile
2022-04-27 11:45:01 -04:00
Daniel Jiang 74fd158a1c Refactor backup deletion controller based on kubebuilder
Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2022-04-27 17:00:54 +08:00
Daniel Jiang f89691c5c1 Add ClusterClasses to the restore priority list
Make sure ClusterClasses are stored before Clusters.
Fixes #4767

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2022-04-27 15:53:55 +08:00
Wenkai Yin(尹文开) c2c211fefb Convert Pod Volume Restore resource/controller to the Kubebuilder framework
Convert Pod Volume Restore resource/controller to the Kubebuilder framework

Fixes #4134

Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
2022-04-26 16:23:38 +08:00
Wenkai Yin(尹文开) dfc86566b8 Make in-progress backup/restore as failed when doing the reconcile
Make in-progress backup/restore as failed when doing the reconcile to avoid hanging in in-progress status

Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
2022-04-26 11:05:03 +08:00
Xun Jiang 22dd0b2ebb Modify CSI VolumeSnapshot metric related code.
Signed-off-by: Xun Jiang <jxun@vmware.com>
2022-04-23 12:59:56 +08:00
Daniel Jiang 3ec96e2eac
Merge pull request #4838 from ywk253100/220418_marker
Use controller-gen to generate the deep copy methods for objects
2022-04-21 14:00:48 +08:00
Xun Jiang/Bruce Jiang ff4f63b6e3
Merge pull request #4844 from ywk253100/220418_schedule
Return the error when running reconcile to trigger the handling logic again
2022-04-20 17:57:20 +08:00
Wenkai Yin(尹文开) 9e786d681b
Merge pull request #4832 from reasonerjt/fix-rm-csi-bak-tmp
Make the vsc created by backup sync controller deletable
2022-04-20 17:19:09 +08:00
Scott Seago de17605c62
Merge pull request #4769 from jibutech/4754-fix
Skip povdolumerestore creation when restore excludes pv/pvc
2022-04-19 11:54:30 -04:00
Daniel Jiang 4f9e445142 Make the vsc created by backup sync controller deletable
Fixes #4760

This commit make changes in 2 parts:
1) When a volumesnapshotcontent is persisted during backup, velero will reset its
   `Source` field to remove the VolumeHandle, so that the
   csi-snapshotter will not try to call `CreateSnapshot` when its synced
   to another cluster with a backup.
2) Make sure the referenced volumesnapshotclasses are persisted and
   synced with the backup, so that when the volumesnapshotcontent is
   deleted the storage snapshot is also removed.

Signed-off-by: Daniel Jiang <jiangd@vmware.com>
2022-04-19 15:06:59 +08:00
Wenkai Yin(尹文开) fb48c5a301 Return the error when running reconcile to trigger the handling logic again
Return the error when running reconcile to trigger the handling logic again

Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
2022-04-19 09:23:40 +08:00
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