Commit Graph

292 Commits (18c6cd04001251b5e60c9e45188ebc941c10d521)

Author SHA1 Message Date
codegold79 c8dfd648bb
Restore progress reporting bug fix (#3583)
* Improve readbility and formatting of pkg/restore/restore.go

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

* Update paths to include API group versions

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

* Use full word, 'resource' instead of 'resrc'

Signed-off-by: F. Gold <fgold@vmware.com>
2021-03-15 18:51:07 -04:00
Pranav Gaikwad c46fe71b12
Restore progress reporting (#3125)
* restore progress reporting

Signed-off-by: Pranav Gaikwad <pgaikwad@redhat.com>

* add restore statistics to describe restore

Signed-off-by: Pranav Gaikwad <pgaikwad@redhat.com>

* address feedback, include namespaces in the count

Signed-off-by: Pranav Gaikwad <pgaikwad@redhat.com>
2021-03-04 16:21:44 -05:00
Bridget McErlean 0246a32ad0
Use pod namespace from backup when matching PVBs (#3475)
* Use pod namespace from backup when matching PVBs

In #3051, we introduced an additional check to ensure that a PVB matched
a particular pod by checking both the name and the namespace of the pod.
This caused an issue when using a namespace mapping on restore. In the
case where a namespace mapping is being used, the check for whether a
PVB matches a particular pod will fail as the PVB was created for the
original pod namespace and is not aware of the new namespace mapping
being used. This resulted in PVRs not being created for pods that were
being restored into new namespaces. The restic init containers were
being created to wait on the volume restore, however this would cause
the restored pods to block indefinitely as they would be waiting for a
volume restore that was not scheduled.

To fix this, we use the original namespace of the pod from the backup to
match the PVB to the pod being restored, not the new namespace where
the pod is being restored into.

Fixes #3467.

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

* Explain why the namespace mapping can't be used

Signed-off-by: Bridget McErlean <bmcerlean@vmware.com>
2021-02-22 11:16:00 -08:00
codegold79 6bdd4ac192
Restore API group version by priority (#3133)
* Restore API group version by priority

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

* Add changelog

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

* Correct spelling

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

* Refactor userResourceGroupVersionPriorities(...) to accept config map, adjust unit test

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

* Move some unit tests into e2e

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

* Add three e2e tests using Testify Suites

Summary of changes

Makefile - add testify e2e test target
go.sum - changed with go mod tidy
pkg/install/install.go - increased polling timeout
test/e2e/restore_priority_group_test.go - deleted
test/e2e/restore_test.go - deleted
test/e2e/velero_utils.go - made restic optional in velero install
test/e2e_testify/Makefile - makefile for testify e2e tests
test/e2e_testify/README.md - example command for running tests
test/e2e_testify/common_test.go - helper functions
test/e2e_testify/e2e_suite_test.go - prepare for tests and run
test/e2e_testify/restore_priority_apigv_test.go - test cases

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

* Make changes per @nrb code review

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

* Wait for pods in e2e tests

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

* Remove testify suites e2e scaffolding moved to PR #3354

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

* Make changes per @brito-rafa and Velero maintainers code reviews

- Made changes suggested by @brito-rafa in GitHub.
- We had a code review meeting with @carlisia, @dsu-igeek, @zubron, and @nrb
- and changes were made based on their suggetions:
  - pull in logic from 'meetsAPIGVResotreReqs()' to restore.go.
  - add TODO to remove APIGroupVersionFeatureFlag check
  - have feature flag and backup version format checks in separate `if` statements.
  - rename variables to be sourceGVs, targetGVs, and userGVs.

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

* Convert Testify Suites e2e tests to existing Ginkgo framework

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

* Made changes per @zubron PR review

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

* Run go mod tidy after resolving go.sum merge conflict

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

* Add feature documentation to velero.io site

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

* Add config map e2e test; rename e2e test file and name

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

* Update go.{mod,sum} files

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

* Move CRDs and CRs to testdata folder

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

* Fix typos in cert-manager to pass codespell CICD check

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

* Make changes per @nrb code review round 2

- make checkAndReadDir function private
- add info level messages when priorties 1-3 API group versions can not be used

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

* Make user config map rules less strict

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

* Update e2e test image version in example

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

* Update case A music-system controller code

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

* Documentation updates

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

* Update migration case documentation

Signed-off-by: F. Gold <fgold@vmware.com>
2021-02-16 12:36:17 -05:00
steve_chph a8ef1a65ff
Fix typo (#3352)
Signed-off-by: peihongchen <171250610@smail.nju.edu.cn>
2021-01-27 08:59:23 -05:00
Madhav Jivrajani 01853826b5
Raise logging level for PV deletion timeout (#3316)
* raised logging level for PV deletion timeout

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>

* add changelog

Signed-off-by: Madhav Jivrajani <madhav.jiv@gmail.com>
2021-01-21 19:48:33 -05:00
yusufgungor 3b2e9036d1
Preserve nodePort support with --preserve-nodeports flag (#3095)
* -> Preserve nodePort support when restoring via "--preserve-nodeports" flag

Signed-off-by: Yusuf Güngör <yusuf.gungor@hepsiburada.com>

* -> Added changelog.

Signed-off-by: Yusuf Güngör <yusuf.gungor@hepsiburada.com>

* -> Unit test added.
-> Using boolptr.IsSetToTrue for bool ptr check.

Signed-off-by: Yusuf Güngör <yusuf.gungor@hepsiburada.com>

* -> Unit test added.
-> Using boolptr.IsSetToTrue for bool ptr check.

Signed-off-by: Yusuf Güngör <yusuf.gungor@hepsiburada.com>

* -> Other restore errors log level changed from info to error.
-> Documentation updated about Velero nodePort restore logic and preservation of them.

Signed-off-by: Yusuf Güngör <yusuf.gungor@hepsiburada.com>

Co-authored-by: Yusuf Güngör <yusuf.gungor@hepsiburada.com>
2020-12-09 09:32:34 -08:00
Mateusz Gozdek dbc83af77b
Fix various typos found by codespell (#3057)
By running the following command:

codespell -S .git,*.png,*.jpg,*.woff,*.ttf,*.gif,*.ico -L \
iam,aks,ist,bridget,ue

Signed-off-by: Mateusz Gozdek <mgozdekof@gmail.com>
2020-11-10 11:48:35 -05:00
Ashish Amarnath dc6762a895
🐛 Use namespace and name to match PVB to Pod restore (#3051)
Signed-off-by: Ashish Amarnath <ashisham@vmware.com>
2020-11-10 11:36:49 -05:00
Mayank 68a4b23722
fixing 'velero.io/change-pvc-node-selector' plugin to fetch configmap using plugin name (#2970)
* fixing label for 'velero.io/change-pvc-node-selector' plugin in site document

Signed-off-by: mayank <mayank.patel@mayadata.io>

* Fixing "velero.io/change-pvc-node-selector" to fetch config using plugin name

Signed-off-by: mayank <mayank.patel@mayadata.io>

* adding changelog

Signed-off-by: mayank <mayank.patel@mayadata.io>
2020-11-04 11:45:39 -08:00
Nolan Brubaker 28a46d3a8b
Ensure PVs and PVCs remain bound when doing a restore (#3007)
* Only remove the UID from a PV's claimRef

The UID is the only part of a claimRef that might prevent it from being
rebound correctly on a restore. The namespace and name within the
claimRef should be preserved in order to ensure that the PV is claimed
by the correct PVC on restore.

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>

* Remap PVs claimRef.namespace on relevant restores

When remapping namespaces, any included PVs need to have their claimRef
updated to point remapped namespaces to the new namespace name in order
to be bound to the correct PVC.

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>

* Update tests and ensure claimRef namespace remaps

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>

* Remove lowercased uid field from unstructured PV

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>

* Fix issues that prevented PVs from being restored

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>

* Add changelog

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>

* Dynamically reprovision volumes without snapshots

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>

* Update test for lower case uid field

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>

* Remove stray debugging print statement

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>

* Fix typo, remove extra code, add tests.

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>
2020-10-15 16:57:43 -07:00
Andrew Reed 0547b1d945
Restore hooks exec (#2804)
* Exec hooks in restored pods

Signed-off-by: Andrew Reed <andrew@replicated.com>

* WaitExecHookHandler implements ItemHookHandler

This required adding a context.Context argument to the ItemHookHandler
interface which is unused by the DefaultItemHookHandler implementation.
It also means passing nil for the []ResourceHook argument since that
holds BackupResourceHook.

Signed-off-by: Andrew Reed <andrew@replicated.com>

* WaitExecHookHandler unit tests

Signed-off-by: Andrew Reed <andrew@replicated.com>

* Changelog and go fmt

Signed-off-by: Andrew Reed <andrew@replicated.com>

* Fix double import

Signed-off-by: Andrew Reed <andrew@replicated.com>

* Default to first contaienr in pod

Signed-off-by: Andrew Reed <andrew@replicated.com>

* Use constants for hook error modes in tests

Signed-off-by: Andrew Reed <andrew@replicated.com>

* Revert to separate WaitExecHookHandler interface

Signed-off-by: Andrew Reed <andrew@replicated.com>

* Negative tests for invalid timeout annotations

Signed-off-by: Andrew Reed <andrew@replicated.com>

* Rename NamedExecRestoreHook PodExecRestoreHook

Also make field names more descriptive.

Signed-off-by: Andrew Reed <andrew@replicated.com>

* Cleanup test names

Signed-off-by: Andrew Reed <andrew@replicated.com>

* Separate maxHookWait and add unit tests

Signed-off-by: Andrew Reed <andrew@replicated.com>

* Comment on maxWait <= 0

Also info log container is not running for hooks to execute in.
Also add context error to hooks not executed errors.

Signed-off-by: Andrew Reed <andrew@replicated.com>

* Remove log about default for invalid timeout

There is no default wait or exec timeout.

Signed-off-by: Andrew Reed <andrew@replicated.com>

* Linting

Signed-off-by: Andrew Reed <andrew@replicated.com>

* Fix log message and rename controller to podWatcher

Signed-off-by: Andrew Reed <andrew@replicated.com>

* Comment on exactly-once semantics for handler

Signed-off-by: Andrew Reed <andrew@replicated.com>

* Fix logging and comments

Use filed logger for pod in handler.
Add comment about pod changes in unit tests.
Use kube util NamespaceAndName in messages.

Signed-off-by: Andrew Reed <andrew@replicated.com>

* Fix maxHookWait

Signed-off-by: Andrew Reed <andrew@replicated.com>
2020-09-08 11:33:15 -07:00
Pawan Prakash Sharma debcbd2f8e
fix: rename the PV if VolumeSnapshotter has modified the PV name (#2835)
* fix: rename the PV if VolumeSnapshotter has modified the PV name

When VolumeSnapshotter sets the PV name via SetVolumeID and PV is
not there in the cluster, velero does not rename the PV. Which causes
the pvc to be in the lost state as pvc points to the old PV but pv object
has been renamed by VolumeSnapshotter.

Signed-off-by: Pawan <pawan@mayadata.io>

* adding a test case for pv rename

Signed-off-by: Pawan <pawan@mayadata.io>
2020-09-01 14:25:13 -07:00
Nolan Brubaker 718a94ad05
Invoke DeleteItemActions on backup deletion (#2815)
* Add serving and listing support

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>
2020-08-20 17:24:29 -07:00
Ashish Amarnath e391e43192 🐛 Supply command to run restic-wait init container
Signed-off-by: Ashish Amarnath <ashisham@vmware.com>
2020-08-11 11:05:30 -07:00
Ashish Amarnath 5d6da6517b
Implement restore hooks injecting init containers into pod spec (#2787)
*  Implement restore hooks injecting init containers into pod spec

Signed-off-by: Ashish Amarnath <ashisham@vmware.com>
2020-08-11 10:38:44 -07:00
Piper Dougherty 19e65689ef
Add the ability to set the allowPrivilegeEscalation property on the Restic restore helper via plugin ConfigMap (#2792)
* Add the ability to set the `allowPrivilegeEscalation` security context attribute on the Restic restore helper init container.

Signed-off-by: Piper Dougherty <doughertypiper@gmail.com>

* Add changelog.

Signed-off-by: Piper Dougherty <doughertypiper@gmail.com>

* Fix old tests and add tests for new allowPrivilegeEscalation config option.

Signed-off-by: Piper Dougherty <doughertypiper@gmail.com>

* Correct spelling in changelog.

Signed-off-by: Piper Dougherty <doughertypiper@gmail.com>

* Switch to boolptr type.

Signed-off-by: Piper Dougherty <doughertypiper@gmail.com>

* Reorder imports for sanity.

Signed-off-by: Piper Dougherty <doughertypiper@gmail.com>
2020-08-06 13:08:36 -04:00
Andrew Reed 9011b192e9
Add hooks fields to restore context (#2755)
* Add hooks fields to restore context

Signed-off-by: Andrew Reed <andrew@replicated.com>

* Changelog

Signed-off-by: Andrew Reed <andrew@replicated.com>
2020-07-24 11:43:44 -07:00
Martin Odstrčilík 86efd1577e
add support for setting SecurityContext (user, group) for restic restore (#2621)
* add support for setting SecurityContext (user, group) for restic restore

Signed-off-by: Martin Odstrcilik <martin.odstrcilik@gmail.com>
2020-07-22 12:10:25 -07:00
Nolan Brubaker f42c63af1b
Address insensitive language (#2677)
* Change master to main in most uses

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>
2020-07-17 14:59:51 -07:00
Andrew Lavery a368370bef
k8s 1.18 import (#2651)
* k8s 1.18 import wip

backup, cmd, controller, generated, restic, restore, serverstatusrequest, test and util

Signed-off-by: Andrew Lavery <laverya@umich.edu>

* go mod tidy

Signed-off-by: Andrew Lavery <laverya@umich.edu>

* add changelog file

Signed-off-by: Andrew Lavery <laverya@umich.edu>

* go fmt

Signed-off-by: Andrew Lavery <laverya@umich.edu>

* update code-generator and controller-gen in CI

Signed-off-by: Andrew Lavery <laverya@umich.edu>

* checkout proper code-generator version, regen

Signed-off-by: Andrew Lavery <laverya@umich.edu>

* fix remaining calls

Signed-off-by: Andrew Lavery <laverya@umich.edu>

* regenerate CRDs with ./hack/update-generated-crd-code.sh

Signed-off-by: Andrew Lavery <laverya@umich.edu>

* use existing context in restic and server

Signed-off-by: Andrew Lavery <laverya@umich.edu>

* fix test cases by resetting resource version

also use main library go context, not golang.org/x/net/context, in pkg/restore/restore.go

Signed-off-by: Andrew Lavery <laverya@umich.edu>

* clarify changelog message

Signed-off-by: Andrew Lavery <laverya@umich.edu>

* use github.com/kubernetes-csi/external-snapshotter/v2@v2.2.0-rc1

Signed-off-by: Andrew Lavery <laverya@umich.edu>

* run 'go mod tidy' to remove old external-snapshotter version

Signed-off-by: Andrew Lavery <laverya@umich.edu>
2020-07-16 12:21:37 -04:00
Nolan Brubaker de8962ea18
Bug fix: Calculate label using backup name for CSI objects (#2510)
* Use a helper function when querying w/ backup label

Setting or querying for a backup label name should always pass the value
through the GetValidName function. This change passes query uses of the
backup label value through the GetValidName function by introducing 2
new helpers, one for making a Selector, one for making a ListOptions.

It also removes functions returning the same data, but under
unecessarily specific names.

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>

* Document using the label.GetValidName function

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>

* Update copyright year

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>

* Clarify labels.GetValidName and annotations

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>

* Move functions to pkg/label

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>

* Fix function comments

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>
2020-05-07 11:56:13 -07:00
Steve Kriss 2d55cd2ed8 bug fix: fix int/float conversion issue with CRD type in restore plugin
Signed-off-by: Steve Kriss <krisss@vmware.com>
2020-04-30 09:06:03 -06:00
Ashish Amarnath 824bc8eec5
Merge pull request #2390 from skriss/fix-2366
bug fix: save PVBs even if no snapshot was taken
2020-04-08 12:21:43 -07:00
Mayank 016868ecd3
add restore item action to update PVC selected-node annotation (#2377)
* New RestoreItemAction for PVC with annotation `volume.kubernetes.io/selected-node`

Signed-off-by: mayank <mayank.patel@mayadata.io>
2020-04-03 08:01:34 -07:00
Ashish Amarnath 061b4463ce
ensure target namespace exists prior to retoring a resource (#2389)
Signed-off-by: Ashish Amarnath <ashisham@vmware.com>
2020-04-03 07:57:01 -07:00
Steve Kriss 91228522be bug fix: save PVBs even if no snapshot was taken
Signed-off-by: Steve Kriss <krisss@vmware.com>
2020-04-02 13:17:41 -06:00
Steve Kriss 583ef4258a refactor restore priorities code to use single loop and lazy discovery
Signed-off-by: Steve Kriss <krisss@vmware.com>
2020-03-10 08:57:50 -06:00
Nolan Brubaker 766ab5d3ee
Account for possible missing schemas on v1 CRDs (#2264)
* Account for possible missing schemas on v1 CRDs

If a v1beta1 CRD without a Schema was submitted to a Kubernets v1.16
cluster, then Kubernetes will server it back as a v1 CRD without a
schema.

However, when Velero tries to restore this document, the request will be
rejected as a v1 CRD must have a schema.

This commit has some defensive coding on the restore side, as well as
potential fixes on the backup side for getting around this.

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>

* Back up nonstructural CRDs as v1beta1

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>

* Add tests for remapping plugin

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>

* Add builders for v1 CRDs

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>

* Address review feedback

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>

* Remove extraneous log message

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>

* Add changelog

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>
2020-02-24 12:07:50 -07:00
Mayank 1a1372550d
Use PV name returned from volumesnapshotter while creating a PV (#2216)
* Using PV name returned from volumesnapshotter while creating a PV

Signed-off-by: mayank <mayank.patel@mayadata.io>
2020-02-10 13:17:15 -07:00
Steve Kriss 08c549a092
Restore result refactoring (#2234)
* move Result helper funcs to be methods

Signed-off-by: Steve Kriss <krisss@vmware.com>
2020-02-03 10:56:57 -08:00
Nolan Brubaker 6745979a7b
Wait for CRDs to be ready before restoring CRs (#1937)
* Wait for CRDs to be available and ready

When restoring CRDs, we should wait for the definition to be ready and
available before moving on to restoring specific CRs.

While the CRDs are often ready by the time we get to restoring a CR,
there is a race condition where the CRD isn't ready.

This change waits on each CRD at restore time.

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>
2020-01-30 09:19:13 -08:00
Nolan Brubaker 5b1280c2cd Fix restore issues for CRD v1 on Kubernetes v1.16 clusters (#2197)
Fix restore issues for CRD v1 on Kubernetes v1.16 clusters

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>
2020-01-27 13:59:08 -08:00
Steve Kriss ae316193ea move log statement
Signed-off-by: Steve Kriss <krisss@vmware.com>
2020-01-21 12:36:46 -07:00
Steve Kriss 3b80e00d62 fix race condition in waiting for restic restores to complete
Signed-off-by: Steve Kriss <krisss@vmware.com>
2020-01-15 16:09:54 -07:00
JenTing Hsiao 97b33402a4 Assign default CPU/Memory resource value if not present (#2176)
Install restic with CPU/Memory limits is optional.
If velero cannot parse resource requirements, use default value instead.

After that, the administrator won't get confused that something recovered failed.

Signed-off-by: JenTing Hsiao <jenting.hsiao@suse.com>
2020-01-09 08:48:35 -07:00
John Naulty Jr cd860771c2 Add error return to pvRenamer func (#2138)
Migrate logic from NewUUID function into the pvRenamer function.

PR #2133 switched to a new NewUUID function that returns an error, but
the invocation of that function needs to happen within the pvRenamer
closure. Because the new function returns an error, the pvRenamer should
return the error, the signature needs to be changed and the return
checked.

Signed-off-by: John Naulty <johnnaulty@bitgo.com>
2019-12-17 10:23:58 -08:00
John Naulty ff889283b8
Switch from satori/go.uuid to gofrs/uuid
satori/go.uuid has a known issue with random uuid generation.
gofrs/uuid is still maintained and has fixed the random uuid generation
issue present in satori/go.uuid

Signed-off-by: John Naulty <johnnaulty@bitgo.com>
2019-12-14 10:27:00 -08:00
Steve Kriss 7c60829f38 bug fix: don't restore cluster-scoped resources by default when restoring specific namespaces (#2118)
* add failing test case for bug

Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-12-12 12:45:41 -08:00
Roman Klimenko 87be775139 Add support for private registry with custom port in restic-helper image (#1999)
* Add support for private registry with custom port in restic-helper image definition

Signed-off-by: Roman Klimenko <cognoz@ya.ru>
2019-12-04 08:01:39 -08:00
Steve Kriss 4fb1bc2ef3
restic: don't try to restore PVBs with no snapshotID (#2031)
* restic: don't try to restore PVBs with no snapshotID

Signed-off-by: Steve Kriss <krisss@vmware.com>

* changelog

Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-11-04 16:18:08 -07:00
KubeKween d26bf05b33 Extract providers (#1985)
* Remove cloud providers and reorg code

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

* Update dependencies

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

* Fix tests

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

* fix dependency issues

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

* Delete dup test

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

* Add back spaces to file

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

* Remove and update docs

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

* Make the plugins flag required

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

* Add changelog

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

* Make the plugins flag conditional

Signed-off-by: Carlisia <carlisia@vmware.com>
2019-10-22 15:31:27 -07:00
Adnan Abdulhussein 69f993aebd update gcr.io/heptio-images/ references to velero/ (#1988)
* update gcr.io/heptio-images/ references to velero/

Signed-off-by: Adnan Abdulhussein <aadnan@vmware.com>
2019-10-22 14:39:43 -07:00
Alexander Demichev 1564317cef Restore action for cluster/namespace role bindings (#1974)
Signed-off-by: Alexander Demichev <ademicev@redhat.com>
2019-10-21 15:11:26 -06:00
KubeKween e054a2f0b3 Make "not restored" message a bit better (#1901)
* Make "not restoring" message a bit better

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

* Tweak error msg

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

* Address feedback

Signed-off-by: Carlisia <carlisia@vmware.com>
2019-10-01 16:47:21 -04:00
Steve Kriss 48792ece1f Updates for org move to vmware-tanzu (#1920)
* update import paths to github.com/vmware-tanzu/...

Signed-off-by: Steve Kriss <krisss@vmware.com>

* update other GH org refs to vmware-tanzu

Signed-off-by: Steve Kriss <krisss@vmware.com>

* site and docs: update GH org to vmware-tanzu

Signed-off-by: Steve Kriss <krisss@vmware.com>

* update travis badge links on docs readmes

Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-09-30 17:26:56 -04:00
Steve Kriss 2e849dcb99 Fix for #1888: check item's original namespace, not remapped one, for inclusion/exclusion (#1909)
Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-09-25 18:01:16 -07:00
Steve Kriss 29f29f9d61
Merge pull request #1828 from carlisia/c-1826-test-bug
Sort mounts in test case to avoid intermittent fail
2019-09-03 12:39:59 -06:00
Carlisia 966222ac0f
Sort mounts in test case to avoid intermitent fail
Closes #1826.

Signed-off-by: Carlisia <carlisia@vmware.com>
2019-08-29 17:55:13 -07:00
Steve Kriss e210626a36 create pkg/archive with functionality extracted from pkg/restore (#1801)
* move pkg/restore's backup extractor to pkg/archive

Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-08-28 18:03:01 -07:00
Steve Kriss 60f9898ca0 restore: rename PV when remapping a namespace if PV exists in-cluster (#1779)
* rename PV during restore when cloning a namespace

Signed-off-by: Steve Kriss <krisss@vmware.com>

* rename func and vars, switch to if..else

Signed-off-by: Steve Kriss <krisss@vmware.com>

* make pv renamer func configurable for testing purposes

Signed-off-by: Steve Kriss <krisss@vmware.com>

* add unit test cases

Signed-off-by: Steve Kriss <krisss@vmware.com>

* changelog

Signed-off-by: Steve Kriss <krisss@vmware.com>

* address review feedback

Signed-off-by: Steve Kriss <krisss@vmware.com>

* address review feedback

Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-08-27 16:42:38 -07:00
KubeKween 6b66a49a21 Unit tests for restic restore (#1747)
* Add unit tests for PVB restore functionality

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

* Add tests for restore action

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

* TestRestoreWithRestic wip

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

* Fix build

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

* Mockery

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

* Cleanup mocks

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

* Remove unused mock

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

* Use consistent pattern for test building

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

* Test cleanup

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

* Better godoc

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

* Improve test cases

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

* Fix build

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

* Minor test cleanup

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

* New pvb test input names

Signed-off-by: Carlisia <carlisia@vmware.com>
2019-08-27 15:49:23 -07:00
Steve Kriss ffa3251efc move contents of pkg/util/test into pkg/test
Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-08-07 08:26:00 -06:00
Steve Kriss 80692a8a39 Properly restore PVs with a reclaim policy of Retain and restic backups (#1713)
* reorganize persistent volume restore code for clarity

Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-08-06 13:40:35 -07:00
KubeKween 4accb8512a Restore from PodVolumeBackups (#1723)
* Restore from PodVolumeBackups

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

* Partially address code reviews

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

* Partially address code reviews #2

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

* Clean up struct

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

* Fix log messages

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

* Fix tests

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

* Clean up

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

* Add changelog

Signed-off-by: Carlisia <carlisiac@vmware.com>
2019-08-06 13:17:36 -07:00
Nolan Brubaker a4e70456a1 Add resource limits to restic init container (#1677)
* Add resource limits to restic init container

Fixes #1201

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>

* Start restic restore item action tests

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>

* Get initial tests for restore action working

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>

* Add new test case

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>

* Move resource parsing into a shared function

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>

* Fetch request/limits from plugin's ConfigMap

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>

* Use builders

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>

* Use moved ParseResourceRequirements function

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>

* Move init container building inline

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>

* Drop CPU limit down a bit and clarify error message

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>

* Fix godoc

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>

* Add resource requirements to doc

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>
2019-08-05 13:18:11 -06:00
Steve Kriss 4543258970 Update tests to use object builders in pkg/builder (#1707)
* add pkg/builder with BackupBuilder and ObjectMeta functional options

Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-07-31 07:46:48 -07:00
KubeKween 3b9af8c654 Store PodVolumeBackups in obj storage & use as source of truth (#1577)
* Store PodVolumeBackups in object storage

Signed-off-by: Carlisia <carlisiac@vmware.com>
2019-07-24 15:51:20 -04:00
Steve Kriss 1bb167ef90 add restore item action to change PVC/PV storage class name (#1621)
* add restore item action to change PVC/PV storage class name

Signed-off-by: Steve Kriss <krisss@vmware.com>

* code review

Signed-off-by: Steve Kriss <krisss@vmware.com>

* change existing plugin names to lowercase/hyphenated

Signed-off-by: Steve Kriss <krisss@vmware.com>

* add validation for new storage class name

Signed-off-by: Steve Kriss <krisss@vmware.com>

* add test cases

Signed-off-by: Steve Kriss <krisss@vmware.com>

* changelog

Signed-off-by: Steve Kriss <krisss@vmware.com>

* fix imports

Signed-off-by: Steve Kriss <krisss@vmware.com>

* update plugin names to be more consistent

Signed-off-by: Steve Kriss <krisss@vmware.com>

* update unit tests to use pkg/test object constructors

Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-07-15 11:19:38 -07:00
Nolan Brubaker 63964fc6f9 Append "/mount" to directory for CSI volumes (#1615)
CSI volumes are mounted one level deeper than "native" kubernetes
volumes, and this needs to be appended for proper restic support.

Fixes #1313.

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>
2019-07-10 15:16:21 -07:00
Steve Kriss d1025f7547 rename restore_new_test.go to restore_test.go
Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-07-10 09:59:27 -06:00
Steve Kriss 678c02c560 move contents of restore_test.go into other files and delete it
Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-07-10 09:59:01 -06:00
Steve Kriss 567802299b move PV/PVC setup helpers into pkg/test
Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-07-03 08:50:11 -06:00
Steve Kriss adb93c33b1 migrate restore PV tests
Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-07-03 08:50:09 -06:00
Steve Kriss db393ec199 properly filter additional items returned from restore item actions
Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-06-28 08:59:23 -06:00
Steve Kriss 022099a62e Refactor pkg/restore tests (part 3) (#1611)
* add modifying restore item action tests

Signed-off-by: Steve Kriss <krisss@vmware.com>

* add restore item action additional items tests

Signed-off-by: Steve Kriss <krisss@vmware.com>

* migrate ShouldRestore test

Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-06-27 15:43:59 -07:00
Steve Kriss 75a96dfa92 fix bugs in finding applicable restore item actions
Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-06-27 13:06:16 -06:00
Steve Kriss 81c2adc059 Refactor pkg/restore tests (part 2) (#1606)
* update TestPrioritizeResources to use real discovery helper

Signed-off-by: Steve Kriss <krisss@vmware.com>

* migrate invalid tarball contents tests

Signed-off-by: Steve Kriss <krisss@vmware.com>

* migrate item restore tests

Signed-off-by: Steve Kriss <krisss@vmware.com>

* migrate restore item action tests

Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-06-27 11:57:47 -07:00
Steve Kriss 0089fa4d93 migrate restore resource priorities test
Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-06-26 10:24:02 -06:00
Steve Kriss 5d8ba1b90d migrate namespace mapping tests
Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-06-24 16:57:30 -06:00
Steve Kriss 1a339f06ac migrate restore resource filtering tests
Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-06-24 15:53:15 -06:00
Nolan Brubaker 67512a3808
Merge pull request #1595 from skriss/restore-test-refactor-1
initial refactoring for pkg/restore tests
2019-06-24 17:08:51 -04:00
Nolan Brubaker 37c7b618ad
Merge pull request #1598 from skriss/rm-has-controller-owner
remove unused hasControllerOwner func and tests
2019-06-24 16:51:28 -04:00
Steve Kriss 19052994ed replace TestBackup with pkg/backup.Builder (#1593)
Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-06-21 17:08:08 -04:00
Steve Kriss 0d326a3903 remove unused hasControllerOwner func and tests
Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-06-21 11:44:13 -06:00
Steve Kriss d421fcd85c initial structure for refactored pkg/restore tests
Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-06-21 09:15:18 -06:00
Anshul Chandra 4e12b08953 Validate restore name label length
Velero should handle cases when the label length exceeds 63 characters.

- if the length of the backup/restore name is <= 63 characters, use it as the value of the label
- if it's > 63 characters, take the SHA256 hash of the name. the value of
  the label will be the first 57 characters of the backup/restore name
  plus the first six characters of the SHA256 hash.

Fixes heptio#1021

Signed-off-by: Anshul Chandra <anshulc@vmware.com>
2019-05-01 10:25:11 -07:00
Steve Kriss 3155bb159f remove VolumeBackupInfo from API pkg (#1388)
Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-04-24 13:16:03 -07:00
Steve Kriss 5bc6695109 move RestoreResult from api to pkg/restore, rename to Result
Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-04-16 12:57:02 -06:00
Steve Kriss c59544cb79 remove backup.status.volumeBackups and all related code
Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-04-15 10:17:40 -06:00
Steve Kriss 892673816b remove legacy restore label
Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-04-15 10:17:03 -06:00
Steve Kriss 77e648eafa remove Ark field from RestoreResult
Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-04-15 10:17:02 -06:00
sseago a519547efc Adds support for allowing a RestoreItemAction to skip item restore (#1336)
* Adds support for allowing a RestoreItemAction to skip item restore

This allows a RestoreItemAction plugin to signal to velero that
the returned item should be skipped rather than restored to the
cluster.

To support this, a boolean SkipRestore attribute is added to
RestoreItemActionExecuteOutput. If restore.restoreResource finds
this set to true, any remaining actions on this item are skipped,
and restore on this item is skipped. Execution continues with
the next item of this resource type.

To signal this for a particular item, the RestoreItemAction's
Execute method should call WithoutRestore() on the
RestoreItemActionExecuteOutput before returning it.

Signed-off-by: Scott Seago <sseago@redhat.com>

* Autogenerated code to support SkipRestore

Signed-off-by: Scott Seago <sseago@redhat.com>

* Added changelog for #1336

Signed-off-by: Scott Seago <sseago@redhat.com>
2019-04-04 13:39:54 -06:00
Steve Kriss 7298a4eda0 allow restic restore helper image to be specified via ConfigMap (#1311)
* allow restic restore helper image to be specified via ConfigMap

Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-03-29 17:11:34 -04:00
Steve Kriss a696cd09f2 remove Warning from restore item action output (#1318)
Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-03-28 13:08:37 -07:00
Steve Kriss 9b635c0e14 add additionalItems to restore item actions (#1304)
* add additionalItems to restore item actions

Signed-off-by: Steve Kriss <krisss@vmware.com>
Co-authored-by: Andy Goldstein <goldsteina@vmware.com>
2019-03-28 12:21:56 -07:00
Steve Kriss bb9c3f6a1a rename BlockStore to VolumeSnapshotter
Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-03-27 14:55:28 -06:00
Steve Kriss a111eed2af update license headers to Velero contributors (#1302)
Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-03-20 12:32:48 -07:00
KubeKween 73514a003b Move plugin interfaces to same package (#1264)
* Move plugin interfaces to same package

Signed-off-by: Carlisia <carlisiac@vmware.com>
2019-03-14 16:35:06 -04:00
Nolan Brubaker 394548afcd
Merge pull request #1254 from skriss/remove-wait-for-pv
remove restore code that waits for a PV to become Available
2019-03-11 13:20:59 -04:00
KubeKween 4ee41a13a0
Merge pull request #1261 from asaf-erlich/patch-1
Update ark restore to not open every single file open during extracti…
2019-03-08 14:59:09 -08:00
asaf-erlich 4041044a93
Update ark restore to not open every single file open during extraction of the data
Original error was:

```
ark -n <redacted> restore logs <redacted>
time="2019-03-06T18:31:06Z" level=info msg="Not including resource" groupResource=nodes logSource="pkg/restore/restore.go:124"
time="2019-03-06T18:31:06Z" level=info msg="Not including resource" groupResource=events logSource="pkg/restore/restore.go:124"
time="2019-03-06T18:31:06Z" level=info msg="Not including resource" groupResource=events.events.k8s.io logSource="pkg/restore/restore.go:124"
time="2019-03-06T18:31:06Z" level=info msg="Not including resource" groupResource=backups.ark.heptio.com logSource="pkg/restore/restore.go:124"
time="2019-03-06T18:31:06Z" level=info msg="Not including resource" groupResource=restores.ark.heptio.com logSource="pkg/restore/restore.go:124"
time="2019-03-06T18:31:06Z" level=info msg="Starting restore of backup backup/<redacted>" logSource="pkg/restore/restore.go:342"
time="2019-03-06T18:31:06Z" level=info msg="error unzipping and extracting: open /tmp/604421455/resources/rolebindings.rbac.authorization.k8s.io/namespaces/<redacted>/<redacted>: too many open files" logSource="pkg/restore/restore.go:346"
```

Downloading the directory from s3 and untarring it I found 1036 files. The ulimit -n output says 1024. This is our team's best guess at a root cause. But the code fixed in the PR definitely is holding all the files open until the method closes: https://blog.learngoprogramming.com/gotchas-of-defer-in-go-1-8d070894cb01

Please note my go code abilities are not great and I did not test this. I just edited the file in github. All I did was remove the defer and put fileClose after the copy is done. Theoretically this should only hold one file open at a time now. Let me know if you want me to do any further steps.

Thank you,
-Asaf

Signed-off-by: Asaf Erlich <aerlich@groupon.com>
2019-03-07 11:23:35 -05:00
Michal Wieczorek 1354e2b6ff
Add original item to restore plugin interface
Signed-off-by: Michal Wieczorek <wieczorek-michal@wp.pl>
2019-03-05 17:09:42 -08:00
Steve Kriss e29aa74a23 remove restore code that waits for a PV to become Available
Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-03-05 17:04:52 -07:00
Nolan Brubaker ce3f43e876
Merge pull request #1251 from skriss/backup-extractor
move backup extraction logic to its own type
2019-03-05 16:37:48 -05:00
Steve Kriss 88e6a740f2 move pvRestorer and tests to their own files
Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-03-01 15:07:25 -07:00
Steve Kriss 0fec56f488 move backup extraction logic to its own type
Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-03-01 15:05:58 -07:00
Nolan Brubaker fcf21813a5
Merge pull request #1246 from skriss/preserve-storageclass
when restoring a PV, don't remove its spec.storageClassName
2019-02-28 18:02:20 -05:00
Steve Kriss 21c57c46b3 when restoring a PV, don't remove its spec.storageClassName
Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-02-28 14:34:36 -07:00
Steve Kriss 780dc4551f fix compile err & test
Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-02-11 16:45:04 -07:00
Steve Kriss 32835c63f6 code review feedback
Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-02-11 16:21:49 -07:00
Steve Kriss 86c5c25d13 code review: remove obsolete commented code
Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-02-11 16:21:49 -07:00
Steve Kriss d8e9b772ff move MergeMaps func into pkg/restore where it's used
Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-02-11 16:21:48 -07:00
Steve Kriss 38ad7d71f5 pkg/restore: remove usage of pkg/util/collections
Signed-off-by: Steve Kriss <krisss@vmware.com>
2019-02-11 16:20:41 -07:00
KubeKween 378011baf6
Merge pull request #1153 from daved/fix/1142-restore_log
Clarify conditional nature of restore in log
2019-02-11 09:22:25 -08:00
Daved b2b1ee44ea Clarify restore log when object unchanged
Signed-off-by: Daved <daved@codemodus.com>
2019-02-11 09:12:07 -08:00
Nolan Brubaker 890202f2e4 Wait for PV/namespace to delete before restore
If a PV already exists, wait for it, it's associated PVC, and associated
namespace to be deleted before attempting to restore it.

If a namespace already exists, wait for it to be deleted before
attempting to restore it.

Signed-off-by: Nolan Brubaker <brubakern@vmware.com>
2019-02-06 15:43:50 -05:00
Nolan Brubaker 43714caaec Rename Ark to Velero!!!
Signed-off-by: Nolan Brubaker <brubakern@vmware.com>
2019-02-04 17:35:22 -05:00
Andy Goldstein 62d8c642d2
Remove default token from all service accounts
Instead of only removing the default token from a service account when
it already exists in the cluster, always remove it. If the service
account already exists, continue to do the merging logic.

Signed-off-by: Andy Goldstein <andy.goldstein@gmail.com>
2018-12-04 11:41:18 -05:00
Michal Wieczorek 43cd2ca36f Delete spec.priority in pod restore action
Signed-off-by: Michal Wieczorek <wieczorek-michal@wp.pl>
2018-11-22 09:54:49 +01:00
Steve Kriss 449cac5806
Merge pull request #1032 from mwieczorek/plugins
Move clearing up of metadata before plugin's actions
2018-11-08 12:00:33 -07:00
Andy Goldstein 3788014552
Fix check for non-found PV
We were checking for nil, but were getting back an empty
*unstructured.Unstructured{} instead, along with a NotFound error.
Change the logic to check for the NotFound error instead of a nil
object.

Signed-off-by: Andy Goldstein <andy.goldstein@gmail.com>
2018-11-08 10:56:14 -05:00
Michal Wieczorek 7abe115674 Move clearing up of metadata before plugin's actions
Signed-off-by: Michal Wieczorek <wieczorek-michal@wp.pl>
2018-11-02 09:56:33 +01:00
Nolan Brubaker 6231aaa875 Verify PV doesn't exist before creating new volume
Signed-off-by: Nolan Brubaker <nolan@heptio.com>
2018-10-30 13:57:00 -04:00
Steve Kriss 195e6aaf00 fix bug preventing PV snapshots from v0.10 backups from restoring
Signed-off-by: Steve Kriss <steve@heptio.com>
2018-10-23 12:44:05 -06:00
Andy Goldstein bca585162f Run 'make update' to update formatting
Signed-off-by: Andy Goldstein <andy.goldstein@gmail.com>
2018-10-23 13:08:42 -04:00
Steve Kriss 90d9be59d3 support restoring/deleting legacy backups with .status.volumeBackups
Signed-off-by: Steve Kriss <steve@heptio.com>
2018-10-23 09:55:40 -06:00
Wayne Witzel III 406b50a71b update restore process using snapshot locations
Signed-off-by: Wayne Witzel III <wayne@riotousliving.com>
2018-10-17 13:40:42 -06:00
Steve Kriss 38e86ceff5 pod restore action: check initContainers exist before processing
Signed-off-by: Steve Kriss <steve@heptio.com>
2018-10-11 13:44:02 -06:00
KubeKween d579784692
Merge pull request #910 from james-powis/fix_restic_restore_service_user_token
Drop volumes matching name ServiceAccountName-token-
2018-10-09 11:32:23 -07:00
James Powis 30369c2ad5 Drop volumeMounts from initContainers if SAToken
Signed-off-by: James Powis <powisj@gmail.com>
2018-10-05 16:00:58 -06:00
Steve Kriss d009163b67 update restic to support multiple backup storage locations
Signed-off-by: Steve Kriss <steve@heptio.com>
2018-10-05 09:10:35 -06:00
Steve Kriss 0c88eefc0d bug: fix restic restores when using namespace mappings
Signed-off-by: Steve Kriss <steve@heptio.com>
2018-10-03 08:09:55 -06:00
Michal Wieczorek 0f1c5c283f Enable restoring resources with ownerReference set
Signed-off-by: Michal Wieczorek <wieczorek-michal@wp.pl>
2018-10-02 12:04:51 +02:00
KubeKween 94b8fae15a
Merge pull request #891 from skriss/fix-restore-logs
remove restore log helper for accurate line #'s
2018-10-01 21:02:17 -07:00
Steve Kriss 729a688b36 remove restore log helper for accurate line #'s
Signed-off-by: Steve Kriss <steve@heptio.com>
2018-09-30 14:45:32 -06:00
ffd2subroutine 9fdf85130a Minor code cleanup
Signed-off-by: ffd2subroutine <ffd2subroutine@users.noreply.github.com>
2018-09-30 20:43:11 +02:00
Shubheksha Jalan e3222a9e3f move code dealing with node ports into a separate function
Signed-off-by: Shubheksha Jalan <jshubheksha@gmail.com>
2018-09-25 18:08:57 +05:30
Shubheksha Jalan d95b18bad8 ignore spec.ports not being there for services of type ExternalName
Signed-off-by: Shubheksha Jalan <jshubheksha@gmail.com>
2018-09-25 01:35:13 +05:30
Shubheksha Jalan 907a9fbdd8 fix error during restore when spec.ports are not found
Signed-off-by: Shubheksha Jalan <jshubheksha@gmail.com>
2018-09-25 01:02:47 +05:30
James Powis a5cb2ce4b7 Change from regex matching default-token to prefix SA-token-
Signed-off-by: James Powis <powisj@gmail.com>
2018-09-19 13:06:10 -06:00
Steve Kriss 8a5d6f9111
Merge pull request #781 from nrb/fix-777
Fix map merging logic
2018-08-22 11:29:02 -07:00
Nolan Brubaker ea50ebf2b5 Fix map merging logic
Fixes #777

Signed-off-by: Nolan Brubaker <nolan@heptio.com>
2018-08-21 15:30:30 -04:00
Nolan Brubaker 65cd5c602f
Merge pull request #754 from skriss/namespace-restore-label
update how we label restored objects
2018-08-09 15:17:50 -04:00
Steve Kriss 95b2b90006 add backup name label to restored objects
Signed-off-by: Steve Kriss <steve@heptio.com>
2018-08-08 16:51:33 -07:00
Steve Kriss 0c3ac67b6d start using a namespaced label on restored objects, deprecate old label
Signed-off-by: Steve Kriss <steve@heptio.com>
2018-08-08 16:34:39 -07:00
Steve Kriss 1f7a4a1665
Merge pull request #712 from timoreimann/preserve-node-ports-when-specified-in-annotation
Preserve node ports during restore when annotations hold specification.
2018-08-07 09:17:27 -07:00
Timo Reimann 3aa241a74c Preserve node ports during restore when annotations hold specification.
This is to better reflect the intent of the user when node ports are
specified explicitly (as opposed to being assigned by Kubernetes). The
`last-applied-configuration` annotation added by `kubectl apply` is one
such indicator we are now leveraging.

We still default to omitting the node ports when the annotation is
missing.

Signed-off-by: Timo Reimann <ttr314@googlemail.com>
2018-08-07 07:47:17 +02:00
Steve Kriss 1c26fbde32 remove SnapshotService, replace with direct BlockStore usage
Signed-off-by: Steve Kriss <steve@heptio.com>
2018-07-31 08:58:11 -07:00
Andy Goldstein 130512187a Refactor plugin management
Refactor plugin management:
- support multiple plugins per executable
- support restarting a plugin process in the event it terminates
- simplify plugin lifecycle management by using separate managers for
  each scope (server vs backup vs restore)

Signed-off-by: Andy Goldstein <andy.goldstein@gmail.com>
2018-07-31 08:34:57 -07:00
Steve Kriss 795dc26214 replace pkg/restore's osFileSystem with pkg/util/filesystem's
Signed-off-by: Steve Kriss <steve@heptio.com>
2018-07-05 15:46:17 -07:00
Andy Goldstein 255a991c6e Stop restoring mirror pods
Mirror pods are pods created from static manifest files on a node.
They're mirrored to the apiserver so they're visible when querying the
apiserver for a list of pods, but it's not possible to send a pod
containing the mirror pod annotation to the apiserver and have it be
created successfully. Instead of trying to do this, log a message that
we're skipping restoring the pod because it's a mirror pod.

Signed-off-by: Andy Goldstein <andy.goldstein@gmail.com>
2018-06-28 10:06:55 -04:00
Andy Goldstein 7c283e5de8 Skip reclaim policy Delete PVs without snapshots
If a PV has a reclaim policy of Delete and we didn't create a snapshot
of it, don't restore the PV, as doing so would create a PV whose
underlying volume is incorrect.

Also "reset" any PVCs bound to the PV so they'll be dynamically
provisioned when restored.

Signed-off-by: Andy Goldstein <andy.goldstein@gmail.com>
2018-06-26 10:40:49 -04:00
Steve Kriss 01b5828ee7
Merge pull request #403 from nrb/merge-serviceaccount-secrets
Merge serviceaccounts on restore
2018-06-15 09:46:26 -07:00
Nolan Brubaker e7d00cf5fd Add merge support for serviceaccounts
All properties from a backup will be merged into the ServiceAccount
except for the default token secret.

Signed-off-by: Nolan Brubaker <nolan@heptio.com>
2018-06-15 12:40:59 -04:00
Steve Kriss d7134b1df2 use Ark version as the tag for the restore-helper image in init container
Signed-off-by: Steve Kriss <steve@heptio.com>
2018-06-11 10:46:10 -07:00
Steve Kriss 81520a9b86 rename restic-init-container to ark-restic-restore-helper
Signed-off-by: Steve Kriss <steve@heptio.com>
2018-06-11 10:24:23 -07:00
Steve Kriss 67b40c7fc8 use fake filesystem to test key file flag for ark restic init-repo
Signed-off-by: Steve Kriss <steve@heptio.com>
2018-06-07 10:29:59 -07:00
Steve Kriss 50d4084fac add restic integration for doing pod volume backups/restores
Signed-off-by: Steve Kriss <steve@heptio.com>
2018-06-06 09:48:10 -07:00
Nolan Brubaker f936c55a37 Consolidate commonly used GroupResource objects
Signed-off-by: Nolan Brubaker <nolan@heptio.com>
2018-05-15 15:55:15 -04:00