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

ErrorStatusHandler - support for better error reporting in status #685

Merged
merged 8 commits into from
Nov 19, 2021

Conversation

csviri
Copy link
Collaborator

@csviri csviri commented Nov 16, 2021

See linked issue.

@csviri csviri self-assigned this Nov 16, 2021
@csviri csviri linked an issue Nov 16, 2021 that may be closed by this pull request
* common that the custom resource is changed during an execution, and it's much cleaner to have
* to original resource in place for status update.
*/
private R cloneResourceIfErrorStatusHandlerIfCouldBeCalled(R resource, Context context) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This method name doesn't make sense :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

:D
will rename it :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done. :) not sure if much better


import io.fabric8.kubernetes.client.CustomResource;

public interface ErrorStatusHandler<T extends CustomResource<?, ?>> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Once we have the HasStatus (or similar) interface, this probably should use that instead of CustomResource

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It will be moved to HasMetada if the other PR is merged.

* common that the custom resource is changed during an execution, and it's much cleaner to have
* to original resource in place for status update.
*/
private R cloneResourceIfErrorStatusHandlerIfNeeded(R resource, Context context) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

The more I think about it, the less I'm sure we need to clone before updating the status. Presumably, if the resource has changed, the reconciliation will happen again and this update should be cancelled, anyway?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

as mentioned in the docs, it is for the case when the reconciliation executed but at some point an exception thrown, meannwhile in the logic of reconcile the status could be updated on the CR. I don't think we should use that, rather the original version of the resource. Since also info could be deleted, it's probably better to work with the fresh copy.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Not convinced but I'll trust your judgement on this. :)

@csviri csviri merged commit 3d1f4a0 into v2 Nov 19, 2021
@csviri csviri deleted the error-status-handler branch November 19, 2021 15:23
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.

Support Retry Last Attempt Explicitly
2 participants