Skip to content

Commit 9268d28

Browse files
feat: [google-cloud-gke-backup] add fine-grained restore (#12711)
- [ ] Regenerate this pull request now. BEGIN_COMMIT_OVERRIDE feat: add fine-grained restore feat: add volume restore flexibility feat: add restore order feat: add strict-permissive mode feat: add gitops docs: update duration comment to include new validation from smart scheduling END_COMMIT_OVERRIDE PiperOrigin-RevId: 635316968 Source-Link: googleapis/googleapis@bcaed39 Source-Link: googleapis/googleapis-gen@611b3e4 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWdrZS1iYWNrdXAvLk93bEJvdC55YW1sIiwiaCI6IjYxMWIzZTRmNzU0ZWMyMGQyNjhhZDk3M2JhNDVjMzgzNzEwNTlkMTMifQ== --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent e7a6a8c commit 9268d28

8 files changed

Lines changed: 424 additions & 8 deletions

File tree

packages/google-cloud-gke-backup/google/cloud/gke_backup/__init__.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
NamespacedName,
3434
NamespacedNames,
3535
Namespaces,
36+
VolumeTypeEnum,
3637
)
3738
from google.cloud.gke_backup_v1.types.gkebackup import (
3839
CreateBackupPlanRequest,
@@ -69,7 +70,12 @@
6970
UpdateRestorePlanRequest,
7071
UpdateRestoreRequest,
7172
)
72-
from google.cloud.gke_backup_v1.types.restore import Restore, RestoreConfig
73+
from google.cloud.gke_backup_v1.types.restore import (
74+
ResourceSelector,
75+
Restore,
76+
RestoreConfig,
77+
VolumeDataRestorePolicyOverride,
78+
)
7379
from google.cloud.gke_backup_v1.types.restore_plan import RestorePlan
7480
from google.cloud.gke_backup_v1.types.volume import VolumeBackup, VolumeRestore
7581

@@ -84,6 +90,7 @@
8490
"NamespacedName",
8591
"NamespacedNames",
8692
"Namespaces",
93+
"VolumeTypeEnum",
8794
"CreateBackupPlanRequest",
8895
"CreateBackupRequest",
8996
"CreateRestorePlanRequest",
@@ -117,8 +124,10 @@
117124
"UpdateBackupRequest",
118125
"UpdateRestorePlanRequest",
119126
"UpdateRestoreRequest",
127+
"ResourceSelector",
120128
"Restore",
121129
"RestoreConfig",
130+
"VolumeDataRestorePolicyOverride",
122131
"RestorePlan",
123132
"VolumeBackup",
124133
"VolumeRestore",

packages/google-cloud-gke-backup/google/cloud/gke_backup_v1/__init__.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,13 @@
2121
from .services.backup_for_gke import BackupForGKEAsyncClient, BackupForGKEClient
2222
from .types.backup import Backup
2323
from .types.backup_plan import BackupPlan, ExclusionWindow, RpoConfig
24-
from .types.common import EncryptionKey, NamespacedName, NamespacedNames, Namespaces
24+
from .types.common import (
25+
EncryptionKey,
26+
NamespacedName,
27+
NamespacedNames,
28+
Namespaces,
29+
VolumeTypeEnum,
30+
)
2531
from .types.gkebackup import (
2632
CreateBackupPlanRequest,
2733
CreateBackupRequest,
@@ -57,7 +63,12 @@
5763
UpdateRestorePlanRequest,
5864
UpdateRestoreRequest,
5965
)
60-
from .types.restore import Restore, RestoreConfig
66+
from .types.restore import (
67+
ResourceSelector,
68+
Restore,
69+
RestoreConfig,
70+
VolumeDataRestorePolicyOverride,
71+
)
6172
from .types.restore_plan import RestorePlan
6273
from .types.volume import VolumeBackup, VolumeRestore
6374

@@ -100,6 +111,7 @@
100111
"NamespacedNames",
101112
"Namespaces",
102113
"OperationMetadata",
114+
"ResourceSelector",
103115
"Restore",
104116
"RestoreConfig",
105117
"RestorePlan",
@@ -109,5 +121,7 @@
109121
"UpdateRestorePlanRequest",
110122
"UpdateRestoreRequest",
111123
"VolumeBackup",
124+
"VolumeDataRestorePolicyOverride",
112125
"VolumeRestore",
126+
"VolumeTypeEnum",
113127
)

packages/google-cloud-gke-backup/google/cloud/gke_backup_v1/types/__init__.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@
1515
#
1616
from .backup import Backup
1717
from .backup_plan import BackupPlan, ExclusionWindow, RpoConfig
18-
from .common import EncryptionKey, NamespacedName, NamespacedNames, Namespaces
18+
from .common import (
19+
EncryptionKey,
20+
NamespacedName,
21+
NamespacedNames,
22+
Namespaces,
23+
VolumeTypeEnum,
24+
)
1925
from .gkebackup import (
2026
CreateBackupPlanRequest,
2127
CreateBackupRequest,
@@ -51,7 +57,12 @@
5157
UpdateRestorePlanRequest,
5258
UpdateRestoreRequest,
5359
)
54-
from .restore import Restore, RestoreConfig
60+
from .restore import (
61+
ResourceSelector,
62+
Restore,
63+
RestoreConfig,
64+
VolumeDataRestorePolicyOverride,
65+
)
5566
from .restore_plan import RestorePlan
5667
from .volume import VolumeBackup, VolumeRestore
5768

@@ -64,6 +75,7 @@
6475
"NamespacedName",
6576
"NamespacedNames",
6677
"Namespaces",
78+
"VolumeTypeEnum",
6779
"CreateBackupPlanRequest",
6880
"CreateBackupRequest",
6981
"CreateRestorePlanRequest",
@@ -97,8 +109,10 @@
97109
"UpdateBackupRequest",
98110
"UpdateRestorePlanRequest",
99111
"UpdateRestoreRequest",
112+
"ResourceSelector",
100113
"Restore",
101114
"RestoreConfig",
115+
"VolumeDataRestorePolicyOverride",
102116
"RestorePlan",
103117
"VolumeBackup",
104118
"VolumeRestore",

packages/google-cloud-gke-backup/google/cloud/gke_backup_v1/types/backup.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,14 @@ class Backup(proto.Message):
171171
config_backup_size_bytes (int):
172172
Output only. The size of the config backup in
173173
bytes.
174+
permissive_mode (bool):
175+
Output only. If false, Backup will fail when Backup for GKE
176+
detects Kubernetes configuration that is non-standard or
177+
requires additional setup to restore.
178+
179+
Inherited from the parent BackupPlan's
180+
[permissive_mode][google.cloud.gkebackup.v1.BackupPlan.BackupConfig.permissive_mode]
181+
value.
174182
"""
175183

176184
class State(proto.Enum):
@@ -387,6 +395,10 @@ class ClusterMetadata(proto.Message):
387395
proto.INT64,
388396
number=27,
389397
)
398+
permissive_mode: bool = proto.Field(
399+
proto.BOOL,
400+
number=28,
401+
)
390402

391403

392404
__all__ = tuple(sorted(__protobuf__.manifest))

packages/google-cloud-gke-backup/google/cloud/gke_backup_v1/types/backup_plan.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,13 @@ class BackupConfig(proto.Message):
313313
314314
Default (empty): Config backup artifacts will
315315
not be encrypted.
316+
permissive_mode (bool):
317+
Optional. If false, Backups will fail when
318+
Backup for GKE detects Kubernetes configuration
319+
that is non-standard or requires additional
320+
setup to restore.
321+
322+
Default: False
316323
"""
317324

318325
all_namespaces: bool = proto.Field(
@@ -345,6 +352,10 @@ class BackupConfig(proto.Message):
345352
number=6,
346353
message=common.EncryptionKey,
347354
)
355+
permissive_mode: bool = proto.Field(
356+
proto.BOOL,
357+
number=7,
358+
)
348359

349360
name: str = proto.Field(
350361
proto.STRING,
@@ -474,9 +485,10 @@ class ExclusionWindow(proto.Message):
474485
Required. Specifies the start time of the
475486
window using time of the day in UTC.
476487
duration (google.protobuf.duration_pb2.Duration):
477-
Required. Specifies duration of the window. Restrictions for
478-
duration based on the recurrence type to allow some time for
479-
backup to happen:
488+
Required. Specifies duration of the window. Duration must be
489+
>= 5 minutes and < (target RPO - 20 minutes). Additional
490+
restrictions based on the recurrence type to allow some time
491+
for backup to happen:
480492
481493
- single_occurrence_date: no restriction, but UI may warn
482494
about this when duration >= target RPO

packages/google-cloud-gke-backup/google/cloud/gke_backup_v1/types/common.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"NamespacedName",
2727
"NamespacedNames",
2828
"EncryptionKey",
29+
"VolumeTypeEnum",
2930
},
3031
)
3132

@@ -98,4 +99,20 @@ class EncryptionKey(proto.Message):
9899
)
99100

100101

102+
class VolumeTypeEnum(proto.Message):
103+
r"""Message to encapsulate VolumeType enum."""
104+
105+
class VolumeType(proto.Enum):
106+
r"""Supported volume types.
107+
108+
Values:
109+
VOLUME_TYPE_UNSPECIFIED (0):
110+
Default
111+
GCE_PERSISTENT_DISK (1):
112+
Compute Engine Persistent Disk volume
113+
"""
114+
VOLUME_TYPE_UNSPECIFIED = 0
115+
GCE_PERSISTENT_DISK = 1
116+
117+
101118
__all__ = tuple(sorted(__protobuf__.manifest))

0 commit comments

Comments
 (0)