-
Notifications
You must be signed in to change notification settings - Fork 20
Add Table
update code path
#30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: A-Hilaly The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
cc124fb
to
a156e26
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty ready. Just found some typos in your diffs, and I have a question regarding re-queueing because of the nature of asynchronous updates.
1e3c998
to
58f4ec0
Compare
/retest all |
@a-hilaly: The
Use In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/test dynamodb-kind-e2e |
generator.yaml
Outdated
is_ignored: true | ||
KeySchema: | ||
compare: | ||
is_immutable: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it necessary to have is_immutable
when is_ignored
is true? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is_immutable
doesn't ignore the field comparison in the generated delta function. The reason I added an is_ignored: true
is that the Dynamodb control plane sorts the KeySchema array, and sometimes causes the controller to reconcile for ever since reflect.DeepEqual
takes in consideration the order to elements. I added a custom equalKeySchemaArrays
function which properly compares the Custom Resource Spec.KeySchema
with the sorted one returned by the dynamodb control plane.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@a-hilaly note that is_immutable
is a configuration on the FieldConfig, not the CompareConfig.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@a-hilaly is_immutable
is a configuration on the FieldConfig, not the CompareConfig, so this is being ignored entirely...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're I brain lagged here. Addressed
a95deaf
to
5ff5e02
Compare
@a-hilaly you want to rebase this and get it going again? |
@a-hilaly where are we with this? |
Issues go stale after 90d of inactivity. |
Stale issues rot after 30d of inactivity. |
Rotten issues close after 30d of inactivity. |
@ack-bot: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/reopen |
@jaypipes @Julian-Chu rebased and pushed latest changes PTAL |
ffcbe1b
to
a048d49
Compare
/retest |
de4670c
to
700ca2a
Compare
// equalGlobalSecondaryIndexesArrays returns true if two GlobalSecondaryIndex | ||
// arrays are equal regardless of the order of their elements. | ||
func equalGlobalSecondaryIndexesArrays( | ||
a []*v1alpha1.GlobalSecondaryIndex, | ||
b []*v1alpha1.GlobalSecondaryIndex, | ||
) bool { | ||
added, updated, removed := computeGlobalSecondaryIndexDelta(a, b) | ||
return len(added) == 0 && len(updated) == 0 && len(removed) == 0 | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see this function being used anywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is used in customerPreCompare
:
if len(a.ko.Spec.GlobalSecondaryIndexes) != len(b.ko.Spec.GlobalSecondaryIndexes) {
delta.Add("Spec.GlobalSecondaryIndexes", a.ko.Spec.GlobalSecondaryIndexes, b.ko.Spec.GlobalSecondaryIndexes)
} else if a.ko.Spec.GlobalSecondaryIndexes != nil && b.ko.Spec.GlobalSecondaryIndexes != nil {
if !equalGlobalSecondaryIndexesArrays(a.ko.Spec.GlobalSecondaryIndexes, b.ko.Spec.GlobalSecondaryIndexes) {
delta.Add("Spec.GlobalSecondaryIndexes", a.ko.Spec.GlobalSecondaryIndexes, b.ko.Spec.GlobalSecondaryIndexes)
}
}
"github.com/aws-controllers-k8s/dynamodb-controller/apis/v1alpha1" | ||
) | ||
|
||
func computeLocalSecondaryIndexDelta( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are local secondary indexes ever updated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Local secondary indexes can only be set during the CREATE op. They are immutable. computeLocalSecondaryIndexDelta
is used to set a terminal condition if users try to modify them
test/e2e/tests/test_table.py
Outdated
assert self.table_exists(table_name) | ||
|
||
# Get CR latest revision | ||
cr = k8s.wait_resource_consumed_by_controller(ref) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
above tests are great. I don't see where local secondary indexes are ever tested though? or updated...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same reason here. LSIs are only mentioned during the creation, and the API will reject any non-valid LSIs, checking that the table is active is equivalent to checking the LSIs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work on this @a-hilaly. I'm super excited to finally see this getting merged. 👍
Signed-off-by: Amine Hilaly <[email protected]>
/retest |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: A-Hilaly, jaypipes, jljaco The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Issues:
Description of changes:
Table
custom update codeTable
custom preCompare delta code (to properly compareGlobalSecondaryIndexes
,AttributeDefinitions
andKeySchemas
)GlobalSecondaryIndexes
KeySchema
an immutable field.GlobalSecondaryIndexes
when multiple ones areupdate/removed or added.
BillingMode
andSSESpecification
andTableClass
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.