Skip to content

Commit b0b0d59

Browse files
authored
Add Table update code path (#30)
Issues: - aws-controllers-k8s/community#1000 - aws-controllers-k8s/community#1029 - aws-controllers-k8s/community#1596 Description of changes: - Add `Table` custom update code - Add `Table` custom preCompare delta code (to properly compare `GlobalSecondaryIndexes` ,`AttributeDefinitions` and `KeySchemas`) - Add unit tests for custom compare code for `GlobalSecondaryIndexes` - Make `KeySchema` an immutable field. - Gradually update `GlobalSecondaryIndexes` when multiple ones are update/removed or added. - Add custom code to properly populate `BillingMode` and `SSESpecification` and `TableClass` - Add e2e tests for each new support field update + one test to ensure that multi-field updates at once can be properly handled By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 7254006 commit b0b0d59

33 files changed

+2533
-853
lines changed
+6-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
ack_generate_info:
2-
build_date: "2023-03-22T21:33:48Z"
3-
build_hash: fa24753ea8b657d8815ae3eac7accd0958f5f9fb
4-
go_version: go1.19
5-
version: v0.25.0
6-
api_directory_checksum: 553eee36730dd0637424a8d9348b37ee90eb594d
2+
build_date: "2023-04-05T21:37:34Z"
3+
build_hash: a6ae2078e57187b2daf47978bc07bd67072d2cba
4+
go_version: go1.20
5+
version: v0.25.0-1-ga6ae207-dirty
6+
api_directory_checksum: 62a4051ba2ded255ad270b491703d3c14440b2c7
77
api_version: v1alpha1
88
aws_sdk_go_version: v1.44.93
99
generator_config_info:
10-
file_checksum: 8b17e0975b403cc552eba69aec5cd03a30956729
10+
file_checksum: 0b7493aa8cdf19370936a973ed31804875d2dfba
1111
original_file_name: generator.yaml
1212
last_modification:
1313
reason: API generation

apis/v1alpha1/backup.go

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

apis/v1alpha1/generator.yaml

+65-4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
ignore:
2+
field_paths:
3+
# Replica of Spec.BillingMode
4+
- TableDescription.BillingModeSummary
5+
# Replica of Spec.SSESpecification
6+
- TableDescription.SSEDescription
7+
- TableDescription.TableClassSummary
18
operations:
29
UpdateGlobalTable:
310
operation_type: Delete
@@ -8,24 +15,42 @@ operations:
815
resources:
916
Table:
1017
fields:
18+
GlobalSecondaryIndexesDescriptions:
19+
custom_field:
20+
list_of: GlobalSecondaryIndexDescription
21+
is_read_only: true
1122
TimeToLive:
1223
from:
1324
operation: UpdateTimeToLive
1425
path: TimeToLiveSpecification
26+
AttributeDefinitions:
27+
compare:
28+
is_ignored: true
29+
# non modifiable field
30+
KeySchema:
31+
is_immutable: true
32+
compare:
33+
is_ignored: true
34+
GlobalSecondaryIndexes:
35+
compare:
36+
is_ignored: true
1537
Tags:
1638
compare:
1739
is_ignored: true
18-
AttributeDefinitions:
40+
# non modifiable field
41+
LocalSecondaryIndexes:
42+
is_immutable: true
43+
compare:
44+
is_ignored: true
45+
SSESpecification:
1946
compare:
2047
is_ignored: true
2148
exceptions:
2249
errors:
2350
404:
2451
code: ResourceNotFoundException
2552
terminal_codes:
26-
- InternalServerError
27-
- LimitExceededException
28-
- ResourceInUseException
53+
- InvalidParameter
2954
update_operation:
3055
custom_method_name: customUpdateTable
3156
hooks:
@@ -43,6 +68,21 @@ resources:
4368
in:
4469
- ACTIVE
4570
- ARCHIVED
71+
print:
72+
add_age_column: true
73+
add_synced_column: true
74+
additional_columns:
75+
- name: ARN
76+
json_path: .status.ackResourceMetadata.arn
77+
type: string
78+
priority: 1
79+
- name: CLASS
80+
json_path: .spec.tableClass
81+
type: string
82+
priority: 0
83+
- name: STATUS
84+
json_path: .status.tableStatus
85+
type: string
4686
GlobalTable:
4787
exceptions:
4888
errors:
@@ -74,3 +114,24 @@ resources:
74114
in:
75115
- AVAILABLE
76116
- DELETED
117+
print:
118+
add_age_column: true
119+
add_synced_column: true
120+
additional_columns:
121+
- name: ARN
122+
json_path: .status.ackResourceMetadata.arn
123+
type: string
124+
priority: 1
125+
- name: TABLENAME
126+
json_path: .spec.tableName
127+
type: string
128+
priority: 0
129+
- name: TYPE
130+
json_path: .status.backupType
131+
type: string
132+
- name: SIZE
133+
json_path: .status.backupSize
134+
type: string
135+
- name: STATUS
136+
json_path: .status.backupStatus
137+
type: string

apis/v1alpha1/table.go

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

apis/v1alpha1/types.go

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

apis/v1alpha1/zz_generated.deepcopy.go

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

config/crd/bases/dynamodb.services.k8s.aws_backups.yaml

+24-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,30 @@ spec:
1515
singular: backup
1616
scope: Namespaced
1717
versions:
18-
- name: v1alpha1
18+
- additionalPrinterColumns:
19+
- jsonPath: .status.ackResourceMetadata.arn
20+
name: ARN
21+
priority: 1
22+
type: string
23+
- jsonPath: .status.backupSize
24+
name: SIZE
25+
type: string
26+
- jsonPath: .status.backupStatus
27+
name: STATUS
28+
type: string
29+
- jsonPath: .spec.tableName
30+
name: TABLENAME
31+
type: string
32+
- jsonPath: .status.backupType
33+
name: TYPE
34+
type: string
35+
- jsonPath: .status.conditions[?(@.type=="ACK.ResourceSynced")].status
36+
name: Synced
37+
type: string
38+
- jsonPath: .metadata.creationTimestamp
39+
name: Age
40+
type: date
41+
name: v1alpha1
1942
schema:
2043
openAPIV3Schema:
2144
description: Backup is the Schema for the Backups API

0 commit comments

Comments
 (0)