fix(elasticache) normalize preferred maintenance window #1303
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of your changes
Relates to #1023
We discovered a state where
provider-aws
was repeatedly modifying the elasticache cluster without it becoming available, as described in #1023. Tracked the issue down to the use of a PreferredMaintenanceWindow argument that included capitalized day names:Fri:04:20-Fri:16:20
.This is invalid according to aws docs, as day names are supposed to be lowercased, however the AWS API accepts uppercased day names, and normalizes them behind the scenes to lowercased. This ends up breaking the
cacheClusterNeedsUpdate
check, which tests for exact equality between the declared maintenance window in the resource spec (which will still be uppercased), and the maintenance window returned from the AWS API, which will be lowercased.This PR offers a potential fix, by normalizing the casing of the maintenance window when performing this check. However, it suffers from the following issues:
Overall it might be better to try to validate this string at resource-create time, but that would likely require a webhook, etc.
I have:
make reviewable test
to ensure this PR is ready for review.How has this code been tested
adds a unit test, also tested against the AWS API with ReplicationGroup resource w/ capitalized day names.