Skip to content

Commit

Permalink
Add data mover params to backup (#1541)
Browse files Browse the repository at this point in the history
* Add data mover params to backup

* add new args to docstring

* Fix

* add backup doc

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* remove duplication

---------

Co-authored-by: Dalia Frank <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Meni Yakove <[email protected]>
  • Loading branch information
4 people authored Jan 4, 2024
1 parent 2a81cc0 commit e741659
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions ocp_resources/backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,34 @@
class Backup(NamespacedResource):
"""
Backup in 'velero' official API:
https://velero.io/docs/v0.7.1/api-types/backup/
https://velero.io/docs/main/api-types/backup/
"""

api_group = NamespacedResource.ApiGroup.VELERO_IO

def __init__(self, included_namespaces=None, excluded_resources=None, **kwargs):
def __init__(
self,
included_namespaces=None,
excluded_resources=None,
snapshot_move_data=False,
storage_location=None,
**kwargs,
):
"""
Args:
included_namespaces (list, optional): Namespaces to include in the backup.
If unspecified, all namespaces are included.
excluded_resources (list, optional): Resources to exclude from the backup.
Resources may be shortcuts (e.g. 'po' for 'pods') or fully-qualified.
snapshot_move_data (bool, optional): If set to true, deploys the volume snapshot mover
controller and a modified CSI Data Mover plugin.
storage_location (string, optional): Define the location for the DataMover.
"""
super().__init__(**kwargs)
self.included_namespaces = included_namespaces
self.excluded_resources = excluded_resources
self.snapshot_move_data = snapshot_move_data
self.storage_location = storage_location

def to_dict(self):
super().to_dict()
Expand All @@ -31,5 +43,9 @@ def to_dict(self):
spec_dict.update({"includedNamespaces": self.included_namespaces})
if self.excluded_resources:
spec_dict.update({"excludedResources": self.excluded_resources})
if self.snapshot_move_data:
spec_dict.update({"snapshotMoveData": self.snapshot_move_data})
if self.storage_location:
spec_dict.update({"storageLocation": self.storage_location})
if spec_dict:
self.res.update({"spec": spec_dict})

0 comments on commit e741659

Please sign in to comment.