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 No modifications were requested issue during sdkUpdate for CacheSubnetGroup #112

Conversation

mustafasencer
Copy link
Contributor

@mustafasencer mustafasencer commented Mar 10, 2023

Description of changes:

  • Encountered InvalidParameterValue: No modifications were requested. during sdkUpdate just after an adoption of an existing resource. I introduced a custom update for the CacheSubnetGroup resource in order to swallow the error during sdkUpdate. Waiting your comments/reviews in case there is a better approach to handle this issue.

For more context: #111 (review)

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

@ack-prow ack-prow bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Mar 10, 2023
@ack-prow
Copy link

ack-prow bot commented Mar 10, 2023

Hi @mustafasencer. Thanks for your PR.

I'm waiting for a aws-controllers-k8s member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@a-hilaly
Copy link
Member

/ok-to-test

@ack-prow ack-prow bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 10, 2023
Comment on lines 32 to 42
resp, err = rm.sdkapi.ModifyCacheSubnetGroupWithContext(ctx, input)
rm.metrics.RecordAPICall("UPDATE", "ModifyCacheSubnetGroup", err)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Message() {
case "No modifications were requested.":
return desired, nil
}
}
return nil, err
}
Copy link
Member

Choose a reason for hiding this comment

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

IMO this is happening because the controller is trying to make an update request when it shouldn't. Idealy we should either fix the delta/readone first. And maybe eventually leverage OmitUnchangedField to generate the update function

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Based on your suggestion, I investigated a bit more and found that the post set output template I added (here) was fixing the primary issue where the controller fails with a Reconciler error (spec.subnetIDs: Required value) before even starting the Sync and thus not hitting sdkFind.
After the addition of a read many post set output template, now I see that the Sync starts with success and the template logic appends the ko.Spec.SubnetIDs slice with duplicate values which misleads the delta to which leads to updating the resource.

My quick solution: I am just checking if ko.Spec.SubnetIDs is populated or not before proceeding.
Another approach (perhaps): If there is another way to start Sync with success without a template addition, please advise, it could perhaps be a more sound approach 🤷

Copy link
Member

Choose a reason for hiding this comment

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

I think we should not have duplicates at all - we need to focus on properly appending the subnets. Check my comment in the other PR https://github.com/aws-controllers-k8s/elasticache-controller/pull/111/files#r1133856530
@mustafasencer great job on testing and investigating this. I see that there were no elasticate releases 2 days ago but you still test the controllers - I'm curious to know how you do it :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@a-hilaly Thank for the prompt response! I addressed the comment in the new commit.

I am testing locally via the kind cluster where I build only the local image of the controller and test the adopted resource scenario.

@mustafasencer mustafasencer force-pushed the update-cache-subnet-group-custom-update branch from 8989b61 to e38d709 Compare March 13, 2023 08:03
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.

👍
/lgtm

@ack-prow ack-prow bot added the lgtm Indicates that a PR is ready to be merged. label Mar 13, 2023
@ack-prow
Copy link

ack-prow bot commented Mar 13, 2023

[APPROVALNOTIFIER] This PR is APPROVED

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

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

@ack-prow ack-prow bot added the approved label Mar 13, 2023
@ack-prow ack-prow bot merged commit 0ca9116 into aws-controllers-k8s:main Mar 13, 2023
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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants