fix(eks): Add reconciliation for addon configurationValues #1844
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
eks addon configurationValues is supported already in the spec but is not included in
isUpToDate
and therefore can never be changed with the provider.https://github.com/crossplane-contrib/provider-aws/blob/master/apis/eks/v1alpha1/zz_addon.go#L40-L43
This PR adds the custom
isUpToDate
in order to update theconfigurationValues
The configurationValues is a string value but both json and yaml are supported. (See - https://aws.amazon.com/blogs/containers/amazon-eks-add-ons-advanced-configuration/)
Note the implementation for the string comparison.
Whitespace and indendation is difficult to get correct when using a string value.
This PR does UnMarshal and Marshal the json or yaml to ensure that the comparison is more accurate. It lessens the risk that this provider will continually request an update of the external resource due to formatting, similar to the "normalization" done with iam policies. Unit test cases have been added for testing format differences.
The addOn example has been updated to reflect yaml definition but json is supported as well.
yaml:
json:
What this PR does NOT do:
Fixes #
I have:
make reviewable test
to ensure this PR is ready for review.How has this code been tested
define configurationValues for an addOn using the above json
ensure provider-aws reconciles the resource and json configurationValues appear in the console
ensure that upon the next reconcile the
External resource is up to date
set configurationValues to ""
ensure provider-aws reconciles the resource and the default value of
-
appears in the consoleensure that upon the next reconcile the
External resource is up to date
do the same as the above but with yaml
ensure that no changes are made when
configurationValues
is not defined for anaddOn
- provider-aws reconciles the resource and the default value of-
appears in the consoleensure that the isUpToDate for configurationValues handles exceptions and returns them so they can be written as errors in the logs
ensure that when using values which violate the schema the provider throws the exception to the logs: