The way how v0 KubernetesComputeResourcesPatch currently behaves enforces charms using the library to implement a push status pattern to keep track of failures that might have happened during the patching. Even the existing function is_ready doesn't have enough info to determine whether the patch is not ready because it has failed or because its still in progress. That introduces an overhead of managing that "push" status and probably maintaining a StoredState in the charm.
Solution
Introduce a new API function get_status that gets the current status of the patch operation.
get_status will return one of 3 possible states:
1- succeeded: a patch operation has completed successfully or the patch operation itself has not started yet.
2- failed: using dry-run mechanism, detect if the patch operation would've failed.
3- in_progress: rollout status-like logic to detect if the patch is still being applied and not fully ready.
Testing Instructions
A tandem PR for loki for using the new version of the library and test existing functionality as normal.
Upgrade Notes
Charms can continue using this new version of the library same way as before relying on is_ready as a push status. If charms wish to transform that as a pull status, they should start using get_status in collect-unit-status and depending on the state of the patch returned, set the desired state of the charm.
Issue
The way how v0
KubernetesComputeResourcesPatch
currently behaves enforces charms using the library to implement apush
status pattern to keep track of failures that might have happened during the patching. Even the existing functionis_ready
doesn't have enough info to determine whether the patch is not ready because it has failed or because its still in progress. That introduces an overhead of managing that "push" status and probably maintaining aStoredState
in the charm.Solution
Introduce a new API function
get_status
that gets the current status of the patch operation.get_status
will return one of 3 possible states: 1- succeeded: a patch operation has completed successfully or the patch operation itself has not started yet. 2- failed: usingdry-run
mechanism, detect if the patch operation would've failed. 3- in_progress:rollout status
-like logic to detect if the patch is still being applied and not fully ready.Testing Instructions
A tandem PR for loki for using the new version of the library and test existing functionality as normal.
Upgrade Notes
Charms can continue using this new version of the library same way as before relying on
is_ready
as a push status. If charms wish to transform that as a pull status, they should start usingget_status
incollect-unit-status
and depending on the state of the patch returned, set the desired state of the charm.