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

fix(database): tag-only-change triggers update + add RemoveTag call #1966

Conversation

wotolom
Copy link
Contributor

@wotolom wotolom commented Dec 4, 2023

Description of your changes

for database.RDSInstance:

  • fix isUpToDate() logic to trigger update on tag-only-change (used cache scheme/solution from rds.DBInstance)
  • add RemoveTagsFromResource() from AWS API to update() (removing tags was apparently not possible before...)
  • adapt unit-tests

Fixes #1962

I have:

  • Read and followed Crossplane's [contribution process].
  • Run make reviewable test to ensure this PR is ready for review.

How has this code been tested

manually (update tag-only, update other db parameter)

@wotolom
Copy link
Contributor Author

wotolom commented Dec 4, 2023

I do not really understand, why e.cache behaves here differently then err:

upToDate, diff, e.cache, err := rds.IsUpToDate(ctx, e.kube, cr, instance)

is not possible:

non-name e.cache on left side of :=compiler(BadDecl)

therefore I did this:

var cachecache rds.Cache
upToDate, diff, cachecache, err := rds.IsUpToDate(ctx, e.kube, cr, instance)
e.cache = cachecache

pkg/clients/database/rds.go Outdated Show resolved Hide resolved
pkg/clients/database/rds.go Outdated Show resolved Hide resolved
@MisterMX
Copy link
Collaborator

MisterMX commented Dec 7, 2023

I do not really understand, why e.cache behaves here differently then err:

:= redeclares a new variable which is not possible with e.cache. You have to use = and declare other new variables beforehand if you want to use something like e.cache = rds.IsUpToDate`.

…g call

Signed-off-by: Charel Baum (external expert on behalf of DB Netz AG) <charel.baum-extern@deutschebahn.com>
@wotolom wotolom force-pushed the database-rdsinstance-fix-enhance-tag-updating branch from f7297fa to 5844525 Compare December 7, 2023 10:19
Signed-off-by: Charel Baum (external expert on behalf of DB Netz AG) <charel.baum-extern@deutschebahn.com>
Copy link
Collaborator

@MisterMX MisterMX left a comment

Choose a reason for hiding this comment

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

LGTM. Thank you very much @wotolom!

@MisterMX MisterMX merged commit e6c1368 into crossplane-contrib:master Dec 11, 2023
9 checks passed
@wotolom wotolom deleted the database-rdsinstance-fix-enhance-tag-updating branch December 11, 2023 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

database.RDSInstance does not update tags
2 participants