Remove indirection and use a watcher #7
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Lots of indirection and small functions that are used only once. Let's get a brute force solution out before we refactor into smaller pieces. It's still unclear to me how this all API should work, and how it all should tie in.
Instead of using a controller (that reconciles all of the objects) we need to use a reflector (a cache + a watcher). We don't really need to reconcile objects in the same way a deployment needs to be reconciled, I don't think the use of a controller is appropriate.
I would get rid of all of the additional logic that you have and focus on getting the simplest thing out of the door. Do we have an integration test? Do we have a scenario to follow? Logic so far is a bit of a mishmash of ideas and it's hard to follow what we need to do.
I left some todos scattered around (focus on them as you will; I wouldn't focus on the CLI args for example).
We're approaching a point of no return here with choosing our implementation language of choice. I'm still not sure Rust is a good idea given its complexity in initialising watchers. The memory model, borrowing and pinning might be a lot for something that we need to get up-n-running in 1 week from today.