Commit Graph

1134 Commits (f2fc1050940c57c461e51fb9bb88ab5d840a6337)

Author SHA1 Message Date
Wenkai Yin(尹文开) bc94c8784b Check for nil before logging DefaultVolumesToRestic value
Check for nil before logging DefaultVolumesToRestic value

Fixes #4617

Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
2022-02-21 17:17:58 +08:00
Wenkai Yin(尹文开) 599b686596 Bump up golang to 1.17.7
Bump up golang to 1.17.7

Signed-off-by: Wenkai Yin(尹文开) <yinw@vmware.com>
2022-02-18 11:33:25 +08:00
Alay Patel 8c6ed31528 - 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-17 14:58:13 +08:00
Wenkai Yin(尹文开) 37a712ef2f
Fix CVE-2020-29652 and CVE-2020-26160 (#4315)
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-09 17:04:25 -08:00
Frangipani Gold 1da212b0e3
Namespace validation now allows asterisks and empty string (#4316)
Validation allows empty string namespace

Signed-off-by: F. Gold <fgold@vmware.com>
2021-11-08 09:34:05 -08: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
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
Carlisia Thompson c65c17c559
Revert printer columns (#3652)
* Revert "Add additional printer columns for CRDs (#2881)"

This reverts commit 4178d9de32.

Signed-off-by: Carlisia <carlisia@vmware.com>

* Add generated files

Signed-off-by: Carlisia <carlisia@vmware.com>
2021-03-31 14:46:37 -07:00
Carlisia e498a23311 Remove unnecessary check
Signed-off-by: Carlisia <carlisia@vmware.com>
2021-03-25 17:26:44 -07:00