Closed dylanhitt closed 2 years ago
Hi Dylan! The retry.RetryOnConflict
is one of the must-have examples, so please go for it!
For the actual code, we could probably simplify it a bit. How about:
Additionally, you could put your explanation for the real-world Pod & controllers use case on the top of this code. This would allow us to keep the mini-program simple (and not run any workloads in the cluster), and wire the example with the real-world situation. WDYT?
I understand.
So the actual code execution will fail out completely once the retry limit is reached.
And yeah that sounds good, I think as long as a we have a snippet of it should really look like will suffice.
Implemented in #6
The repository should include an example of
retry.RetryOnConflict
.Current implementation idea:
Folder Name:
retry-on-conflict
General Flow:Implement retry function. To display the use we could use a timer to demonstrate performing long running task to validate the status of an object. For instance sometimes when working with CRDs that create resources external to k8s, gathering status can take a significant amount of time. A very naive solution would be just using a flag and skipping fetch on the first try. Not quite sure, but a simple explanation would be better than a complex example. Maybe someone has some thoughts on how to emulate this situation easily.
I'd like to submit a PR for this as I recently hit this position in a custom controller. @iximiuz I'd like to hear thoughts.