Skip to content
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

correct delta_pre_compare for DBInstance #109

Merged
merged 1 commit into from
Aug 13, 2022

Conversation

jaypipes
Copy link
Collaborator

@jaypipes jaypipes commented Aug 13, 2022

In PR #95, we added a customPreCompare function to
pkg/resource/db_instance/hooks.go and changed the generator.yaml to
use a code snippet instead of the
templates/hooks/db_instance/delta_pre_compare.go.tpl template file.
However, we did not delete the
templates/hooks/db_instance/delta_pre_compare.go.tpl file and when I
went to do the updating DB instance tags patch, nobody noticed that I
had added a call to compareTags into the (now-unused) template file.
This meant that compareTags is never called which means changes to
tags were not being properly on DBInstance resources.

This patch moves all the custom code for delta pre-checks back into the
template file and gets rid of the custom code snippet in generator.yaml,
consolidating all this logic into the template file.

Issue: aws-controllers-k8s/community#1276

Signed-off-by: Jay Pipes jaypipes@gmail.com

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.

@jaypipes jaypipes requested review from a-hilaly and brucegucode and removed request for RedbackThomson August 13, 2022 17:38
Copy link
Member

@a-hilaly a-hilaly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@a-hilaly
Copy link
Member

e2e test failure is normal here, should be fixed in #108

@a-hilaly
Copy link
Member

gopkg.in is struggling a lot lately..

@a-hilaly
Copy link
Member

/test rds-unit-test

In PR aws-controllers-k8s#95, we added a `customPreCompare` function to
`pkg/resource/db_instance/hooks.go` and changed the `generator.yaml` to
use a code snippet instead of the
`templates/hooks/db_instance/delta_pre_compare.go.tpl` template file.
However, we did not delete the
`templates/hooks/db_instance/delta_pre_compare.go.tpl` file and when I
went to do the updating DB instance tags patch, mobody noticed that I
had added a call to `compareTags` into the (now-unused) template file.
This meant that `compareTags` is never called which means changes to
tags were not being properly on DBInstance resources.

This patch moves all the custom code for delta pre-checks back into the
template file and gets rid of the custom code snippet in generator.yaml,
consolidating all this logic into the template file.

Signed-off-by: Jay Pipes <jaypipes@gmail.com>
@@ -197,7 +198,7 @@ def test_crud_postgres14_t3_micro(
k8s.patch_custom_resource(ref, updates)
time.sleep(MODIFY_WAIT_AFTER_SECONDS)

latest_tags = db_instance.get_tags(arn)
latest_tags = tag.clean(db_instance.get_tags(arn))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. Merging since the test failures are not accurate.
/lgtm

@ack-bot ack-bot added the lgtm Indicates that a PR is ready to be merged. label Aug 13, 2022
@ack-bot
Copy link
Collaborator

ack-bot commented Aug 13, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: A-Hilaly, jaypipes

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@a-hilaly
Copy link
Member

/test rds-unit-test

@ack-bot
Copy link
Collaborator

ack-bot commented Aug 13, 2022

@jaypipes: The following tests failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
rds-kind-e2e 647df8e link /test rds-kind-e2e
rds-unit-test 647df8e link /test rds-unit-test

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@a-hilaly
Copy link
Member

Looks like gopkg.in/yaml.v2 is having some issues. Tracking the problem here niemeyer/gopkg#78

@a-hilaly a-hilaly merged commit 10ddefd into aws-controllers-k8s:main Aug 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants