Skip to content

Commit 28b3dc8

Browse files
authored
Add support for RestoreDBClusterToPointInTime (#194)
Issue #, if available: aws-controllers-k8s/community#1665 Description of changes: This PR add support for restoring a `DBCluster` from another cluster, and specifying the type and time for the restore. It follows the same approach used for restoring a `DBCluster` from a snapshot in #101
1 parent 3f783e0 commit 28b3dc8

14 files changed

+1108
-25
lines changed
+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
ack_generate_info:
2-
build_date: "2024-08-29T17:12:38Z"
2+
build_date: "2024-09-02T17:25:38Z"
33
build_hash: f8f98563404066ac3340db0a049d2e530e5c51cc
44
go_version: go1.22.5
55
version: v0.38.1
6-
api_directory_checksum: 721d07f7f5c29de8a1c65268e497be355ee1b3fd
6+
api_directory_checksum: c6892f99dde0bc4fbc875f328cf37ededd376229
77
api_version: v1alpha1
88
aws_sdk_go_version: v1.44.232
99
generator_config_info:
10-
file_checksum: 02d67bd678a59333a653acc2a27ac01e64619ef3
10+
file_checksum: 4f7799d67888347f8993c5b20512bd2044a375a9
1111
original_file_name: generator.yaml
1212
last_modification:
1313
reason: API generation

apis/v1alpha1/db_cluster.go

+51
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/v1alpha1/generator.yaml

+18-2
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,22 @@ resources:
131131
from:
132132
operation: RestoreDBClusterFromSnapshot
133133
path: SnapshotIdentifier
134+
SourceDBClusterIdentifier:
135+
from:
136+
operation: RestoreDBClusterToPointInTime
137+
path: SourceDBClusterIdentifier
138+
RestoreType:
139+
from:
140+
operation: RestoreDBClusterToPointInTime
141+
path: RestoreType
142+
RestoreToTime:
143+
from:
144+
operation: RestoreDBClusterToPointInTime
145+
path: RestoreToTime
146+
UseLatestRestorableTime:
147+
from:
148+
operation: RestoreDBClusterToPointInTime
149+
path: UseLatestRestorableTime
134150
Tags:
135151
compare:
136152
# We have a custom comparison function...
@@ -180,7 +196,7 @@ resources:
180196
from:
181197
operation: ModifyDBClusterParameterGroup
182198
path: Parameters
183-
documentation: DEPRECATED - do not use. Prefer ParameterOverrides instead.
199+
documentation: DEPRECATED - do not use. Prefer ParameterOverrides instead.
184200
ParameterOverrides:
185201
custom_field:
186202
# Map keys are the parameter name and the values are the parameter value.
@@ -399,7 +415,7 @@ resources:
399415
- DBSubnetGroupDoesNotCoverEnoughAZs
400416
- InvalidSubnet
401417
- InvalidParameter
402-
- SubnetAlreadyInUse
418+
- SubnetAlreadyInUse
403419
hooks:
404420
sdk_read_many_post_set_output:
405421
template_path: hooks/db_subnet_group/sdk_read_many_post_set_output.go.tpl

apis/v1alpha1/zz_generated.deepcopy.go

+19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/rds.services.k8s.aws_dbclusters.yaml

+78
Original file line numberDiff line numberDiff line change
@@ -1028,6 +1028,59 @@ spec:
10281028
this DB cluster is created as a read replica.
10291029
10301030
1031+
Valid for: Aurora DB clusters and Multi-AZ DB clusters
1032+
type: string
1033+
restoreToTime:
1034+
description: |-
1035+
The date and time to restore the DB cluster to.
1036+
1037+
1038+
Valid Values: Value must be a time in Universal Coordinated Time (UTC) format
1039+
1040+
1041+
Constraints:
1042+
1043+
1044+
* Must be before the latest restorable time for the DB instance
1045+
1046+
1047+
* Must be specified if UseLatestRestorableTime parameter isn't provided
1048+
1049+
1050+
* Can't be specified if the UseLatestRestorableTime parameter is enabled
1051+
1052+
1053+
* Can't be specified if the RestoreType parameter is copy-on-write
1054+
1055+
1056+
Example: 2015-03-07T23:45:00Z
1057+
1058+
1059+
Valid for: Aurora DB clusters and Multi-AZ DB clusters
1060+
format: date-time
1061+
type: string
1062+
restoreType:
1063+
description: |-
1064+
The type of restore to be performed. You can specify one of the following
1065+
values:
1066+
1067+
1068+
* full-copy - The new DB cluster is restored as a full copy of the source
1069+
DB cluster.
1070+
1071+
1072+
* copy-on-write - The new DB cluster is restored as a clone of the source
1073+
DB cluster.
1074+
1075+
1076+
Constraints: You can't specify copy-on-write if the engine version of the
1077+
source DB cluster is earlier than 1.11.
1078+
1079+
1080+
If you don't specify a RestoreType value, then the new DB cluster is restored
1081+
as a full copy of the source DB cluster.
1082+
1083+
10311084
Valid for: Aurora DB clusters and Multi-AZ DB clusters
10321085
type: string
10331086
scalingConfiguration:
@@ -1084,6 +1137,19 @@ spec:
10841137
* Must match the identifier of an existing Snapshot.
10851138
10861139
1140+
Valid for: Aurora DB clusters and Multi-AZ DB clusters
1141+
type: string
1142+
sourceDBClusterIdentifier:
1143+
description: |-
1144+
The identifier of the source DB cluster from which to restore.
1145+
1146+
1147+
Constraints:
1148+
1149+
1150+
* Must match the identifier of an existing DBCluster.
1151+
1152+
10871153
Valid for: Aurora DB clusters and Multi-AZ DB clusters
10881154
type: string
10891155
sourceRegion:
@@ -1138,6 +1204,18 @@ spec:
11381204
type: string
11391205
type: object
11401206
type: array
1207+
useLatestRestorableTime:
1208+
description: |-
1209+
A value that indicates whether to restore the DB cluster to the latest restorable
1210+
backup time. By default, the DB cluster isn't restored to the latest restorable
1211+
backup time.
1212+
1213+
1214+
Constraints: Can't be specified if RestoreToTime parameter is provided.
1215+
1216+
1217+
Valid for: Aurora DB clusters and Multi-AZ DB clusters
1218+
type: boolean
11411219
vpcSecurityGroupIDs:
11421220
description: |-
11431221
A list of EC2 VPC security groups to associate with this DB cluster.

generator.yaml

+18-2
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,22 @@ resources:
131131
from:
132132
operation: RestoreDBClusterFromSnapshot
133133
path: SnapshotIdentifier
134+
SourceDBClusterIdentifier:
135+
from:
136+
operation: RestoreDBClusterToPointInTime
137+
path: SourceDBClusterIdentifier
138+
RestoreType:
139+
from:
140+
operation: RestoreDBClusterToPointInTime
141+
path: RestoreType
142+
RestoreToTime:
143+
from:
144+
operation: RestoreDBClusterToPointInTime
145+
path: RestoreToTime
146+
UseLatestRestorableTime:
147+
from:
148+
operation: RestoreDBClusterToPointInTime
149+
path: UseLatestRestorableTime
134150
Tags:
135151
compare:
136152
# We have a custom comparison function...
@@ -180,7 +196,7 @@ resources:
180196
from:
181197
operation: ModifyDBClusterParameterGroup
182198
path: Parameters
183-
documentation: DEPRECATED - do not use. Prefer ParameterOverrides instead.
199+
documentation: DEPRECATED - do not use. Prefer ParameterOverrides instead.
184200
ParameterOverrides:
185201
custom_field:
186202
# Map keys are the parameter name and the values are the parameter value.
@@ -399,7 +415,7 @@ resources:
399415
- DBSubnetGroupDoesNotCoverEnoughAZs
400416
- InvalidSubnet
401417
- InvalidParameter
402-
- SubnetAlreadyInUse
418+
- SubnetAlreadyInUse
403419
hooks:
404420
sdk_read_many_post_set_output:
405421
template_path: hooks/db_subnet_group/sdk_read_many_post_set_output.go.tpl

0 commit comments

Comments
 (0)