-
Notifications
You must be signed in to change notification settings - Fork 258
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
Patching status after removing finalizer #931
Comments
@surajkota would this problem go away if we simply removed the finalizer in |
@jaypipes yes. The PRs linked to the issue are helping do same thing. Lmk if you are proposing something different |
Issue #, if available: aws-controllers-k8s/community#931 Description of changes: Solution 2 in the issue linked above. If `rm.Delete` does not return an error, and observed is also nil, return `nil, nil` to the caller instead of the resource passed to the method. Testing: `make test` Manually using sagemaker controller By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Issue #, if available: aws-controllers-k8s/community#931 Description of changes: Solution 1 in the issue linked above - `return nil, nil` instead of `resource, nil` after finalizer is removed Testing: `make test` Manually using sagemaker controller By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Issue #, if available: fixes - aws-controllers-k8s/community#937 - aws-controllers-k8s/community#931 - aws-controllers-k8s/community#938 - (hopefully) aws-controllers-k8s/community#935 - ran 100 iterations of the test locally using kind cluster Description of changes: update runtime 0.13.2 and regenerate code to fix the issues above Testing: `make test` PR build By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Issue #, if available: fixes - aws-controllers-k8s/community#937 - aws-controllers-k8s/community#931 - aws-controllers-k8s/community#938 - (hopefully) aws-controllers-k8s/community#935 - ran 100 iterations of sagemaker adopted endpoint test locally using kind cluster Description of changes: update runtime 0.13.2 and regenerate code to fix the issues above Testing: `make test` PR build By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Current solution does not cover the cases where resource status needs patching before it is marked as managed. See aws-controllers-k8s/runtime#64 Reopening this issue and I will propose some more solution to this problem. |
ContextACK reconciler patches resource status only once at the end of reconciler loop using However, there is one race condition in above flow for Delete operation. Since reconciler removes the finalizer before calling If the resource is deleted first, PatchStatus operation logs a Note: Functionality wise there is no impact caused by this race condition. If the resource is deleted, it is perfectly fine to ignore Existing SolutionCheck for finalizer on the resource before patching the resource status. Con:
Proposed SolutionKeep the existing code as is but check the error for
|
@vijtrip2 thank you for the excellent and very clear description of the problem and alternative solutions above! I agree with you that the proposed solution of keeping the existing code but checking for the NotFound in the |
Describe the bug
See the Logs above. Controller is trying to patch status after finalizer is removed and gets an error
"error": "models.sagemaker.services.k8s.aws \"xgboost-model\" not found"}
. This bug was introduced in aws-controllers-k8s/code-generator#175 whenrm.Delete()
started returning a resource passed throughupdateConditions
instead ofnil
post successful delete.https://github.com/aws-controllers-k8s/code-generator/blob/a866a846b883a772c4671061783ccc21a48f9412/templates/pkg/resource/manager.go.tpl#L157-L160
Steps to reproduce
generate controller with the latest code-gen and delete a resource
Expected solution
return nil, nil
instead oflatest, nil
after finalizer is removed - https://github.com/aws-controllers-k8s/runtime/blob/24e0b8ddeaaf7df4bf55ef1a75e4608ea5ec01fb/pkg/runtime/reconciler.go#L508return nil, nil
. When delete is successful and returns nil resource, pass the same to the caller instead of returning the resource passed to this method.Recommended solution - Implement both 1&2. Please let me know your thoughts. I have opened PRs for solutions 1&2.
The text was updated successfully, but these errors were encountered: